Sorry.. 
IT department's fault :-)
Renamed the attachments.

[]'s
Tony Lumpda

-----Mensagem original-----
De: Tony Calleri França [mailto:[EMAIL PROTECTED] 
Enviada em: segunda-feira, 21 de junho de 2004 17:15
Para: [EMAIL PROTECTED]
Assunto: [Hibernate] [hbm2java] BUG


I Think maybe I´ve found one:

Apparently everything is set up ok, but I get a NullPointerException during
the ant task (see console-output below). More info on the attachments:

build.xml: E:\tony\gaga\JBuilderEJB\build.xml
HBM file:
E:\tony\gaga\JBuilderEJB\src\br\com\compsisnet\model\Property.hbm.xml
Libraries: E:\tony\gaga\JBuilderEJB\lib\filelist.txt

Or maybe it´s just me doing something wrong.
Anyway, any help would be appreciated :-)

[]´s
Tony Lumpda 

---console output---

E:\tony\gaga\JBuilderEJB>ant hbm2java
Buildfile: build.xml

hbm2java:
 [hbm2java] Processing 1 files.
 [hbm2java] Building hibernate objects
 [hbm2java] java.lang.NullPointerException
 [hbm2java]     at
net.sf.hibernate.tool.hbm2java.BasicRenderer.isPropertySet(BasicRenderer.jav
a:611)
 [hbm2java]     at
net.sf.hibernate.tool.hbm2java.BasicRenderer.generateConcreteEmptyClasses(Ba
sicRenderer.java:332)
 [hbm2java]     at
net.sf.hibernate.tool.hbm2java.BasicRenderer.render(BasicRenderer.java:59)
 [hbm2java]     at
net.sf.hibernate.tool.hbm2java.Generator.write(Generator.java:138)
 [hbm2java]     at
net.sf.hibernate.tool.hbm2java.Generator.writeRecur(Generator.java:115)
 [hbm2java]     at
net.sf.hibernate.tool.hbm2java.Generator.generate(Generator.java:104)
 [hbm2java]     at
net.sf.hibernate.tool.hbm2java.CodeGenerator.main(CodeGenerator.java:125)
 [hbm2java]     at
net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.processFile(Hbm2JavaTask.java:14
5)
 [hbm2java]     at
net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.execute(Hbm2JavaTask.java:95)
 [hbm2java]     at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
 [hbm2java]     at org.apache.tools.ant.Task.perform(Task.java:364)
 [hbm2java]     at org.apache.tools.ant.Target.execute(Target.java:301)
 [hbm2java]     at org.apache.tools.ant.Target.performTasks(Target.java:328)
 [hbm2java]     at
org.apache.tools.ant.Project.executeTarget(Project.java:1215)
 [hbm2java]     at
org.apache.tools.ant.Project.executeTargets(Project.java:1063)
 [hbm2java]     at org.apache.tools.ant.Main.runBuild(Main.java:632)
 [hbm2java]     at org.apache.tools.ant.Main.startAnt(Main.java:183)
 [hbm2java]     at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
 [hbm2java]     at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)

BUILD SUCCESSFUL
Total time: 2 seconds
E:\tony\gaga\JBuilderEJB>


<!DOCTYPE project [
    <!ENTITY database SYSTEM "file:mysql.xml">
]>

