[jboss-user] [JBoss Seam] - Re: Seam reverse engineering tool

gcowsar do-not-reply at jboss.com
Tue Jul 18 14:35:25 EDT 2006


OK, I got it working, finally!

There were several problems - most of which have been found by others but I'll repeat them here. There was one problem where I seem to be the only victim (see 2 below).

1) There once was a time when I had myfaces-api-1.1.3.jar in JBoss. I'm not sure how it got there :-) but it has to be named myfaces-api.jar -- I found out that it isn't all that version sensitive, I have 1.1.5 now which I built from subversion, but the jar can't have the version in the name.

2) My classes were not even in my EJB3 jar file. This is due to the code generator generating the wrong package name (I entered "test", it wants the package to be "src.test") and it also generates an incorrect exclude line in the build.xml.

<target name="ejb3" depends="compile">
  |         <jar jarfile="${build.dir}/${name}.ejb3">
  |             <fileset dir="${imported.basedir}">
  |                 <include name="${name}.jar" />
  |             </fileset>
  |             <fileset dir="${classes.dir}">
  |                 <include name="**/*.class" />
  |                 <exclude name="**/test/*.class" />
  |             </fileset>
  |             <fileset refid="ejb3.root" />
  |             <fileset refid="ejb3.lib" />
  |         </jar>
  |     </target>

The exclude line removes the classes that were just added to the ejb3 jar. You can't give the "Hibernate Code Generation..." tool a package name that will work -- you have to change the package name in the source after it is generated.

I think the exclude is intended to avoid copying the classes twice... ?

3) If you are using MySql you need a META-INF/jboss-beans.xml file like this:

<?xml version="1.0" encoding="UTF-8"?>
  | 
  | <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |             xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
  |             xmlns="urn:jboss:bean-deployer">
  | 
  |    <bean name="userDatasourceBootstrap" class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource">
  |       <property name="driverClass">org.gjt.mm.mysql.Driver</property>
  |       <property name="connectionURL">jdbc:mysql://localhost:3306/test</property>
  |       <property name="userName">root</property>
  |       <property name="password">mypassword</property>
  | 
  |       <property name="jndiName">java:/userDatasource</property>
  |       <property name="minSize">0</property>
  |       <property name="maxSize">10</property>
  |       <property name="blockingTimeout">1000</property>
  |       <property name="idleTimeout">100000</property>
  |       <property name="transactionManager"><inject bean="TransactionManager"/></property>
  |       <property name="cachedConnectionManager"><inject bean="CachedConnectionManager"/></property>
  |       <property name="initialContextProperties"><inject bean="InitialContextProperties"/></property>
  |    </bean>
  | 
  |    <bean name="userDatasource" class="java.lang.Object">
  |       <constructor factoryMethod="getDatasource">
  |          <factory bean="userDatasourceBootstrap"/>
  |       </constructor>
  |    </bean>
  | 
  | </deployment>

4) I think you want:

<property name="hibernate.hbm2ddl.auto" value="none" />

in your persistence.xml file or it will wipe out your tables if you leave it as "create-drop", and

<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />

5) You have to put jboss-beans.xml in the build.xml in the ejb3.root fileset:

<include name="META-INF/jboss-beans.xml" />




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958921#3958921

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958921



More information about the jboss-user mailing list