[JBoss Seam] - Tomcat target for your use (almost done - need help with bug
by mlh496
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
19Â years, 1Â month
[JBoss Messaging] - Error with messaging-1.2.0.GA and MS SQL Server 2005
by garyetcc
I am trying to set up SQL server 2005 with messaging 1.2.0 GA, mssql-persistence-service.xml provided in src/etc is used.
Below is the exception when tries to start up:
---------------------------------------------------------------------------------------
16:58:12,824 WARN [ServiceController] Problem starting service jboss.messaging:service=Po
stOffice
com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'CLUSTE
RED'.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown S
ource)
at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.getPrepExecResponse(Unk
nown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatem
ent(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PreparedStatementExecut
ionRequest.executeStatement(Unknown Source)
at com.microsoft.sqlserver.jdbc.CancelableRequest.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeRequest(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(Unknown So
ExceptionSe
looks like it does not like "CLUSTERED" to be used as a column name.
<mbean code="org.jboss.messaging.core.plugin.DefaultPostOfficeService"
name="jboss.messaging:service=PostOffice"
xmbean-dd="xmdesc/DefaultPostOffice-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer
jboss.jca:service=DataSourceBinding,name=DefaultDS
<depends optional-attribute-name="TransactionManager">jboss:service=TransactionManager
JMS
java:/DefaultDS
true
<![CDATA[
CREATE_POSTOFFICE_TABLE=CREATE TABLE JBM_POSTOFFICE (POSTOFFICE_NAME VARCHAR(255), NODE_ID SMALLINT, QUEUE_NAME VARCHAR(1023), COND VARCHAR(1023), SELECTOR VARCHAR(1023), CHANNEL_ID INTEGER, CLUSTERED CHAR(1))
INSERT_BINDING=INSERT INTO JBM_POSTOFFICE (POSTOFFICE_NAME, NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED) VALUES (?, ?, ?, ?, ?, ?, ?)
DELETE_BINDING=DELETE FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME=? AND NODE_ID=? AND QUEUE_NAME=?
LOAD_BINDINGS=SELECT NODE_ID, QUEUE_NAME, COND, SELECTOR, CHANNEL_ID, CLUSTERED FROM JBM_POSTOFFICE WHERE POSTOFFICE_NAME = ?
]]>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026019#4026019
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026019
19Â years, 1Â month