<project name="JBuilderEJB" default="compile" basedir=".">

  <property file="${basedir}/build.properties"/>
  <property name="src.dir"       value="${basedir}/src"/>
  <property name="build.dir"     value="${basedir}/classes"/>
  <!--property name="servlet.jar"   value="${jboss.server}/lib/javax.servlet.jar"/-->
  <property name="build.gen-src.dir"              value="${basedir}/src"/>

   &database;

  <!--
   | Classpath de bibliotecas
   -->
  <path id="lib.classpath">
    <fileset dir="${basedir}/lib">
      <include name="**/*.jar"/>
    </fileset>
  </path>

  <!--
   | The classpath for running the client
   -->
  <path id="client.classpath">
    <pathelement location="${build.dir}"/>
    <fileset dir="${jboss.home}/client">
      <include name="**/*.jar"/>
    </fileset>
    <!-- the following jars are only used for the web-service client -->
    <fileset dir="${jboss.home}/server/all/deploy/jboss-net.sar">
      <include name="*.jar"/>
    </fileset>
  </path>

  <!--
   | The build classpath
   -->
  <path id="build.classpath">
    <path refid="client.classpath"/>
    <pathelement location="${servlet.jar}"/>
  </path>
  
  <!--
   | Hypersonic SQL classpath
   -->
  <path id="hsql.classpath">
    <pathelement location="${jboss.server}/lib/hsqldb.jar"/>
  </path>

  <!-- =================================================================== -->
  <!-- Compiles the source code                                            -->
  <!-- =================================================================== -->
  <target name="compile">
    <javac destdir="${build.dir}" classpathref="build.classpath">
      <src path="${src.dir}"/>
    </javac>
  </target>

  <!--target name="package-account" depends="compile">
    <delete file="jar/account-ejb.jar"/>
    <copy file="dd/account-ejb.xml" tofile="build/ejb-jar.xml" overwrite="true"/>
    <copy file="dd/account-jboss.xml" tofile="build/jboss.xml" overwrite="true"/>

    <jar jarfile="jar/account-ejb.jar">
      <metainf dir="${build.dir}" includes="ejb-jar.xml,jboss.xml" />
      <fileset dir="${build.dir}">
        <include name="com/sun/ebank/ejb/account/**" />
        <include name="com/sun/ebank/ejb/exception/**" />
        <include name="com/sun/ebank/util/**" />        
        <include name="com/sun/ebank/ejb/customer/Customer.class" />
        <include name="com/sun/ebank/ejb/customer/CustomerHome.class" />        
      </fileset>
    </jar>
  </target>

  <target name="package-customer" depends="compile">
    <delete file="jar/customer-ejb.jar"/>
    <copy file="dd/customer-ejb.xml" tofile="build/ejb-jar.xml" overwrite="true"/>
    <copy file="dd/customer-jboss.xml" tofile="build/jboss.xml" overwrite="true"/>

    <jar jarfile="jar/customer-ejb.jar">    
      <metainf dir="${build.dir}" includes="ejb-jar.xml,jboss.xml" />
      <fileset dir="${build.dir}">
        <include name="com/sun/ebank/ejb/customer/**" />
        <include name="com/sun/ebank/ejb/exception/**" />
        <include name="com/sun/ebank/util/**" />    
      </fileset>
    </jar>    
  </target>

  <target name="package-tx" depends="compile">
    <delete file="jar/tx-ejb.jar"/>
    <copy file="dd/tx-ejb.xml" tofile="build/ejb-jar.xml" overwrite="true"/>
    <copy file="dd/tx-jboss.xml" tofile="build/jboss.xml" overwrite="true"/>

    <jar jarfile="jar/tx-ejb.jar">    
      <metainf dir="${build.dir}" includes="ejb-jar.xml,jboss.xml" />
      <fileset dir="${build.dir}">
        <include name="com/sun/ebank/ejb/tx/**" />
        <include name="com/sun/ebank/ejb/exception/**" />
        <include name="com/sun/ebank/util/**" />
        <include name="com/sun/ebank/ejb/account/Account.class" />
        <include name="com/sun/ebank/ejb/account/AccountHome.class" />         
      </fileset>
    </jar>    
  </target>

  <target name="package-ejb" depends="package-account,package-customer,package-tx" /-->

  <!--target name="package-client" depends="compile">
    <copy todir="${build.dir}" >
      <fileset dir="${src.dir}">
        <include name="**/appclient/*.properties" />
      </fileset>
      <mapper type="flatten" />
    </copy>
    <delete file="jar/app-client.jar"/>
    <copy file="dd/jboss-client.xml" todir="${build.dir}" overwrite="true"/>
    <copy file="dd/app-client.xml" tofile="${build.dir}/application-client.xml" 
overwrite="true"/>
    <copy file="dd/jndi.properties" todir="${build.dir}"/>

    <jar jarfile="jar/app-client.jar">    
      <metainf dir="${build.dir}" includes="jboss-client.xml,application-client.xml" />
      <fileset dir="${build.dir}">
        <include name="jndi.properties"/>
        <include name="com/sun/ebank/appclient/**" />
        <include name="Admin*.properties" />        
        <include name="com/sun/ebank/ejb/exception/**" />
        <include name="com/sun/ebank/util/**" />
        <include name="com/sun/ebank/ejb/customer/Account.class" />        
        <include name="com/sun/ebank/ejb/customer/AccountHome.class" />         
      </fileset>
    </jar>    
  </target-->

  <target name="package_hibernate-service" depends="compile">
         <delete file="jar/hibernate-service.sar" />
         <jar destfile="jar/hibernate-service.sar" basedir="${build.dir}" 
