-->
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.  [ 5 posts ] 
Author Message
 Post subject: Middlegen Error, and middlegen mailing lists are no help
PostPosted: Mon Feb 28, 2005 1:01 pm 
Regular
Regular

Joined: Fri Feb 13, 2004 10:02 pm
Posts: 90
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
2.1.8

Mapping documents:
None
Code between sessionFactory.openSession() and session.close():
None
Full stack trace of any exception that occurs:
[middlegen] BUILD FAILED: file:C:/JAVAProjects/LASer/LASer/LASerWorkspace/DataAccess/build.xml:75: Could not create task of type: middlegen due to java.lang.NoClassDefFoundError: org.apache.log4j.Category
Name and version of the database you are using:
DB2 8.2
The generated SQL (show_sql=true):
None
Debug level Hibernate log excerpt:
None

I am using middlegen to try and generate my hbm files since I must integrate
with a legacy database. Below is the output of my build


Code:


Buildfile: C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\build.xml

init:
        [echo] classpath=C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\aopalliance.jar;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\c3p0-0.8.4.5.jar;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\cglib-full-2.0.2.jar;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\commons-collections-2.1.1.jar;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\commons-dbcp-1.2.1.jar;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\commons-lang-1.0.1.jar;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\commons-logging-1.0.4.jar;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\commons-pool-1.2.jar;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\concurrent-1.3.3.jar;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\connector.jar;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\dom4j-1.4.jar;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\ehcache-0.9.jar;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\hibernate2.jar;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\jdbc2_0-stdext.jar;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\jgroups-2.2.7.jar;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\jta.jar;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\log4j-1.2.8.jar;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\log4j.properties;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\odmg-3.0.jar;C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess\lib\spring.jar

middlegen:
        [echo] Class path = C:\JAVAProjects\LASer\LASer\LASerWorkspace\DataAccess
   [middlegen] BUILD FAILED: file:C:/JAVAProjects/LASer/LASer/LASerWorkspace/DataAccess/build.xml:75: Could not create task of type: middlegen due to java.lang.NoClassDefFoundError: org.apache.log4j.Category
Total time: 218 milliseconds



Here is my build file
Code:
<?xml version="1.0"?>



<project name="Laser Data Acess" default="middlegen" basedir=".">


   <property name="lib.dir" value="lib" />
   <property name="dist.dir" value="dist" />
   <property name="src.dir" value="src" />
   <property name="etc.dir" value="etc"/>
   
   <property name="name" value="com.llic.dataaccess"/>
   <property name="gui" value="true"/>
   <property name="database.url" value="jdbc:db2://ludb.llic.com:50000/LASER"/>
   <property name="database.driver" value="com.ibm.db2.jcc.DB2Driver"/>
   <property name="database.userid" value="lasertst"/>
   <property name="database.password" value="lasertst"/>
   <property name="database.schema" value="LASER"/>

   <target name="init">

      <!-- creates the destination directories -->
      <mkdir dir="${compile.dir}" />
      <mkdir dir="${dist.dir}" />
      

      <!-- sets the classpath required to compile the classes -->
      <path id="classpathref">
         <fileset dir="${lib.dir}">
            <include name="*.jar" />
            <include name="*.properties"/>
         </fileset>
      </path>
      
      <pathconvert property="classpathrefprint" refid="classpathref" pathsep=";" />
   
      <echo message="classpath=${classpathrefprint}"/>
      
   </target>



<!-- ============================================================== -->
<!-- Run Middlegen -->
<!-- ============================================================== -->

<target
   name="middlegen"
   description="Run Middlegen"
   unless="middlegen.skip"
   depends="init"
>
  <mkdir dir="${build.gen-src.dir}"/>
  <echo message="Class path = ${basedir}"/>

  <taskdef
    name="middlegen"
    classname="middlegen.MiddlegenTask"
    classpathref="classpathref"
   
  />

  <middlegen
    appname="${name}"
    prefsdir="${src.dir}"
    gui="${gui}"
    databaseurl="${database.url}"
    driver="${database.driver}"
    username="${database.userid}"
    password="${database.password}"
    schema="${database.schema}"
    catalog="${database.catalog}"
   
  >

     <!-- Plugins -->
     <hibernate
        destination="${build.gen-src.dir}"
        package="${name}.hibernate"
        javaTypeMapper="middlegen.plugins.hibernate.HibernateJavaTypeMapper"
     />

   </middlegen>
   <mkdir dir="${build.classes.dir}"/>
</target>
</project>





As you can see from the output, log4j is in my classpath. Has anyone else encountered this?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 28, 2005 8:58 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Have you tried the download package in its standard form, eg, using the sample database I supplied first? Just to make sure all is well.

Class path issues can be a pain to sort out for various reasons.

I would suggest you do a search on the tools forum as well since this is where the bulk of the Middlegen questions are located.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 28, 2005 9:02 pm 
Regular
Regular

Joined: Fri Feb 13, 2004 10:02 pm
Posts: 90
David,
I did get it running, but it was a gross hack. Basically the DB2 type 4 drivers require 3 jars, the core driver jar, as well as 2 license jars. In order to get middlegen to run, I had to create a jar that contained the contents of all three. Does middlegen have any support for multiple jars instead of just a single driver jar?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 28, 2005 9:07 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Eh? As long as the JDBC driver jar(s) [and/or dlls etc] are in the classpath then it should work fine. Middlegen does nothing more than create a JDBC connection to the database. Once you get this working (which can be difficult) all should be fairly basic from there.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 28, 2005 9:16 pm 
Regular
Regular

Joined: Fri Feb 13, 2004 10:02 pm
Posts: 90
Strange, I pointed the driver jar to db2jcc.jar, but when I executed Middlegen, I recieved the liscence error from the DB2 libraries, and both of the liscence jars were in my classpath. I'm going to give it another try in the morning.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.