[JBoss Seam] - Pb Initializing database on app startup with postInitializat
by zdaler
I launch a method on application startup using the org.jboss.seam.postInitialization event. It work fine except if I access the database (and I need to) :
using seam managed entity manager :
@In
| private EntityManager em;
|
| @Observer("org.jboss.seam.postInitialization")
| private void setupAFewThings() throws ComentSystemException {
| MyObject w = new MyObject() ;
| w.setName("test_name") ;
| em.getTransaction().begin();
| em.persist(w) ;
| em.getTransaction().commit();
| }
or manually creating a new entity manager like this :
@Observer("org.jboss.seam.postInitialization")
| private void setupAFewThings() throws ComentSystemException {
| MyObject w = new MyObject() ;
| w.setName("test_name") ;
| EntityManagerFactory emf = Persistence.createEntityManagerFactory("myDatabase");
| EntityManager em = emf.createEntityManager();
| em.getTransaction().begin();
| em.persist(w) ;
| em.getTransaction().commit();
| }
I get the same error ("java.lang.IllegalStateException: JTA EntityManager cannot access a transactions") :
anonymous wrote : 16:26:18,530 ERROR [[/coment_demo]] Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.jboss.seam.servlet.SeamListener
| java.lang.IllegalStateException: JTA EntityManager cannot access a transactions
| at org.hibernate.ejb.AbstractEntityManagerImpl.getTransaction(AbstractEntityManagerImpl.java:316)
| at com.sopinspace.coment.core.WorkflowManager.addDefaultWorkflow(WorkflowManager.java:53)
| at com.sopinspace.coment.core.WorkflowManager.create(WorkflowManager.java:62)
| 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:21)
| at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
Any help ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081692#4081692
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081692
18 years, 7 months
[Microcontainer] - Re: How do I programmatically declare a JNDI name dependency
by wolfc
Why does MC not spit out an exception when KernelRegistryPlugin fails!!!???
Wasted a day just to find out that something is going wrong.
2007-09-06 15:56:04,209 TRACE [org.jboss.ejb3.kernel.JNDIKernelRegistryPlugin:87] get entry for jndi:WSHandlerTest_wsejb_vehicleHome
| 2007-09-06 15:56:04,212 ERROR [STDERR:151] javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: No ClassLoaders found for: com.sun.ts.tests.common.vehicle.wsejb.WSEJBVehicleHome (no security manager: RMI class loader disabled)]
| 2007-09-06 15:56:04,214 ERROR [STDERR:151] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:788)
| 2007-09-06 15:56:04,215 ERROR [STDERR:151] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
| 2007-09-06 15:56:04,215 ERROR [STDERR:151] at javax.naming.InitialContext.lookup(InitialContext.java:351)
| 2007-09-06 15:56:04,216 ERROR [STDERR:151] at org.jboss.ejb3.kernel.JNDIKernelRegistryPlugin.getEntry(JNDIKernelRegistryPlugin.java:91)
| 2007-09-06 15:56:04,217 ERROR [STDERR:151] at org.jboss.kernel.plugins.registry.AbstractKernelRegistry.getEntry(AbstractKernelRegistry.java:85)
| 2007-09-06 15:56:04,218 ERROR [STDERR:151] at org.jboss.kernel.plugins.dependency.AbstractKernelController.getContext(AbstractKernelController.java:120)
| 2007-09-06 15:56:04,219 ERROR [STDERR:151] at org.jboss.dependency.plugins.AbstractController.getInstalledContext(AbstractController.java:355)
| 2007-09-06 15:56:04,220 ERROR [STDERR:151] at org.jboss.beans.metadata.plugins.AbstractDemandMetaData$DemandDependencyItem.resolve(AbstractDemandMetaData.java:165)
| 2007-09-06 15:56:04,221 ERROR [STDERR:151] at org.jboss.dependency.plugins.AbstractDependencyInfo.resolveDependencies(AbstractDependencyInfo.java:140)
| 2007-09-06 15:56:04,221 ERROR [STDERR:151] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:901)
| 2007-09-06 15:56:04,222 ERROR [STDERR:151] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:839)
| 2007-09-06 15:56:04,223 ERROR [STDERR:151] at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)
| 2007-09-06 15:56:04,224 ERROR [STDERR:151] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:622)
| 2007-09-06 15:56:04,227 ERROR [STDERR:151] at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:411)
| 2007-09-06 15:56:04,228 ERROR [STDERR:151] at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:495)
| 2007-09-06 15:56:04,229 ERROR [STDERR:151] at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:354) 2007-09-06 15:56:04,229 ERROR [STDERR:151] at org.jboss.deployment.services.DeploymentManagerService.deploy_phase2(DeploymentManagerService.java:412)
| 2007-09-06 15:56:04,230 ERROR [STDERR:151] at org.jboss.deployment.services.DeploymentManagerService.deploy(DeploymentManagerService.java:295)
| 2007-09-06 15:56:04,231 ERROR [STDERR:151] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 2007-09-06 15:56:04,232 ERROR [STDERR:151] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 2007-09-06 15:56:04,234 ERROR [STDERR:151] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 2007-09-06 15:56:04,235 ERROR [STDERR:151] at java.lang.reflect.Method.invoke(Method.java:585)
| 2007-09-06 15:56:04,237 ERROR [STDERR:151] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
| 2007-09-06 15:56:04,237 ERROR [STDERR:151] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
| 2007-09-06 15:56:04,238 ERROR [STDERR:151] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| 2007-09-06 15:56:04,239 ERROR [STDERR:151] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| 2007-09-06 15:56:04,240 ERROR [STDERR:151] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
| 2007-09-06 15:56:04,241 ERROR [STDERR:151] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 2007-09-06 15:56:04,241 ERROR [STDERR:151] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 2007-09-06 15:56:04,243 ERROR [STDERR:151] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 2007-09-06 15:56:04,244 ERROR [STDERR:151] at java.lang.reflect.Method.invoke(Method.java:585)
| 2007-09-06 15:56:04,245 ERROR [STDERR:151] at org.jboss.jmx.connector.invoker.InvokerAdaptorService.invoke(InvokerAdaptorService.java:270)
| 2007-09-06 15:56:04,245 ERROR [STDERR:151] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 2007-09-06 15:56:04,247 ERROR [STDERR:151] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 2007-09-06 15:56:04,249 ERROR [STDERR:151] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 2007-09-06 15:56:04,249 ERROR [STDERR:151] at java.lang.reflect.Method.invoke(Method.java:585)
| 2007-09-06 15:56:04,251 ERROR [STDERR:151] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
| 2007-09-06 15:56:04,253 ERROR [STDERR:151] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
| 2007-09-06 15:56:04,254 ERROR [STDERR:151] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:138)
| 2007-09-06 15:56:04,255 ERROR [STDERR:151] at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
| 2007-09-06 15:56:04,256 ERROR [STDERR:151] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:140)
| 2007-09-06 15:56:04,256 ERROR [STDERR:151] at org.jboss.jmx.connector.invoker.SerializableInterceptor.invoke(SerializableInterceptor.java:74)
| 2007-09-06 15:56:04,257 ERROR [STDERR:151] at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
| 2007-09-06 15:56:04,261 ERROR [STDERR:151] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| 2007-09-06 15:56:04,263 ERROR [STDERR:151] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
| 2007-09-06 15:56:04,264 ERROR [STDERR:151] at org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:179)
| 2007-09-06 15:56:04,265 ERROR [STDERR:151] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 2007-09-06 15:56:04,266 ERROR [STDERR:151] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 2007-09-06 15:56:04,266 ERROR [STDERR:151] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 2007-09-06 15:56:04,267 ERROR [STDERR:151] at java.lang.reflect.Method.invoke(Method.java:585)
| 2007-09-06 15:56:04,269 ERROR [STDERR:151] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
| 2007-09-06 15:56:04,270 ERROR [STDERR:151] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
| 2007-09-06 15:56:04,272 ERROR [STDERR:151] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| 2007-09-06 15:56:04,273 ERROR [STDERR:151] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| 2007-09-06 15:56:04,274 ERROR [STDERR:151] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
| 2007-09-06 15:56:04,275 ERROR [STDERR:151] at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:815)
| 2007-09-06 15:56:04,276 ERROR [STDERR:151] at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:416)
| 2007-09-06 15:56:04,277 ERROR [STDERR:151] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 2007-09-06 15:56:04,280 ERROR [STDERR:151] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 2007-09-06 15:56:04,280 ERROR [STDERR:151] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 2007-09-06 15:56:04,282 ERROR [STDERR:151] at java.lang.reflect.Method.invoke(Method.java:585)
| 2007-09-06 15:56:04,283 ERROR [STDERR:151] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
| 2007-09-06 15:56:04,283 ERROR [STDERR:151] at sun.rmi.transport.Transport$1.run(Transport.java:153)
| 2007-09-06 15:56:04,284 ERROR [STDERR:151] at java.security.AccessController.doPrivileged(Native Method)
| 2007-09-06 15:56:04,285 ERROR [STDERR:151] at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
| 2007-09-06 15:56:04,285 ERROR [STDERR:151] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
| 2007-09-06 15:56:04,286 ERROR [STDERR:151] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
| 2007-09-06 15:56:04,287 ERROR [STDERR:151] at java.lang.Thread.run(Thread.java:595)
| 2007-09-06 15:56:04,289 ERROR [STDERR:151] Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: com.sun.ts.tests.common.vehicle.wsejb.WSEJBVehicleHome (no security manager: RMI class loader disabled)
| 2007-09-06 15:56:04,289 ERROR [STDERR:151] at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:531)
| 2007-09-06 15:56:04,291 ERROR [STDERR:151] at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:628)
| 2007-09-06 15:56:04,292 ERROR [STDERR:151] at org.jboss.system.JBossRMIClassLoader.loadProxyClass(JBossRMIClassLoader.java:82)
| 2007-09-06 15:56:04,292 ERROR [STDERR:151] at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:294)
| 2007-09-06 15:56:04,293 ERROR [STDERR:151] at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:238)
| 2007-09-06 15:56:04,296 ERROR [STDERR:151] at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1499)
| 2007-09-06 15:56:04,297 ERROR [STDERR:151] at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1462)
| 2007-09-06 15:56:04,298 ERROR [STDERR:151] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1698)
| 2007-09-06 15:56:04,300 ERROR [STDERR:151] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1304)
| 2007-09-06 15:56:04,301 ERROR [STDERR:151] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:349)
| 2007-09-06 15:56:04,301 ERROR [STDERR:151] at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
| 2007-09-06 15:56:04,302 ERROR [STDERR:151] at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
| 2007-09-06 15:56:04,307 ERROR [STDERR:151] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:712)
| 2007-09-06 15:56:04,308 ERROR [STDERR:151] ... 67 more
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081685#4081685
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081685
18 years, 7 months
[JBoss jBPM] - Re: How to know who has started a process ?
by dleerob
Using a swimlane on the start task does work, as Ronald mentioned. Perhaps call it "Initiator", as I've done. Make it a standard on all your processes. Eg, at the top of you processdefinition.xml there should be this:
<swimlane name="Initiator"></swimlane>
That swimlane will be filled with the actorId that started the process, again as Ronald mentioned.
If you have a task on the start node, and you know what the name of that task is, you could get the task instances for the process, and find the one with the name you require, and get the actorId for that task instance.
Whenever I create a new process, I also set a variable on the process called "sys_initiator", with the username/actorId of the currently authenticated user. This way I can always just get the "sys_initiator" variable when I want to know the username of the person who started the process.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081683#4081683
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081683
18 years, 7 months