includes="br/com/compsisnet/**">
           <metainf dir="${basedir}/dd">
                   <include name="jboss-service.xml" />
           </metainf>
         </jar>
  </target>

  <target name="package-web" depends="compile">
     <delete file="jar/web-client.war"/>
     <war warfile="jar/web-client.war" webxml="defaultroot/WEB-INF/web.xml">
       <fileset dir="defaultroot" >
          <include name="**/*.jsp" />
          <include name="images/*.gif" />
       </fileset>
       <webinf dir="defaultroot/WEB-INF">
           <include name="jboss-web.xml" />
           <include name="struts-config*.xml" />
       </webinf>       
       <webinf dir="defaultroot/WEB-INF" >
           <include name="*.tld" />
           <exclude name="*.xml" />
        </webinf>
       <lib dir="lib">
           <include name="struts.jar" />
           <include name="commons*.jar"/>
           <include name="hibernate2.jar"/>
        </lib>
       <classes dir="${build.dir}" >
           <include name="br/com/compsisnet/controller/**/*.class" />
           <include name="jbuilderejb/**/*.class" />
           <include name="util/**/*.class" />
       </classes>
       <!--classes dir="${src.dir}/web" >
          <include name="*.properties" />
       </classes-->
     </war> 
  </target>

  <!--
   | Creates an ear file containing the ejb jars and the web client war.
   -->
  <target name="assemble-app" depends="package-web">
    <delete file="jar/JBuilderEJB.ear"/>
    <ear destfile="jar/JBuilderEJB.ear" appxml="dd/application.xml">
      <fileset dir="jar" includes="testEJBModule.jar,*.war"/>
    </ear>
  </target>

  <!--
   | Deploys the EAR file by copying it to the JBoss deploy directory.
   -->
  <target name="deploy" depends="assemble-app">
    <copy file="jar/JBuilderEJB.ear" todir="${jboss.server}/deploy"/>
  </target>

  <target name="deploy-hibernate-service" depends="package_hibernate-service">
    <copy file="jar/hibernate-service.sar" todir="${jboss.server}/deploy"/>
  </target>


  <!--
   | Run the standalone client
   -->
  <!--target name = "run-client">
    <echo>${java.class.path}</echo>    
    <java classname="com.sun.ebank.appclient.BankAdmin" fork="yes">
      <classpath>
         <pathelement path="jar/app-client.jar"/>
         <path refid="client.classpath"/>
         <pathelement path="${java.class.path}"/>
      </classpath>
    </java>
  </target-->


  <!--
   | Call the HSQL ScriptTool utility.
   -->

<!--
 | Build a web-service WSR file
 -->
  <!--target name = "wsr">
    <delete file="jar/ebank.wsr"/>  
    <jar jarfile="jar/ebank.wsr" basedir="${build.dir}">
      <metainf dir="dd" includes="web-service.xml" />
      <exclude name="**"/>
    </jar>
  </target>
  
  <target name="deploy-wsr" depends="wsr">
    <copy file="jar/ebank.wsr" todir="${jboss.server}/deploy"/>
  </target-->  

<!--
 | Run the web services client
 -->
  <!--target name = "run-ws-client">
    <echo>${java.class.path}</echo>    
    <java classname="WSClient">
      <classpath>
         <path refid="client.classpath"/>
         <pathelement path="${java.class.path}"/>
      </classpath>
    </java>
  </target-->

<!--
 | Run the Axis TCPMon utility
 -->
  <!--target name = "tcpmon">
    <echo>${java.class.path}</echo>    
    <java classname="org.apache.axis.utils.tcpmon" fork="true">
      <classpath>
         <path refid="client.classpath"/>
         <pathelement path="${java.class.path}"/>
      </classpath>
    </java>
  </target-->

  <target name="clean">
    <delete dir="${build.dir}" />
  </target>

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

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

      <middlegen
         appname="model"
         prefsdir="${basedir}"
         gui="true"
         databaseurl="${database.url}"
         initialContextFactory="${java.naming.factory.initial}"
         providerURL="${java.naming.provider.url}"
         datasourceJNDIName="${datasource.jndi.name}"
         driver="${database.driver}"
         username="${database.userid}"
         password="${database.password}"
         schema="${database.schema}"
         catalog="${database.catalog}"
      >
         <hibernate
            destination="${build.gen-src.dir}"
            package="br.com.compsisnet.model"
         />
      </middlegen>
   </target>

   <target name="hbm2java">
      <taskdef
         name="hbm2java"
         classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
         classpathref="lib.classpath"
      />
                
                <hbm2java output="${build.gen-src.dir}">
                        <fileset dir="${build.gen-src.dir}">
                                <include name="**/*.hbm.xml"/>
                        </fileset>
                </hbm2java>
   </target>

</project>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"; >
    
<hibernate-mapping>
<!-- 
    Created by the Middlegen Hibernate plugin

    http://boss.bekk.no/boss/middlegen/
    http://hibernate.sourceforge.net/
-->

<class 
    name="br.com.compsisnet.model.Property" 
    table="properties"
>

    <id
        name="propertiesPk"
        type="int"
        column="properties_pk"
    >
        <generator class="increment" />
    </id>

    <property
        name="name"
        type="java.lang.String"
        column="name"
        not-null="true"
        length="100"
    />
    <property
        name="value"
        type="java.lang.String"
        column="value"
        not-null="true"
        length="255"
    />

    <!-- associations -->

</class>
</hibernate-mapping>

Reply via email to