-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: HibernateDocletTask and LogConfigurationException
PostPosted: Wed Oct 20, 2004 11:02 pm 
Regular
Regular

Joined: Sun Sep 26, 2004 9:27 pm
Posts: 75
Location: Atlanta, GA, USA
I'm getting the following error when using the HibernateDocletTask
after using the org.apache.jasper.JspC task.

BUILD FAILED: C:\dev\games\conf\build\build.xml:321: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.Log4JLogger does not implement Log

I'm taking a wild stab in the dark, but I believe because the commons-logger attempts to support so many things, I'm crossing the streams here.

During the JSP generation, I also get this warning:

jsp-to-java:
[jasper2] log4j:WARN No appenders could be found for logger (org.apache.jasper.compiler.Compiler).
[jasper2] log4j:WARN Please initialize the log4j system properly.

Does anyone (MARK? HA!) have any idea how I can disable the HibDocTask logging facility during the build? I've tried verbose="0" and other things, but nothing has helped.

To re-iterate, the hibernate task alone works fine, it's only after being run after JSP generation that it fails.

Code:
<?xml version="1.0"?>

<project name="Production Build" default="all" basedir="../..">
   <!-- Load the custom build properties, so this file shouldn't be changed -->
   <property file="conf/build/build.properties" />

   <!-- Set the root configuration source location. -->
   <property name="config.dir" value="${basedir}/conf/" />
   <!-- Libraries used only for building source code. -->
   <property name="lib.build" value="${basedir}/lib/build" />
   <!-- Libraries used within the games environment. -->
   <property name="lib.run" value="${basedir}/lib" />

   <property name="src.dir" value="${basedir}/source/java" />

   <!--
   Default target for production deployment. 
   -->
   <target name="all" description="Executes all targets for production deployment." depends="properties,clean,prepare,compile,jsp-to-java,jsp-compile,jsp.merge.webxml,hibernate-mappings,db-schema,jar-all" />

   <target name="all-no-jsp" description="Executes all targets for production deployment, without compiling JSPs or creating jarfiles." depends="properties,clean,prepare,compile,hibernate-mappings,db-schema" />

   <target name="all-no-jar" description="Executes all targets for production deployment, without creating jarfiles." depends="properties,clean,prepare,compile,jsp-to-java,jsp-compile,jsp.merge.webxml,hibernate-mappings,db-schema" />

   <!-- Properties combined with either the development or production properties. -->
   <target name="properties" description="">
      <!-- Location of configuration files to be included in this build. -->
      <property name="config.common.dir" value="${config.dir}common/" />
      <!-- Location of configuration files to be included in this build. -->
      <property name="config.gameserver.dir" value="${config.dir}prod/gameserver/" />
      <!-- Location of WEB-INF configuration files to be included in this build. -->
      <property name="config.web-inf.dir" value="${config.gameserver.dir}WEB-INF/" />
      <!-- Set the properties for target build locations. -->
      <property name="build.dir" value="${basedir}/build/" />
      <!-- Location to which all java source is copied, and to which JSP java code is generated. -->
      <property name="build.java.source.dir" value="${build.dir}java/" />
      <property name="build.web.dir" value="${build.dir}web/" />
      <property name="build.web-inf.dir" value="${build.web.dir}/WEB-INF/" />
      <property name="build.classes.dir" value="${build.web-inf.dir}classes/" />
      <property name="build.lib.dir" value="${build.web-inf.dir}lib/" />
      <property name="build.config.dir" value="${build.dir}conf/" />
      <!-- Directory into which the hibernate application context will be created. -->
      <property name="build.config.hib.dir" value="${build.config.dir}hibernate/" />
      <property name="build.config.hib.context" value="${build.config.hib.dir}applicationContextDev.xml" />

      <property name="source.java.dir" value="${basedir}/source/java" />
      <property name="source.jsp.dir" value="${basedir}/source/html" />


      <!-- Set the directories for the final deployment. -->
      <property name="deploy.dir" value="${basedir}/deploy/" />
      <property name="deploy.web-inf.dir" value="${deploy.dir}WEB-INF/" />
      <property name="deploy.classes.dir" value="${deploy.web-inf.dir}classes/" />
      <property name="deploy.lib.dir" value="${deploy.web-inf.dir}lib/" />
      <property name="deploy.sql.dir" value="${deploy.dir}sql/" />

      <property name="temp" value="${build.dir}temp" />

      <!-- Define a path for both JSP generation and compilation -->
      <path id="jsp.compile">
         <!-- This path element makes sure the classes and hibernate.properties is found. A fileset include will not work. -->
         <pathelement location="${java.home}/lib/tools.jar" />
         <pathelement location="${deploy.classes.dir}" />
         <pathelement location="${lib.build}/appserv-jstl.jar" />
         <fileset dir="${catalina.home}/bin">
            <include name="*.jar" />
         </fileset>
         <fileset dir="${catalina.home}/server/lib">
            <include name="*.jar" />
         </fileset>
         <fileset dir="${catalina.home}/common/lib">
            <include name="*.jar" />
         </fileset>
         <fileset dir="${catalina.home}/shared/lib">
            <include name="*.jar" />
         </fileset>
      </path>         
   </target>

   <target name="clean" depends="properties">
      <!-- Delete old build, if it exists. -->
      <delete dir="${build.dir}" failonerror="true" />
      <delete dir="${deploy.dir}" failonerror="true" />
   </target>

   <target name="prepare" depends="properties" description="Copies needed property and XML files.">

      <!-- Make all necessary directories -->
      <mkdir dir="${build.classes.dir}" />
      <mkdir dir="${build.lib.dir}" />
      <mkdir dir="${build.config.dir}" />
      <mkdir dir="${build.config.hib.dir}" />
      <mkdir dir="${temp}" />

      <mkdir dir="${deploy.classes.dir}" />
      <mkdir dir="${deploy.web-inf.dir}" />
      <mkdir dir="${deploy.lib.dir}" />
      <mkdir dir="${deploy.sql.dir}" />

      <!-- Copy all java source to the build directory. -->
      <copy overwrite="true" failonerror="true" todir="${build.java.source.dir}">
         <fileset dir="${source.java.dir}">
            <include name="**/*.java" />
         </fileset>
      </copy>
      <!-- Copy all JSP source to the build directory. -->
      <copy overwrite="true" failonerror="true" todir="${build.web.dir}">
         <fileset dir="${source.jsp.dir}">
            <include name="**/*.jsp" />
         </fileset>
      </copy>
      <!-- Copy the GameServer properties and XML files. -->
      <copy overwrite="true" failonerror="true" todir="${build.web.dir}">
         <fileset dir="${config.gameserver.dir}">
            <include name="**/*.properties" />
            <include name="**/*.xml" />
         </fileset>
      </copy>
      <copy overwrite="true" failonerror="true" todir="${build.web.dir}">
         <fileset dir="${config.common.dir}">
            <include name="**/*.properties" />
            <include name="**/*.xml" />
            <include name="**/*.tld" />
         </fileset>
      </copy>
      <copy failonerror="true" todir="${build.lib.dir}">
         <fileset dir="${basedir}/lib">
            <include name="*.jar" />
         </fileset>
      </copy>



   </target>

   <!-- Compiles all source code, referencing library dependencies. -->
   <target name="compile" description="Compiles the application source.">
      <javac srcdir="${build.java.source.dir}" destdir="${deploy.classes.dir}" fork="true" debug="true">
         <classpath>
            <fileset dir="${lib.build}" includes="*.jar" />
            <fileset dir="${lib.run}" includes="*.jar" />
         </classpath>
      </javac>
   </target>


   <!-- Converts all JSPs to java code. Optimized for Tomcat 5.x -->
   <target name="jsp-to-java" depends="properties">
      <taskdef classname="org.apache.jasper.JspC" name="jasper2" classpathref="jsp.compile" />
      <jasper2 verbose="0" package="p2p.ui.jsp" validateXml="false"
         webxml="${build.web-inf.dir}/web.xml" uriroot="${build.web.dir}"
         webXmlFragment="${temp}/webinc.xml" outputDir="${build.java.source.dir}" />
   </target>


   <!--
   Compiles the generated java files from JSPs to binary classes. This differs from a normal compile, in that it must reference
   Catalina jars.
   -->
   <target name="jsp-compile" description="Compiles generated JSP code." depends="jsp-to-java">
      <javac srcdir="${build.java.source.dir}" destdir="${deploy.classes.dir}"
         fork="true" debug="true"
         classpathref="jsp.compile" />
   </target>


   <!--
   Merges the generated JSP/Java Servlet Classes information with the WEB-INF configuration file.
   -->
   <target name="jsp.merge.webxml" depends="jsp-to-java,jsp-compile">
      <!-- Load the webinc file created during the jsp-to-java target. -->
      <loadfile property="webinc.xml" srcFile="${temp}/webinc.xml" failonerror="true" />

      <!--
      Copy the web.xml file again, inserting the JSP servlets mappings that were created when the they were compiled.
      -->
      <copy overwrite="true" file="${config.web-inf.dir}/web.xml" toFile="${deploy.web-inf.dir}/web.xml">
         <filterset begintoken="${web.xml.jsp.token.begin}" endtoken="${web.xml.jsp.token.end}">
            <filter token="${web.xml.jsp.token}" value="${webinc.xml}" />
         </filterset>
      </copy>
   </target>


   <!--
   Generates Hibernate hbm.xml files.
   -->
   <target name="hibernate-mappings" description="Generates Hibernate class descriptor files." depends="properties">
      <!-- Defines the hibernatedoclet task to be executed below. -->
      <taskdef name="hibernatedoclet" classname="xdoclet.modules.hibernate.HibernateDocletTask">
         <classpath>
            <fileset dir="${lib.run}" includes="*.jar" />
            <fileset dir="${lib.build}" includes="*.jar" />
         </classpath>
      </taskdef>
      <!-- Execute the hibernatedoclet task, placing all hbm.xml files with the classes. -->
      <hibernatedoclet destdir="${deploy.classes.dir}"
         excludedtags="@version,@author,@todo,@see,@since" force="true" verbose="0">
         <fileset dir="${build.java.source.dir}">
            <include name="**/*.java" />
         </fileset>
         <hibernate version="2.0" />
      </hibernatedoclet>
   </target>

   <!--
   Using the classes and hbm.xml files within the classpath, a database ddl file is created.
   -->
   <target name="db-schema" description="Generates a DB schema file from the hibernate class mapping files." depends="properties">
      <!-- Set up the class path for hibernate sql generation. -->
      <path id="project.class.path">
         <!-- This path element makes sure the classes and hibernate.properties is found. A fileset include will not work. -->
         <pathelement location="${deploy.classes.dir}" />
         <fileset dir="/dev/games/lib">
            <include name="commons-collections-3.1.jar" />
            <include name="commons-logging.jar" />
            <include name="commons-primitives-1.0.jar" />
            <include name="dom4j-1.5.jar" />
            <include name="hibernate2.jar" />
            <include name="log4j-1.2.8.jar" />
            <include name="struts.jar" />
         </fileset>
      </path>

      <taskdef name="schemaexport" classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask" classpathref="project.class.path" />

      <schemaexport properties="${build.web-inf.dir}/hibernate.properties" delimiter=";" drop="false" output="${deploy.sql.dir}/hibernate_schema.sql" quiet="false" text="true">
         <fileset dir="${deploy.classes.dir}">
            <include name="**/*.hbm.xml" />
         </fileset>
      </schemaexport>
   </target>

</project>


Top
 Profile  
 
 Post subject: Solution
PostPosted: Thu Oct 21, 2004 9:55 am 
Regular
Regular

Joined: Sun Sep 26, 2004 9:27 pm
Posts: 75
Location: Atlanta, GA, USA
Just to prove how smart Mark Eagle is, he fixed my problem:

Quote:
Does it make any difference if you run the Hibernate task first and then the jspc task second? I would switch the order and see what happens.


Now THAT's outside the box thinking people, and it works wonderfully. I'm honored that he and his wife are naming their first child after me, regardless of the sex.

Lukas


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.