Can't deploy, embedded EJB3 container fails to deploy
andrew.rw.robinson Jan 21, 2006 2:53 PMI am attempting to run a new seam project on tomcat with EJB3 enabled (I have managed to get the microcontainer working with noejb before, but am not trying the EJB3 solution).
I was looking at the javax.persistence documentation at the hibernate.org site and their tutorial was showing attribute arguments that did not exist with seam (I am mentioning this, because I'm not sure what I did is supported). So, I downloaded the lastest hibernate and latest hibernate-entity-manager so that I could get the latest javax.persistence functionality (Specifically I wanted the 'access' property: "@Entity(access=AccessType.FIELD)")
I then updated my seam from CVS and built it.
In my project, I built a new ant file using the booking build.xml as a template. In my war task I include the libraries from:
hibernate/hibernate.jar
hibernate/lib/(only those jars that are in seam and the seam embedded ejb3 lib directories)
hibernate-entity-manager/hibernate-entity-manager.jar
hibernate-entity-manager/lib/*.jar
seam/seam.jar
seam/lib/(only those not already included)
seam/embedded-ejb/lib/(only those not already included)
I have used the web.xml from booking, just slightly altered as with the other meta files (jboss-beans.xml for example)
When I start tomcat I get the following exception:
INFO 21-01 12:29:18,963 (Ejb.java:startup:39) -starting the embedded EJB container java.lang.RuntimeException: java.lang.NoSuchMethodError: org.jboss.util.CollectionsFactory.createConcurrentReaderMap()Ljava/util/Map; at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3StandaloneBootstrap.java:277) at org.jboss.seam.core.Ejb.startup(Ejb.java:40) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.seam.util.Reflections.invoke(Reflections.java:13) at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:32) at org.jboss.seam.Component.callComponentMethod(Component.java:1114) at org.jboss.seam.Component.callCreateMethod(Component.java:1102) at org.jboss.seam.Component.newInstance(Component.java:1091) at org.jboss.seam.Component.getInstance(Component.java:1039) at org.jboss.seam.Component.getInstance(Component.java:1022) at org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:88) at org.jboss.seam.contexts.Lifecycle.endInitialization(Lifecycle.java:68) at org.jboss.seam.init.Initialization.init(Initialization.java:91) at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:30) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3669) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4104) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012) at org.apache.catalina.core.StandardHost.start(StandardHost.java:718) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442) at org.apache.catalina.core.StandardService.start(StandardService.java:450) at org.apache.catalina.core.StandardServer.start(StandardServer.java:683) at org.apache.catalina.startup.Catalina.start(Catalina.java:537) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409) Caused by: java.lang.NoSuchMethodError: org.jboss.util.CollectionsFactory.createConcurrentReaderMap()Ljava/util/Map; at org.jboss.kernel.plugins.event.AbstractEventEmitter.<init>(AbstractEventEmitter.java:55) at org.jboss.kernel.plugins.AbstractKernelObject.<init>(AbstractKernelObject.java:57) at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.<init>(AbstractBootstrap.java:53) at org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap.<init>(BasicBootstrap.java:59) at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.createKernel(EJB3StandaloneBootstrap.java:285) at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3StandaloneBootstrap.java:262) ... 31 more ERROR 21-01 12:29:19,001 (StandardContext.java:listenerStart:3673) -Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
Here is the build.properties:
# #Sun Oct 30 20:49:25 MST 2005 name=Test Seam on Tomcat project.name=test-seam src.java.dir=JavaSource src.test.dir=${src.java.dir} resources.dir=Resources version=1.0 build.dir=build classes.dir=${build.dir}/classes build.libs.dir=${build.dir}/lib javac.debug=yes javac.deprecation=yes webinf.dir=WebContent/WEB-INF content.dir=WebContent classpath.external=/home/andrew/eclipseworkspace/.metadata/.plugins/com.exadel.project.templates/lib/servlet/2.4/servlet-api.jar;/home/andrew/eclipseworkspace/.metadata/.plugins/com.exadel.project.templates/lib/servlet/2.4/jsp-api.jar; seam.dir=/usr/local/java-apps/jboss-seam tomcat.home=/usr/local/java-apps/tomcat entity.manager.dir=/usr/local/java-apps/hibernate-entitymanager ejb3.container.dir=${seam.dir}/embedded-ejb hibernate.dir=/usr/local/java-apps/hibernate
Here is the build.xml:
<?xml version="1.0"?> <project name="Test Seam" default="war" basedir=".."> <!-- Naming --> <property file="ant/build.properties"/> <patternset id="meta.files"> <include name="**/*.dtd"/> <include name="**/*.xml"/> <include name="**/*.xslt"/> <include name="**/*.properties"/> <include name="**/*.xsd"/> </patternset> <path id="build.classpath"> <fileset dir="${webinf.dir}/lib" includes="*.jar"/> <fileset dir="${build.libs.dir}" includes="*.jar"/> </path> <!-- targets --> <target name="clean"> <delete dir="${build.dir}"/> </target> <target name="init" description="Initialize the build"> <echo message="Build ${name} ${version}"/> <mkdir dir="${build.dir}"/> <mkdir dir="${classes.dir}"/> <mkdir dir="${build.libs.dir}"/> <!-- copy non-java files to classes directory --> <copy todir="${classes.dir}"> <fileset dir="${src.java.dir}"> <patternset refid="meta.files"/> </fileset> </copy> <!-- setup 3rd party libs --> <copy todir="${build.libs.dir}" flatten="yes"> <fileset dir="${hibernate.dir}" includes="*.jar"/> <fileset dir="${entity.manager.dir}"> <include name="*.jar"/> <include name="lib/*.jar"/> </fileset> <!-- copy the hibernate libs that are needed by the ejb3 container --> <fileset dir="${hibernate.dir}/lib" includes="*.jar"> <present present="both" targetdir="${ejb3.container.dir}/lib"/> </fileset> <!-- copy the hibernate libs that are needed by seam --> <fileset dir="${hibernate.dir}/lib" includes="*.jar"> <present present="both" targetdir="${seam.dir}/lib"/> </fileset> <!-- copy the ejb3 container libs that are not in hibernate --> <fileset dir="${ejb3.container.dir}/lib" includes="*.jar"> <present present="srconly" targetdir="${hibernate.dir}/lib"/> <present present="srconly" targetdir="${hibernate.dir}"/> <present present="srconly" targetdir="${entity.manager.dir}"/> <present present="srconly" targetdir="${entity.manager.dir}/lib"/> </fileset> <!-- copy the seam libraries --> <fileset dir="${seam.dir}" includes="*.jar"/> <fileset dir="${seam.dir}/lib" includes="*.jar"> <present present="srconly" targetdir="${hibernate.dir}/lib"/> <present present="srconly" targetdir="${hibernate.dir}"/> <present present="srconly" targetdir="${entity.manager.dir}"/> <present present="srconly" targetdir="${entity.manager.dir}/lib"/> <present present="srconly" targetdir="${ejb3.container.dir}/lib"/> </fileset> </copy> </target> <target name="compile" depends="init" description="Compile the Java source code"> <javac destdir="${classes.dir}" classpathref="build.classpath" debug="${javac.debug}" deprecation="${javac.deprecation}" nowarn="on"> <src path="${src.java.dir}" /> <src path="${src.test.dir}" /> </javac> </target> <target name="war" depends="compile"> <mkdir dir="${build.dir}/${project.name}/WEB-INF/lib" /> <!-- jar the class files --> <jar jarfile="${build.dir}/${project.name}/WEB-INF/lib/${project.name}.jar"> <fileset dir="${classes.dir}"> <include name="**/*.class" /> <exclude name="**/test/*.class" /> </fileset> <fileset dir="${resources.dir}"> <patternset refid="meta.files"/> </fileset> </jar> <copy todir="${build.dir}/${project.name}/WEB-INF/lib"> <!-- copy 3rd party libraries --> <fileset dir="${build.libs.dir}" includes="*.jar"> <present present="srconly" targetdir="${webinf.dir}/lib"/> </fileset> <!-- copy project lib dir --> <fileset dir="${webinf.dir}/lib" includes="*.jar"/> </copy> <!-- build embedded EJB configuration --> <jar jarfile="${build.dir}/${project.name}/WEB-INF/lib/embedded-ejb-conf.jar"> <fileset dir="${ejb3.container.dir}/conf"> <include name="ejb3-interceptors-aop.xml" /> <include name="embedded-jboss-beans.xml" /> <include name="default.persistence.properties" /> <include name="log4j.xml" /> </fileset> </jar> <copy todir="${build.dir}/${project.name}/WEB-INF"> <fileset dir="${webinf.dir}"> <patternset refid="meta.files"/> </fileset> </copy> <copy todir="${build.dir}/${project.name}"> <fileset dir="${content.dir}"> <include name="**/*"/> <exclude name="META-INF/*"/> <exclude name="WEB-INF/*"/> </fileset> </copy> <jar basedir="${build.dir}/${project.name}" compress="false" destfile="${build.dir}/${project.name}.war" /> </target> <target name="deploy" depends="undeploy,war"> <copy file="${build.dir}/${project.name}.war" todir="${tomcat.home}/webapps" /> <echo>After you start Tomcat, the project will be available at: http://localhost:8080/${project.name}</echo> </target> <!-- <target name="redeploy" depends="deploy"> <reload url="http://localhost:8080/manager" username="admin" password="" path="/${project.name}"/> </target> --> <target name="undeploy"> <delete file="${tomcat.home}/webapps/${project.name}.war" /> <delete dir="${tomcat.home}/webapps/${project.name}" /> </target> </project>