Hey everyone,

If you create a simple MySql database and then use the seam command-line tool 
to create a WAR using this database, then everything works fine on JBoss but 
not on Tomcat.  The WAR file assumes you are deploying to JBoss, not Tomcat.  
So I've created an Ant target to deploy to Tomcat.  However, I always get stuck 
on the DataSource.  Can anyone lend a hand?  Here are the instructions to 
recreate my mess:

1) Create a simple MySql database
2) Run the Seam command-line tool, and create a new WAR project.
    Let's call this project 'tomtom'.
3) Generate the entities using seam generate-entities
4) In the 'tomtom' root directory, create a file called 'tomcat.xml' with these 
contents:

<?xml version="1.0"?>
  | 
  | <project name="Tomcat Target" default="war.tomcat" basedir=".">
  |     <property name="tomcat.dir" 
value="${tomcat.home}/webapps/${project.name}" />
  |     <property name="tomcat.extra.files" 
value="${basedir}/tomcat-extra-files"/>
  | 
  |     <target name="war.tomcat" depends="compile,copyclasses" 
  |                     description="Build the distribution .war file for 
Tomcat">
  | 
  |             <delete dir="${tomcat.dir}"/>
  |             <mkdir dir="${tomcat.dir}"/>
  | 
  |             <copy todir="${tomcat.dir}/WEB-INF/classes">
  |                     <fileset dir="${basedir}/resources">
  |                             <include name="seam.properties" />
  |                             <include name="security.drl" />
  |                     </fileset>
  |             </copy>
  |             
  |             <copy todir="${tomcat.dir}/WEB-INF/classes">
  |                     <fileset dir="${tomcat.extra.files}"/>
  |             </copy>
  |             
  |             <copy 
tofile="${tomcat.dir}/WEB-INF/classes/META-INF/persistence.xml" 
  |                         
file="${basedir}/resources/META-INF/persistence-${profile}-war.xml"
  |                overwrite="true"/>
  |                
  |             <copy 
tofile="${tomcat.dir}/WEB-INF/classes/components.properties" 
  |                         file="${basedir}/resources/components.properties"
  |                overwrite="true"/>
  |                
  |             <copy 
tofile="${tomcat.dir}/WEB-INF/classes/${project.name}-${profile}-ds.xml"
  |                             
file="${basedir}/resources/${project.name}-${profile}-ds.xml" />
  |               
  |             <copy 
tofile="${tomcat.dir}/WEB-INF/classes/META-INF/jboss-beans.xml"
  |                             
file="${basedir}/resources/META-INF/jboss-beans.xml"
  |                     overwrite="true" />
  |             
  |             <copy tofile="${tomcat.dir}/WEB-INF/classes/import.sql" 
  |                         file="${basedir}/resources/import-${profile}.sql"
  |                overwrite="true"/>
  | 
  |             <copy todir="${tomcat.dir}">
  |                     <fileset dir="${basedir}/view" />
  |             </copy>
  |             
  |             <copy todir="${tomcat.dir}/WEB-INF">
  |                     <fileset dir="${basedir}/resources/WEB-INF">
  |                             <include name="*.*"/>
  |                             <include name="classes/**/*.*"/>
  |                             <exclude name="jboss-web.xml" />
  |                             <exclude name="classes/**/*.class"/>
  |                     </fileset>
  |                     <filterset>
  |                             <filter token="jndiPattern" 
value="#{ejbName}/local"/>
  |                 <filter token="embeddedEjb" value="true"/>
  |                 <filter token="microcontainer" value="true"/>
  |                     </filterset>
  |             </copy>
  |             
  |             <copy todir="${tomcat.dir}/WEB-INF">
  |                     <fileset dir="${basedir}/resources/WEB-INF">
  |                             <include name="lib/*.*"/>
  |                             <include name="classes/**/*.class"/>
  |                     </fileset>
  |             </copy>
  |             
  |             <copy todir="${tomcat.dir}/WEB-INF/lib">
  |                     <fileset dir="${lib.dir}">
  |                             <include name="antlr-*.jar"/>
  |                             <include name="ajax4jsf.jar" />
  |                             <include name="commons-*.jar"/>
  |                             <include name="drools-*.jar"/>
  |                             <include name="el-ri.jar" />
  |                             <include name="hibernate*.jar" />
  |                             <include name="janino-*.jar"/>
  |                             <include name="jboss-*.jar" />
  |                             <exclude name="jboss-seam-gen.jar" />
  |                             <include name="jbpm*.jar" />
  |                             <include name="jsf-facelets.jar" />
  |                             <include name="myfaces-*.jar" />
  |                             <include name="mysql*.jar" />
  |                             <include name="oscache*.jar" />
  |                             <include name="standard.jar" />
  |                             <include name="stringtemplate-*.jar"/>
  |                             <include name="thirdparty*.jar" />
  |                     </fileset>
  |             </copy>
  |             
  |             <copy todir="${tomcat.dir}/WEB-INF/classes">
  |                     <fileset dir="${basedir}/resources"> 
  |                             <include name="messages*.properties"/>
  |                     </fileset>
  |             </copy>
  | 
  |             <copy todir="${tomcat.dir}/WEB-INF/classes">
  |                     <fileset dir="${basedir}/resources">
  |                             <include name="*jpdl.xml" />
  |                             <include name="hibernate.cfg.xml" />
  |                             <include name="jbpm.cfg.xml" />
  |                     </fileset>
  |             </copy>
  |             
  |             <jar jarfile="${tomcat.dir}/WEB-INF/lib/mc-conf.jar">
  |             <fileset dir="${embedded-ejb3.dir}"/>
  |         </jar>
  |         
  |         <javac classpathref="build.classpath" 
  |                             destdir="${tomcat.dir}/WEB-INF/classes" 
  |                               debug="${javac.debug}" 
  |                         deprecation="${javac.deprecation}" 
  |                             nowarn="on">
  |                     <src path="${src.java.dir}" />
  |             </javac>
  |     </target>
  | </project>

Now, in the build.xml file, add this line to import the deploy.tomcat target:

<import file="tomcat.xml"/>

The seam wizard leaves out a couple of important files, so underneath the 
'tomtom' directory, create a new folder called 'tomcat-extra-files'.  Add these 
two files from the Seam distribution:
  i) hibernate.cfg.xml
  ii) jbpm.cfg.xml

And finally, in the build.properties file, add a variable for tomcat.home with 
the location of your Tomcat 5.5+ installation.

If you run the deploy.tomcat target, it will deploy an exploded directory in 
Tomcat.  Whenever I start Tomcat, it craps out at the DataSource bit.

Any clue as to how I could fix this?

My apologies for the extra-long post...
-Michael

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026022
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to