-
1. Re: JMX conflict when embedding
jgf1 May 18, 2008 6:34 AM (in response to marcelruff)I have exactly the same issue and experience this when going through the Java Persistence with Hibernate book...
See below:
Similar Errors:
http://forum.hibernate.org/viewtopic.php?p=2374330&sid=93c1571e772bdc0f43403f8d24234195
http://lists.jboss.org/pipermail/jboss-user/2007-April/051335.html
Error logged to console:
Fails on EJB3StandaloneBootstrap.boot(null) in HelloWorld
Oddly it works in your download. Only differences that exist are in folder names. Yours is helloworld-ejb\build. Mine is helloworldEJB\bin.
I've factored this in to later line: EJB3StandaloneBootstrap.scanClasspath("helloworldEJB/bin".replace("/", File.separator));
Am I missing something else? Can zip this up if you want...C:\Book Downloads\Java Persistence with Hibernate\Jeremys Hello Junk\helloworldE JB>ant run Buildfile: build.xml compile: [javac] Compiling 1 source file to C:\Book Downloads\Java Persistence with H ibernate\Jeremys Hello Junk\helloworldEJB\bin copymetafiles: run: [java] cp: C:\Book Downloads\Java Persistence with Hibernate\Jeremys Hello Junk\helloworldEJB\lib\hibernate-all.jar;C:\Book Downloads\Java Persistence with Hibernate\Jeremys Hello Junk\helloworldEJB\lib\jboss-ejb3-all.jar;C:\Book Downl oads\Java Persistence with Hibernate\Jeremys Hello Junk\helloworldEJB\lib\thirdp arty-all.jar;C:\Book Downloads\Java Persistence with Hibernate\Jeremys Hello Jun k\helloworldEJB\bin [java] JGF1 null [java] 11:15:30,468 ERROR AbstractKernelController:440 - Error installing t o Start: name=UserTransaction state=Create [java] java.lang.RuntimeException: Unable to lookup TransactionManager [java] at org.jboss.ejb3.tx.TxUtil.getTransactionManager(TxUtil.java:51 ) [java] at org.jboss.ejb3.embedded.UserTransactionImpl.start(UserTransac tionImpl.java:62) [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces sorImpl.java:39) [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet hodAccessorImpl.java:25) [java] at java.lang.reflect.Method.invoke(Method.java:597) [java] at org.jboss.reflect.plugins.introspection.ReflectionUtils.invok e(ReflectionUtils.java:55) [java] at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl .invoke(ReflectMethodInfoImpl.java:107) [java] at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(Bas icMethodJoinPoint.java:66) [java] at org.jboss.kernel.plugins.dependency.KernelControllerContextAc tion.dispatchJoinPoint(KernelControllerContextAction.java:75) [java] at org.jboss.kernel.plugins.dependency.LifecycleAction.installAc tion(LifecycleAction.java:115) [java] at org.jboss.kernel.plugins.dependency.KernelControllerContextAc tion.install(KernelControllerContextAction.java:100) [java] at org.jboss.dependency.plugins.AbstractControllerContextActions .install(AbstractControllerContextActions.java:51) [java] at org.jboss.dependency.plugins.AbstractControllerContext.instal l(AbstractControllerContext.java:226) [java] at org.jboss.dependency.plugins.AbstractController.install(Abstr actController.java:709) [java] at org.jboss.dependency.plugins.AbstractController.incrementStat e(AbstractController.java:429) [java] at org.jboss.dependency.plugins.AbstractController.resolveContex ts(AbstractController.java:538) [java] at org.jboss.dependency.plugins.AbstractController.resolveContex ts(AbstractController.java:472) [java] at org.jboss.dependency.plugins.AbstractController.install(Abstr actController.java:274) [java] at org.jboss.dependency.plugins.AbstractController.install(Abstr actController.java:177) [java] at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.de ployBean(AbstractKernelDeployer.java:291) [java] at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.de ployBeans(AbstractKernelDeployer.java:261) [java] at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.de ploy(AbstractKernelDeployer.java:117) [java] at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.deplo y(BeanXMLDeployer.java:95) [java] at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3Stan daloneBootstrap.java:373) [java] at hello.HelloWorld.main(Unknown Source) [java] Caused by: javax.naming.NoInitialContextException: Cannot instantiat e class: org.jnp.interfaces.LocalOnlyContextFactory [Root exception is java.lan g.ClassNotFoundException: org.jnp.interfaces.LocalOnlyContextFactory ] [java] at javax.naming.spi.NamingManager.getInitialContext(NamingManage r.java:657) [java] at javax.naming.InitialContext.getDefaultInitCtx(InitialContext. java:288) [java] at javax.naming.InitialContext.init(InitialContext.java:223) [java] at javax.naming.InitialContext.<init>(InitialContext.java:175) [java] at org.jboss.ejb3.tx.TxUtil.getTransactionManager(TxUtil.java:45 ) [java] ... 25 more [java] Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.Loca lOnlyContextFactory [java] at java.net.URLClassLoader$1.run(URLClassLoader.java:200) [java] at java.security.AccessController.doPrivileged(Native Method) [java] at java.net.URLClassLoader.findClass(URLClassLoader.java:188) [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:306) [java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) [java] Exception in thread "main" java.lang.RuntimeException: java.lang.Ill egalStateException: Incompletely deployed: [java] [java] *** DEPLOYMENTS IN ERROR: Name -> Error [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:251) [java] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) [java] at java.lang.Class.forName0(Native Method) [java] at java.lang.Class.forName(Class.java:247) [java] at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelp er12.java:46) [java] UserTransaction -> java.lang.RuntimeException: Unable to lookup Tran sactionManager [java] [java] at javax.naming.spi.NamingManager.getInitialContext(NamingManage r.java:654) [java] ... 29 more [java] *** DEPLOYMENTS MISSING DEPENDENCIES: Name -> Dependency{Required St ate:Actual State} [java] UserTransactionBinding -> UserTransaction{Configured:**ERROR**}, Ini tialContextProperties{Configured:Installed} [java] [java] at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3Stan daloneBootstrap.java:386) [java] at hello.HelloWorld.main(Unknown Source) [java] Caused by: java.lang.IllegalStateException: Incompletely deployed: [java] [java] *** DEPLOYMENTS IN ERROR: Name -> Error [java] UserTransaction -> java.lang.RuntimeException: Unable to lookup Tran sactionManager [java] [java] *** DEPLOYMENTS MISSING DEPENDENCIES: Name -> Dependency{Required St ate:Actual State} [java] UserTransactionBinding -> UserTransaction{Configured:**ERROR**}, Ini tialContextProperties{Configured:Installed} [java] [java] at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.in ternalValidate(AbstractKernelDeployer.java:241) [java] at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.va lidate(AbstractKernelDeployer.java:161) [java] at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3Stan daloneBootstrap.java:374) [java] ... 1 more [java] Java Result: 1 BUILD SUCCESSFUL Total time: 2 seconds C:\Book Downloads\Java Persistence with Hibernate\Jeremys Hello Junk\helloworldE JB>
WORKDIR = helloworldEJB
build.xml<project name="Hello World with EJB3" default="compile" basedir="."> <!-- Name of project and version --> <property name="proj.name" value="Hello World with EJB3"/> <property name="proj.shortname" value="helloworld-ejb3"/> <property name="version" value="1.0"/> <!-- Global properties for this build --> <property name="database.dir" value="database"/> <property name="src.java.dir" value="src"/> <property name="src.etc.dir" value="etc"/> <property name="lib.dir" value="lib"/> <property name="build.dir" value="bin"/> <!-- Classpath declaration --> <path id="project.classpath"> <fileset dir="${lib.dir}"> <include name="**/*.jar"/> <include name="**/*.zip"/> </fileset> </path> <!-- Useful shortcuts --> <patternset id="meta.files"> <include name="**/*.xml"/> <include name="**/*.properties"/> </patternset> <!-- Clean up --> <target name="clean" description="Clean the build directory"> <delete dir="${build.dir}"/> </target> <!-- Compile Java source --> <target name="compile"> <mkdir dir="${build.dir}"/> <javac srcdir="${src.java.dir}" destdir="${build.dir}" classpathref="project.classpath"/> </target> <!-- Copy metadata to build classpath --> <target name="copymetafiles"> <mkdir dir="${build.dir}"/> <copy todir="${build.dir}"> <fileset dir="${src.java.dir}"> <patternset refid="meta.files"/> </fileset> </copy> <copy todir="${build.dir}"> <fileset dir="${src.etc.dir}"> <patternset refid="meta.files"/> </fileset> </copy> </target> <!-- Run HelloWorld --> <target name="run" depends="compile, copymetafiles" description="Build and run HelloWorld"> <java fork="true" classname="hello.HelloWorld" classpathref="project.classpath"> <classpath path="${build.dir}"/> </java> </target> <!-- Start the HSQL DB server --> <target name="startdb" description="Run HSQL database server with clean DB"> <!-- Delete database files --> <delete dir="${database.dir}"/> <java classname="org.hsqldb.Server" fork="yes" classpathref="project.classpath" failonerror="true"> <arg value="-database.0"/> <arg value="file:${database.dir}/db"/> </java> </target> <!-- Start the HSQL DB browser tool --> <target name="dbmanager" description="Start HSQL DB manager"> <java classname="org.hsqldb.util.DatabaseManagerSwing" fork="yes" classpathref="project.classpath" failonerror="true"> <arg value="-url"/> <arg value="jdbc:hsqldb:hsql://localhost/"/> <arg value="-driver"/> <arg value="org.hsqldb.jdbcDriver"/> </java> </target> </project>
etc
default.persistence.propertieshibernate.transaction.manager_lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider
ejb3-interceptors-aop.xml<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE aop PUBLIC "-//JBoss//DTD JBOSS AOP 1.0//EN" "http://www.jboss.org/aop/dtd/jboss-aop_1_0.dtd"> <aop> <interceptor class="org.jboss.aspects.remoting.InvokeRemoteInterceptor" scope="PER_VM"/> <interceptor class="org.jboss.aspects.security.SecurityClientInterceptor" scope="PER_VM"/> <interceptor class="org.jboss.aspects.tx.ClientTxPropagationInterceptor" scope="PER_VM"/> <interceptor class="org.jboss.ejb3.remoting.IsLocalInterceptor" scope="PER_VM"/> <interceptor class="org.jboss.aspects.remoting.ClusterChooserInterceptor" scope="PER_VM"/> <interceptor class="org.jboss.aspects.tx.TxPropagationInterceptor" scope="PER_VM"/> <stack name="ServiceClientInterceptors"> <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/> <interceptor-ref name="org.jboss.aspects.security.SecurityClientInterceptor"/> <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/> <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/> </stack> <stack name="AsynchronousStatelessSessionClientInterceptors"> <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/> <interceptor-ref name="org.jboss.aspects.security.SecurityClientInterceptor"/> <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/> <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/> </stack> <stack name="AsynchronousStatefulSessionClientInterceptors"> <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/> <interceptor-ref name="org.jboss.aspects.security.SecurityClientInterceptor"/> <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/> <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/> </stack> <stack name="StatelessSessionClientInterceptors"> <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/> <interceptor-ref name="org.jboss.aspects.security.SecurityClientInterceptor"/> <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/> <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/> </stack> <stack name="StatefulSessionClientInterceptors"> <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/> <interceptor-ref name="org.jboss.aspects.security.SecurityClientInterceptor"/> <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/> <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/> </stack> <stack name="ClusteredStatelessSessionClientInterceptors"> <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/> <interceptor-ref name="org.jboss.aspects.security.SecurityClientInterceptor"/> <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/> <interceptor-ref name="org.jboss.aspects.remoting.ClusterChooserInterceptor"/> <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/> </stack> <stack name="ClusteredStatefulSessionClientInterceptors"> <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/> <interceptor-ref name="org.jboss.aspects.security.SecurityClientInterceptor"/> <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/> <interceptor-ref name="org.jboss.aspects.remoting.ClusterChooserInterceptor"/> <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/> </stack> <interceptor class="org.jboss.ejb3.asynchronous.AsynchronousInterceptor" scope="PER_CLASS"/> <interceptor class="org.jboss.ejb3.ENCPropagationInterceptor" scope="PER_VM"/> <interceptor name="Basic Authorization" factory="org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorFactory" scope="PER_CLASS"/> <interceptor name="JACC Authorization" factory="org.jboss.ejb3.security.JaccAuthorizationInterceptorFactory" scope="PER_CLASS"/> <interceptor factory="org.jboss.ejb3.security.AuthenticationInterceptorFactory" scope="PER_CLASS"/> <interceptor factory="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory" scope="PER_CLASS"/> <interceptor class="org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor" scope="PER_VM"/> <interceptor class="org.jboss.ejb3.stateless.StatelessInstanceInterceptor" scope="PER_VM"/> <interceptor class="org.jboss.ejb3.stateful.StatefulInstanceInterceptor" scope="PER_VM"/> <interceptor class="org.jboss.ejb3.stateful.SessionSynchronizationInterceptor" scope="PER_VM"/> <interceptor class="org.jboss.ejb3.service.ServiceSingletonInterceptor" scope="PER_VM"/> <interceptor class="org.jboss.ejb3.cache.StatefulReplicationInterceptor" scope="PER_VM"/> <interceptor factory="org.jboss.ejb3.stateful.StatefulRemoveFactory" scope="PER_CLASS_JOINPOINT"/> <interceptor factory="org.jboss.ejb3.tx.TxInterceptorFactory" scope="PER_CLASS_JOINPOINT"/> <interceptor factory="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory" scope="PER_CLASS_JOINPOINT"/> <interceptor factory="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory" scope="PER_CLASS"/> <interceptor class="org.jboss.ejb3.AllowedOperationsInterceptor" scope="PER_VM"/> <interceptor factory="org.jboss.ejb3.mdb.CurrentMessageInjectorInterceptorFactory" scope="PER_CLASS"/> <interceptor class="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor" scope="PER_VM"/> <domain name="Stateless Bean"> <bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/> <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/> <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/> </bind> <bind pointcut="execution(public * @org.jboss.annotation.security.SecurityDomain->*(..))"> <interceptor-ref name="Basic Authorization"/> </bind> <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))"> <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/> </bind> <bind pointcut="execution(public * @org.jboss.annotation.ejb.Clustered->*(..))"> <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory"/> </bind> <bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/> <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/> <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/> <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/> <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/> <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/> </bind> <annotation expr="!class(@org.jboss.annotation.ejb.PoolClass)"> @org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.ThreadlocalPool.class, maxSize=30, timeout=10000) </annotation> </domain> <domain name="JACC Stateless Bean"> <bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/> <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/> <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/> </bind> <bind pointcut="execution(public * @org.jboss.annotation.security.SecurityDomain->*(..))"> <interceptor-ref name="JACC Authorization"/> </bind> <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))"> <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/> </bind> <bind pointcut="execution(public * @org.jboss.annotation.ejb.Clustered->*(..))"> <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory"/> </bind> <bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/> <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/> <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/> <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/> <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/> <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/> </bind> <annotation expr="!class(@org.jboss.annotation.ejb.PoolClass)"> @org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.ThreadlocalPool.class, maxSize=30, timeout=10000) </annotation> </domain> <domain name="Base Stateful Bean"> <bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/> <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/> <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/> </bind> <bind pointcut="execution(public * @org.jboss.annotation.security.SecurityDomain->*(..))"> <interceptor-ref name="Basic Authorization"/> </bind> <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))"> <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/> </bind> <bind pointcut="execution(public * @org.jboss.annotation.ejb.Clustered->*(..))"> <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory"/> </bind> <bind pointcut="execution(public * *->@javax.ejb.Remove(..))"> <interceptor-ref name="org.jboss.ejb3.stateful.StatefulRemoveFactory"/> </bind> <bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.ejb3.stateful.StatefulInstanceInterceptor"/> <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/> <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/> <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/> </bind> <bind pointcut="execution(public * $instanceof{javax.ejb.SessionSynchronization}->*(..))"> <interceptor-ref name="org.jboss.ejb3.stateful.SessionSynchronizationInterceptor"/> </bind> <bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/> <interceptor-ref name="org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor"/> <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/> </bind> <bind pointcut="execution(public * @org.jboss.annotation.ejb.Clustered->*(..)) AND !execution(public * *->@javax.ejb.Remove(..))"> <interceptor-ref name="org.jboss.ejb3.cache.StatefulReplicationInterceptor"/> </bind> <annotation expr="!class(@org.jboss.annotation.ejb.PoolClass)"> @org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.ThreadlocalPool.class, maxSize=30, timeout=10000) </annotation> </domain> <domain name="Stateful Bean" extends="Base Stateful Bean" inheritBindings="true"> <!-- NON Clustered cache configuration --> <annotation expr="!class(@org.jboss.annotation.ejb.cache.Cache) AND !class(@org.jboss.annotation.ejb.Clustered)"> @org.jboss.annotation.ejb.cache.Cache (org.jboss.ejb3.cache.simple.SimpleStatefulCache.class) </annotation> <annotation expr="!class(@org.jboss.annotation.ejb.cache.simple.PersistenceManager) AND !class(@org.jboss.annotation.ejb.Clustered)"> @org.jboss.annotation.ejb.cache.simple.PersistenceManager (org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManager.class) </annotation> <annotation expr="!class(@org.jboss.annotation.ejb.cache.simple.CacheConfig) AND !class(@org.jboss.annotation.ejb.Clustered)"> @org.jboss.annotation.ejb.cache.simple.CacheConfig (maxSize=100000, idleTimeoutSeconds=300) </annotation> <!-- Clustered cache configuration --> <annotation expr="!class(@org.jboss.annotation.ejb.cache.Cache) AND class(@org.jboss.annotation.ejb.Clustered)"> @org.jboss.annotation.ejb.cache.Cache (org.jboss.ejb3.cache.tree.StatefulTreeCache.class) </annotation> <annotation expr="!class(@org.jboss.annotation.ejb.cache.tree.CacheConfig) AND class(@org.jboss.annotation.ejb.Clustered)"> @org.jboss.annotation.ejb.cache.tree.CacheConfig (name="jboss.cache:service=EJB3SFSBClusteredCache", maxSize=100000, idleTimeoutSeconds=300) </annotation> </domain> <domain name="JACC Stateful Bean"> <bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/> <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/> <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/> </bind> <bind pointcut="execution(public * @org.jboss.annotation.security.SecurityDomain->*(..))"> <interceptor-ref name="JACC Authorization"/> </bind> <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))"> <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/> </bind> <bind pointcut="execution(public * @org.jboss.annotation.ejb.Clustered->*(..))"> <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory"/> </bind> <bind pointcut="execution(public * *->@javax.ejb.Remove(..))"> <interceptor-ref name="org.jboss.ejb3.stateful.StatefulRemoveFactory"/> </bind> <bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.ejb3.stateful.StatefulInstanceInterceptor"/> <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/> <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/> <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/> </bind> <bind pointcut="execution(public * $instanceof{javax.ejb.SessionSynchronization}->*(..))"> <interceptor-ref name="org.jboss.ejb3.stateful.SessionSynchronizationInterceptor"/> </bind> <bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/> <interceptor-ref name="org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor"/> <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/> </bind> <bind pointcut="execution(public * @org.jboss.annotation.ejb.Clustered->*(..)) AND !execution(public * *->@javax.ejb.Remove(..))"> <interceptor-ref name="org.jboss.ejb3.cache.StatefulReplicationInterceptor"/> </bind> <annotation expr="!class(@org.jboss.annotation.ejb.PoolClass)"> @org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.ThreadlocalPool.class, maxSize=30, timeout=10000) </annotation> <!-- NON Clustered cache configuration --> <annotation expr="!class(@org.jboss.annotation.ejb.cache.Cache) AND !class(@org.jboss.annotation.ejb.Clustered)"> @org.jboss.annotation.ejb.cache.Cache (org.jboss.ejb3.cache.simple.SimpleStatefulCache.class) </annotation> <annotation expr="!class(@org.jboss.annotation.ejb.cache.simple.PersistenceManager) AND !class(@org.jboss.annotation.ejb.Clustered)"> @org.jboss.annotation.ejb.cache.simple.PersistenceManager (org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManager.class) </annotation> <annotation expr="!class(@org.jboss.annotation.ejb.cache.simple.CacheConfig) AND !class(@org.jboss.annotation.ejb.Clustered)"> @org.jboss.annotation.ejb.cache.simple.CacheConfig (maxSize=100000, idleTimeoutSeconds=300) </annotation> <!-- Clustered cache configuration --> <annotation expr="!class(@org.jboss.annotation.ejb.cache.Cache) AND class(@org.jboss.annotation.ejb.Clustered)"> @org.jboss.annotation.ejb.cache.Cache (org.jboss.ejb3.cache.tree.StatefulTreeCache.class) </annotation> <annotation expr="!class(@org.jboss.annotation.ejb.cache.tree.CacheConfig) AND class(@org.jboss.annotation.ejb.Clustered)"> @org.jboss.annotation.ejb.cache.tree.CacheConfig (name="jboss.cache:service=EJB3SFSBClusteredCache", maxSize=100000, idleTimeoutSeconds=300) </annotation> </domain> <domain name="Embedded Stateful Bean" extends="Base Stateful Bean" inheritBindings="true"> <!-- NON Clustered cache configuration --> <annotation expr="!class(@org.jboss.annotation.ejb.cache.Cache)"> @org.jboss.annotation.ejb.cache.Cache (org.jboss.ejb3.cache.NoPassivationCache.class) </annotation> </domain> <domain name="Message Driven Bean"> <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))"> <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/> </bind> <bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/> <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/> <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/> <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/> <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/> </bind> <annotation expr="!class(@org.jboss.annotation.ejb.PoolClass)"> @org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.StrictMaxPool.class, maxSize=30, timeout=10000) </annotation> </domain> <domain name="Consumer Bean"> <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))"> <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/> </bind> <bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/> <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/> <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/> <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/> </bind> <bind pointcut="execution(public * *->*(..)) AND (has(* *->@org.jboss.annotation.ejb.CurrentMessage(..)) OR hasfield(* *->@org.jboss.annotation.ejb.CurrentMessage))"> <interceptor-ref name="org.jboss.ejb3.mdb.CurrentMessageInjectorInterceptorFactory"/> </bind> <bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/> </bind> <annotation expr="!class(@org.jboss.annotation.ejb.PoolClass)"> @org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.StrictMaxPool.class, maxSize=30, timeout=10000) </annotation> </domain> <domain name="Service Bean"> <bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/> <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/> </bind> <bind pointcut="!execution(* *->create()) AND !execution(* *->start()) AND !execution(*->new(..))"> <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/> </bind> <bind pointcut="execution(public * @org.jboss.annotation.security.SecurityDomain->*(..))"> <interceptor-ref name="Basic Authorization"/> </bind> <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))"> <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/> </bind> <bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/> <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/> <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/> <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/> </bind> <bind pointcut="execution(public * *->*(..)) AND !execution(* *->create()) AND !execution(* *->start())"> <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/> </bind> </domain> <domain name="JACC Service Bean"> <bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/> <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/> </bind> <bind pointcut="!execution(* *->create()) AND !execution(* *->start()) AND !execution(*->new(..))"> <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/> </bind> <bind pointcut="execution(public * @org.jboss.annotation.security.SecurityDomain->*(..))"> <interceptor-ref name="Basic Authorization"/> </bind> <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))"> <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/> </bind> <bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/> <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/> <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/> <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/> </bind> <bind pointcut="execution(public * *->*(..)) AND !execution(* *->create()) AND !execution(* *->start())"> <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/> </bind> </domain> </aop>
embedded-jboss-beans.xml<?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:2.0"> <bean name="Naming" class="org.jnp.server.SingletonNamingServer"/> <bean name="InitialContextProperties" class="java.util.Hashtable"> <constructor> <parameter class="java.util.Map"> <map keyClass="java.lang.String" valueClass="java.lang.String"> <entry> <key>java.naming.factory.initial</key> <value>org.jnp.interfaces.LocalOnlyContextFactory</value> </entry> <entry> <key>java.naming.factory.url.pkgs</key> <value>org.jboss.naming:org.jnp.interfaces</value> </entry> </map> </parameter> </constructor> </bean> <bean name="java:comp/Initializer" class="org.jboss.ejb3.embedded.JavaCompInitializer"> <property name="jndiProperties"><inject bean="InitialContextProperties"/></property> </bean> <bean name="XidFactory" class="org.jboss.tm.XidFactoryImpl"/> <bean name="XidFactoryMBean" class="org.jboss.ejb3.embedded.XidFactoryMBean"> <constructor> <parameter class="org.jboss.tm.XidFactoryBase"> <inject bean="XidFactory"/> </parameter> </constructor> </bean> <bean name="TransactionManagerInitializer" class="org.jboss.tm.TransactionManagerInitializer"> <property name="xidFactory"><inject bean="XidFactory"/></property> <property name="initialContextProperties"><inject bean="InitialContextProperties"/></property> </bean> <bean name="UserTransaction" class="org.jboss.ejb3.embedded.UserTransactionImpl"> <demand>TransactionManagerInitializer</demand> </bean> <bean name="UserTransactionBinding" class="org.jboss.ejb3.embedded.JndiBinder"> <property name="jndiProperties"><inject bean="InitialContextProperties"/></property> <property name="target"><inject bean="UserTransaction"/></property> <property name="bindTo">UserTransaction</property> <property name="serializable">false</property> </bean> <bean name="TransactionManager" class="java.lang.Object"> <constructor factoryMethod="getTransactionManager"> <factory bean="TransactionManagerInitializer"/> </constructor> </bean> <bean name="CachedConnectionManager" class="org.jboss.resource.connectionmanager.CachedConnectionManagerReference"> <property name="transactionManager"><inject bean="TransactionManager"/></property> </bean> <!-- <bean class="org.jboss.jdbc.HypersonicDatabase" name="jboss:service=Hypersonic,database=localDB"> <property name="database">localDB</property> <property name="inProcessMode">true</property> <property name="dbDataDir">.</property> </bean> --> <!-- Not needed without JMS <bean name="DefaultDSBootstrap" class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource"> <property name="driverClass">org.hsqldb.jdbcDriver</property> <property name="connectionURL">jdbc:hsqldb:.</property> <property name="userName">sa</property> <property name="jndiName">java:/DefaultDS</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="DefaultDS" class="java.lang.Object"> <constructor factoryMethod="getDatasource"> <factory bean="DefaultDSBootstrap"/> </constructor> </bean> --> <!-- <bean name="TimerServiceFactory" class="org.jboss.ejb3.timerservice.quartz.QuartzTimerServiceFactory"> <property name="properties"> org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreCMT org.quartz.jobStore.nonManagedTXDataSource=myDS org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.HSQLDBDelegate org.quartz.jobStore.tablePrefix=QRTZ_ org.quartz.jobStore.dataSource=myDS # To get it to work with hypersonic # FIXME: this doesn't lock the row org.quartz.jobStore.selectWithLockSQL=SELECT * FROM qrtz_locks WHERE lock_name = ? # from quartz.properties org.quartz.scheduler.instanceName=JBossEJB3QuartzScheduler org.quartz.scheduler.rmi.export=false org.quartz.scheduler.rmi.proxy=false org.quartz.scheduler.wrapJobExecutionInUserTransaction=false org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool org.quartz.threadPool.threadCount=10 org.quartz.threadPool.threadPriority=5 org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true org.quartz.jobStore.misfireThreshold=60000 </property> <property name="dataSource">java:/DefaultDS</property> <property name="sqlProperties"> CREATE_DB_ON_STARTUP = TRUE CREATE_TABLE_JOB_DETAILS = CREATE TABLE qrtz_job_details(JOB_NAME VARCHAR(80) NOT NULL, JOB_GROUP VARCHAR(80) NOT NULL, \ DESCRIPTION VARCHAR(120) NULL, JOB_CLASS_NAME VARCHAR(128) NOT NULL, IS_DURABLE VARCHAR(1) NOT NULL, \ IS_VOLATILE VARCHAR(1) NOT NULL, IS_STATEFUL VARCHAR(1) NOT NULL, REQUESTS_RECOVERY VARCHAR(1) NOT NULL, \ JOB_DATA BINARY NULL, PRIMARY KEY (JOB_NAME,JOB_GROUP)) CREATE_TABLE_JOB_LISTENERS = CREATE TABLE qrtz_job_listeners(JOB_NAME VARCHAR(80) NOT NULL, JOB_GROUP VARCHAR(80) NOT NULL, \ JOB_LISTENER VARCHAR(80) NOT NULL, PRIMARY KEY (JOB_NAME,JOB_GROUP,JOB_LISTENER), FOREIGN KEY (JOB_NAME,JOB_GROUP) \ REFERENCES QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)) CREATE_TABLE_TRIGGERS = CREATE TABLE qrtz_triggers(TRIGGER_NAME VARCHAR(80) NOT NULL, TRIGGER_GROUP VARCHAR(80) NOT NULL, \ JOB_NAME VARCHAR(80) NOT NULL, JOB_GROUP VARCHAR(80) NOT NULL, IS_VOLATILE VARCHAR(1) NOT NULL, DESCRIPTION VARCHAR(120) NULL, \ NEXT_FIRE_TIME NUMERIC(13) NULL, PREV_FIRE_TIME NUMERIC(13) NULL, TRIGGER_STATE VARCHAR(16) NOT NULL, \ TRIGGER_TYPE VARCHAR(8) NOT NULL, START_TIME NUMERIC(13) NOT NULL, END_TIME NUMERIC(13) NULL, CALENDAR_NAME VARCHAR(80) NULL, \ MISFIRE_INSTR NUMERIC(2) NULL, JOB_DATA BINARY NULL, PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), FOREIGN KEY (JOB_NAME,JOB_GROUP) \ REFERENCES QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)) CREATE_TABLE_SIMPLE_TRIGGERS = CREATE TABLE qrtz_simple_triggers(TRIGGER_NAME VARCHAR(80) NOT NULL, \ TRIGGER_GROUP VARCHAR(80) NOT NULL, REPEAT_COUNT NUMERIC(7) NOT NULL, REPEAT_INTERVAL NUMERIC(12) NOT NULL, \ TIMES_TRIGGERED NUMERIC(7) NOT NULL, PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) \ REFERENCES QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)) CREATE_TABLE_CRON_TRIGGERS = CREATE TABLE qrtz_cron_triggers(TRIGGER_NAME VARCHAR(80) NOT NULL, \ TRIGGER_GROUP VARCHAR(80) NOT NULL, CRON_EXPRESSION VARCHAR(80) NOT NULL, TIME_ZONE_ID VARCHAR(80), \ PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) \ REFERENCES QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)) CREATE_TABLE_BLOB_TRIGGERS = CREATE TABLE qrtz_blob_triggers(TRIGGER_NAME VARCHAR(80) NOT NULL, \ TRIGGER_GROUP VARCHAR(80) NOT NULL, BLOB_DATA BINARY NULL, PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP), \ FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) REFERENCES QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)) CREATE_TABLE_TRIGGER_LISTENERS = CREATE TABLE qrtz_trigger_listeners(TRIGGER_NAME VARCHAR(80) NOT NULL, \ TRIGGER_GROUP VARCHAR(80) NOT NULL, TRIGGER_LISTENER VARCHAR(80) NOT NULL, \ PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_LISTENER), FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP) \ REFERENCES QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)) CREATE_TABLE_CALENDARS = CREATE TABLE qrtz_calendars(CALENDAR_NAME VARCHAR(80) NOT NULL, CALENDAR BINARY NOT NULL, \ PRIMARY KEY (CALENDAR_NAME)) CREATE_TABLE_PAUSED_TRIGGER_GRPS = CREATE TABLE qrtz_paused_trigger_grps(TRIGGER_GROUP VARCHAR(80) NOT NULL, \ PRIMARY KEY (TRIGGER_GROUP)) CREATE_TABLE_FIRED_TRIGGERS = CREATE TABLE qrtz_fired_triggers(ENTRY_ID VARCHAR(95) NOT NULL, TRIGGER_NAME VARCHAR(80) NOT NULL, \ TRIGGER_GROUP VARCHAR(80) NOT NULL, IS_VOLATILE VARCHAR(1) NOT NULL, INSTANCE_NAME VARCHAR(80) NOT NULL, \ FIRED_TIME NUMERIC(13) NOT NULL, STATE VARCHAR(16) NOT NULL, JOB_NAME VARCHAR(80) NULL, JOB_GROUP VARCHAR(80) NULL, \ IS_STATEFUL VARCHAR(1) NULL, REQUESTS_RECOVERY VARCHAR(1) NULL, PRIMARY KEY (ENTRY_ID)) CREATE_TABLE_SCHEDULER_STATE = CREATE TABLE qrtz_scheduler_state(INSTANCE_NAME VARCHAR(80) NOT NULL, \ LAST_CHECKIN_TIME NUMERIC(13) NOT NULL, CHECKIN_INTERVAL NUMERIC(13) NOT NULL, RECOVERER VARCHAR(80) NULL, \ PRIMARY KEY (INSTANCE_NAME)) CREATE_TABLE_LOCKS = CREATE TABLE qrtz_locks(LOCK_NAME VARCHAR(40) NOT NULL, PRIMARY KEY (LOCK_NAME)) INSERT_TRIGGER_ACCESS = INSERT INTO qrtz_locks values('TRIGGER_ACCESS') INSERT_JOB_ACCESS = INSERT INTO qrtz_locks values('JOB_ACCESS') INSERT_CALENDAR_ACCESS = INSERT INTO qrtz_locks values('CALENDAR_ACCESS') INSERT_STATE_ACCESS = INSERT INTO qrtz_locks values('STATE_ACCESS') INSERT_MISFIRE_ACCESS = INSERT INTO qrtz_locks values('MISFIRE_ACCESS') </property> </bean> --> </deployment>
jndi.propertiesjava.naming.factory.initial org.jnp.interfaces.LocalOnlyContextFactory java.naming.factory.url.pkgs org.jboss.naming:org.jnp.interfaces
log4j.properties# Direct log messages to stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n # Root logger option log4j.rootLogger=INFO, stdout # Hibernate logging options (INFO only shows startup messages) #log4j.logger.org.hibernate=DEBUG # Log JDBC bind parameter runtime arguments #log4j.logger.org.hibernate.type=DEBUG # JBoss EJB 3.0 container logging #log4j.logger.org.jboss=DEBUG # Disable warnings of noisy classes log4j.logger.org.jboss.ejb3.timerservice.jboss.JBossTimerServiceFactory=ERROR log4j.logger.org.hibernate.ejb.Ejb3Configuration=ERROR
etc/META-INF
helloworld-beans.xml<?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:2.0"> <!-- Enable a JCA datasource available through JNDI --> <bean name="helloWorldDatasourceFactory" class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource"> <property name="jndiName">java:/HelloWorldDS</property> <!-- HSQLDB --> <property name="driverClass">org.hsqldb.jdbcDriver</property> <property name="connectionURL">jdbc:hsqldb:hsql://localhost</property> <property name="userName">sa</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="HelloWorldDS" class="java.lang.Object"> <constructor factoryMethod="getDatasource"> <factory bean="helloWorldDatasourceFactory"/> </constructor> </bean> </deployment>
persistence.xml<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="helloworld"> <jta-data-source>java:/HelloWorldDS</jta-data-source> <properties> <property name="hibernate.archive.autodetection" value="class, hbm"/> <!-- SQL stdout logging --> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> <property name="use_sql_comments" value="true"/> <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/> <property name="hibernate.hbm2ddl.auto" value="create"/> </properties> </persistence-unit> </persistence>
lib
hibernate-all.jar
jboss-ejb3-all.jar
thirdparty-all.jar
src/hello
HelloWorld.javapackage hello; import org.jboss.ejb3.embedded.EJB3StandaloneBootstrap; import javax.naming.InitialContext; import java.io.File; public class HelloWorld { public static void main(String[] args) throws Exception { // Boot the JBoss Microcontainer with EJB3 settings, automatically // loads ejb3-interceptors-aop.xml and embedded-jboss-beans.xml System.out.println("cp: " + System.getProperty("java.class.path")); System.out.println("JGF1 null"); EJB3StandaloneBootstrap.boot(null); // Deploy custom stateless beans (datasource, mostly) System.out.println("JGF1 META-INF"); EJB3StandaloneBootstrap.deployXmlResource("META-INF/helloworld-beans.xml"); // Deploy all EJBs found on classpath (slow, scans all) // EJB3StandaloneBootstrap.scanClasspath(); // Deploy all EJBs found on classpath (fast, scans build directory) // This is a relative location, matching the substring end of one // of java.class.path locations. Print out the value of // System.getProperty("java.class.path") to see all paths. EJB3StandaloneBootstrap.scanClasspath("helloworldEJB/bin".replace("/", File.separator)); // Create InitialContext from jndi.properties InitialContext initialContext = new InitialContext(); // Look up the stateless MessageHandler EJB MessageHandler msgHandler = (MessageHandler) initialContext.lookup("MessageHandlerBean/local"); // Call the stateless EJB msgHandler.saveMessages(); msgHandler.showMessages(); // Shutdown EJB container EJB3StandaloneBootstrap.shutdown(); } }
Message.javapackage hello; import javax.persistence.*; @Entity @Table(name = "MESSAGES") public class Message { @Id @GeneratedValue @Column(name = "MESSSAGE_ID") private Long id; @Column(name = "MESSAGE_TEXT") private String text; @ManyToOne(cascade = CascadeType.ALL) @JoinColumn(name = "NEXT_MESSAGE_ID") private Message nextMessage; Message() {} public Message(String text) { this.text = text; } public Long getId() { return id; } private void setId(Long id) { this.id = id; } public String getText() { return text; } public void setText(String text) { this.text = text; } public Message getNextMessage() { return nextMessage; } public void setNextMessage(Message nextMessage) { this.nextMessage = nextMessage; } }
MessageHandler.javapackage hello; public interface MessageHandler { public void saveMessages(); public void showMessages(); }
MessageHandlerBean.javapackage hello; import javax.ejb.Stateless; import javax.persistence.*; import java.util.List; @Stateless public class MessageHandlerBean implements MessageHandler { @PersistenceContext EntityManager em; public void saveMessages() { Message message = new Message("Hello World"); em.persist(message); } public void showMessages() { List messages = em.createQuery("select m from Message m order by m.text asc") .getResultList(); System.out.println(messages.size() + " message(s) found:"); for (Object m : messages) { Message loadedMsg = (Message) m; System.out.println(loadedMsg.getText()); } } }
-
2. ERROR AbstractKernelController:440 - Error installing to Sta
jgf1 May 18, 2008 7:35 AM (in response to marcelruff)Because I had a version that worked that I could use as a baseline, I systematically did a windiff on the two directories.
Windiff said only difference was spaces. I though nothing of it, but
as soon as I swapped jndi.properties over it worked a treat.
I don't know if its to do with CRLF characters. Only there was one less character in the one that got replaced. Maybe folks at JBoss can take a look into this.
What a nightmare to debug!
Got there in the end though.. -
3. Re: ERROR AbstractKernelController:440 - Error installing to
jgf1 May 18, 2008 7:55 AM (in response to marcelruff)Don't know if I made that clear. One less character in replacement actually (your original). Could have been some sort of EOF marker too that Wordpad inserted, when I did copy/paste originally...