[JBoss Seam] - problems with Sun JSF implementation
by viniciuscarvalho
Hi there! I've seen ppl discussing this here before. I'm having problems when deploying the jbpm-console on a instance (4.0.5-ejb3) that has a seam 1.2.1 app. If I take out the app, the console is deployed, if not I get the following exception:
| 09:32:00,236 ERROR [STDERR] Apr 25, 2007 9:32:00 AM com.sun.faces.config.ConfigureListener contextInitialized
| INFO: Initializing Sun's JavaServer Faces implementation (1.2_03-b09-FCS) for context 'null'
| 09:32:00,504 ERROR [STDERR] javax.faces.FacesException: org.jboss.seam.jsf.SeamApplicationFactory
| 09:32:00,505 ERROR [STDERR] at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:587)
| 09:32:00,506 ERROR [STDERR] at javax.faces.FactoryFinder.getImplementationInstance(FactoryFinder.java:460)
| 09:32:00,506 ERROR [STDERR] at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:256)
| 09:32:00,507 ERROR [STDERR] at com.sun.faces.config.ConfigureListener.application(ConfigureListener.java:520)
| 09:32:00,507 ERROR [STDERR] at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:568)
| 09:32:00,507 ERROR [STDERR] at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:542)
| 09:32:00,508 ERROR [STDERR] at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:438)
| 09:32:00,508 ERROR [STDERR] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3763)
| 09:32:00,509 ERROR [STDERR] at org.apache.catalina.core.StandardContext.start(StandardContext.java:4211)
| 09:32:00,509 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
| 09:32:00,509 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
| 09:32:00,510 ERROR [STDERR] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
| 09:32:00,510 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 09:32:00,511 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 09:32:00,511 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 09:32:00,512 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 09:32:00,512 ERROR [STDERR] at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
| 09:32:00,513 ERROR [STDERR] at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
| 09:32:00,513 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| 09:32:00,514 ERROR [STDERR] at org.apache.catalina.core.StandardContext.init(StandardContext.java:5052)
| 09:32:00,514 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 09:32:00,515 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 09:32:00,515 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 09:32:00,516 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 09:32:00,516 ERROR [STDERR] at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
| 09:32:00,516 ERROR [STDERR] at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
| 09:32:00,517 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| 09:32:00,517 ERROR [STDERR] at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:297)
| 09:32:00,518 ERROR [STDERR] at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:103)
| 09:32:00,518 ERROR [STDERR] at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:371)
| 09:32:00,519 ERROR [STDERR] at org.jboss.web.WebModule.startModule(WebModule.java:83)
| 09:32:00,519 ERROR [STDERR] at org.jboss.web.WebModule.startService(WebModule.java:61)
| 09:32:00,520 ERROR [STDERR] at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
| 09:32:00,520 ERROR [STDERR] at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
| 09:32:00,521 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
| 09:32:00,521 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 09:32:00,522 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 09:32:00,522 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| 09:32:00,522 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| 09:32:00,523 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| 09:32:00,523 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| 09:32:00,524 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| 09:32:00,524 ERROR [STDERR] at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
| 09:32:00,525 ERROR [STDERR] at $Proxy0.start(Unknown Source)
| 09:32:00,525 ERROR [STDERR] at org.jboss.system.ServiceController.start(ServiceController.java:417)
| 09:32:00,525 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
| 09:32:00,526 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 09:32:00,526 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 09:32:00,527 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| 09:32:00,531 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| 09:32:00,532 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| 09:32:00,532 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| 09:32:00,532 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| 09:32:00,534 ERROR [STDERR] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| 09:32:00,534 ERROR [STDERR] at $Proxy49.start(Unknown Source)
| 09:32:00,535 ERROR [STDERR] at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
| 09:32:00,535 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 09:32:00,535 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 09:32:00,536 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 09:32:00,536 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 09:32:00,537 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| 09:32:00,537 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| 09:32:00,538 ERROR [STDERR] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| 09:32:00,538 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| 09:32:00,538 ERROR [STDERR] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| 09:32:00,539 ERROR [STDERR] at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
| 09:32:00,539 ERROR [STDERR] at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
| 09:32:00,540 ERROR [STDERR] at org.jboss.ws.integration.jboss.DeployerInterceptor.start(DeployerInterceptor.java:92)
| 09:32:00,540 ERROR [STDERR] at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
| 09:32:00,541 ERROR [STDERR] at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
| 09:32:00,541 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| 09:32:00,541 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| 09:32:00,542 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| 09:32:00,542 ERROR [STDERR] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| 09:32:00,543 ERROR [STDERR] at $Proxy50.start(Unknown Source)
| 09:32:00,544 ERROR [STDERR] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
| 09:32:00,544 ERROR [STDERR] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
| 09:32:00,545 ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
| 09:32:00,545 ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
| 09:32:00,545 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
| 09:32:00,546 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 09:32:00,546 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 09:32:00,547 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| 09:32:00,547 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| 09:32:00,548 ERROR [STDERR] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| 09:32:00,548 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| 09:32:00,548 ERROR [STDERR] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| 09:32:00,549 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| 09:32:00,549 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| 09:32:00,550 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| 09:32:00,550 ERROR [STDERR] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| 09:32:00,554 ERROR [STDERR] at $Proxy8.deploy(Unknown Source)
| 09:32:00,555 ERROR [STDERR] at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
| 09:32:00,555 ERROR [STDERR] at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
| 09:32:00,573 ERROR [STDERR] at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
| 09:32:00,573 ERROR [STDERR] at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
| 09:32:00,573 ERROR [STDERR] at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
| 09:32:00,574 ERROR [STDERR] at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
| 09:32:00,574 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
| 09:32:00,575 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 09:32:00,575 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 09:32:00,576 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| 09:32:00,576 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| 09:32:00,577 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| 09:32:00,577 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| 09:32:00,577 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| 09:32:00,578 ERROR [STDERR] at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
| 09:32:00,579 ERROR [STDERR] at $Proxy0.start(Unknown Source)
| 09:32:00,579 ERROR [STDERR] at org.jboss.system.ServiceController.start(ServiceController.java:417)
| 09:32:00,580 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
| 09:32:00,580 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 09:32:00,581 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 09:32:00,581 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| 09:32:00,581 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| 09:32:00,582 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| 09:32:00,582 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| 09:32:00,583 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| 09:32:00,583 ERROR [STDERR] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| 09:32:00,584 ERROR [STDERR] at $Proxy4.start(Unknown Source)
| 09:32:00,584 ERROR [STDERR] at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
| 09:32:00,585 ERROR [STDERR] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
| 09:32:00,585 ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
| 09:32:00,586 ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
| 09:32:00,586 ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
| 09:32:00,587 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 09:32:00,587 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 09:32:00,588 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 09:32:00,588 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 09:32:00,589 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| 09:32:00,589 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| 09:32:00,590 ERROR [STDERR] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| 09:32:00,590 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| 09:32:00,591 ERROR [STDERR] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| 09:32:00,591 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| 09:32:00,595 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| 09:32:00,596 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| 09:32:00,596 ERROR [STDERR] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| 09:32:00,597 ERROR [STDERR] at $Proxy5.deploy(Unknown Source)
| 09:32:00,597 ERROR [STDERR] at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
| 09:32:00,597 ERROR [STDERR] at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
| 09:32:00,598 ERROR [STDERR] at org.jboss.Main.boot(Main.java:200)
| 09:32:00,598 ERROR [STDERR] at org.jboss.Main$1.run(Main.java:490)
| 09:32:00,599 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
| 09:32:00,600 ERROR [STDERR] Caused by: java.lang.InstantiationException: org.jboss.seam.jsf.SeamApplicationFactory
| 09:32:00,601 ERROR [STDERR] at java.lang.Class.newInstance0(Class.java:340)
| 09:32:00,601 ERROR [STDERR] at java.lang.Class.newInstance(Class.java:308)
| 09:32:00,614 ERROR [STDERR] at javax.faces.FactoryFinder.getImplGivenPreviousImpl(FactoryFinder.java:585)
| 09:32:00,614 ERROR [STDERR] ... 142 more
|
I tried to isolate the classloader through jboss-app and jboss-web configurations and did not work.
Any ideas?
Regards
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4040564#4040564
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4040564
19 years
[JBoss Seam] - entity-query vs. Manager-nested @Factory List
by quilian
Hi all!
I declared the following in components.xml:
<framework:entity-query name="alleBenutzer" ejbql="select benutzer from BenutzerImpl benutzer" />
i assumed that this would also do the trick:
|
| @Stateful
| @Scope(ScopeType.SESSION)
| @Name("gruppenManager")
| public class GruppenManagerImpl implements Serializable, GruppenManager {
| @PersistenceContext(type = PersistenceContextType.EXTENDED)
| private EntityManager em;
|
| @DataModel // (scope=ScopeType.PAGE)
| private List<GruppeImpl> gruppenList;
|
| @Factory(value = "gruppenList")
| public void findGruppen() {
| gruppenList = em.createQuery("select gruppe from GruppeImpl gruppe order by id").getResultList();
| }
| ...
| }
|
I use s:selectItems and s:convertEntity to show the list of Gruppen:
| <h:selectOneMenu id="selectGruppenAuswahl" value="#{selectedBenutzer.gruppe}" required="true">
| <s:selectItems id="gruppenAuswahl" value="#{alleGruppen}" var="gruppeItem" label="#{gruppeItem.label}"/>
| <s:convertEntity />
| </h:selectOneMenu>
|
however, when using gruppenList instead of alleGruppen as value for s:selectItems the form looks like before, but on submission, i get this well know validation failed error:
selectGruppenAuswahl is not a valid entry.
The interesting this is, i get this only if i dont select another entry from the list. In that case i get the "detached entity passed to persist" exception, which happens anyway after the validation is complete. But thats for another posting. The this is the validation gets through if i select another entry.
I thought the two ways to do the query would be more or less interchangeable.
I dont know why, but the logged select statements are different for the two options:
for the framework:entity-query
| 11:05:16,984 INFO [STDOUT] Hibernate: select gruppeimpl0_.id as id5_, gruppeimpl0_.name as name5_, gruppeimpl0_.version as version5_, gruppeimpl0_.status as status5_ from gruppen gruppeimpl0_
| 11:05:21,734 INFO [STDOUT] Hibernate: select gruppeimpl0_.id as id5_, gruppeimpl0_.name as name5_, gruppeimpl0_.version as version5_, gruppeimpl0_.status as status5_ from gruppen gruppeimpl0_
|
and for the @Factory solution:
| 11:01:42,593 INFO [STDOUT] Hibernate: select gruppeimpl0_.id as id1_, gruppeimpl0_.name as name1_, gruppeimpl0_.version as version1_, gruppeimpl0_.status as status1_ from gruppen gruppeimpl0_
| 11:01:44,312 INFO [STDOUT] Hibernate: select gruppeimpl0_.id as id1_0_, gruppeimpl0_.name as name1_0_, gruppeimpl0_.version as version1_0_, gruppeimpl0_.status as status1_0_ from gruppen gruppeimpl0_ where gruppeimpl0_.id=?
|
I completely dont understand this. But it might be a clue. The first query is done when the page loads, whereas the latter is called when the form is submitted.
The generated HTML forms also differ in the selection index - the value which the client selects. The ordering is not the same. Could this be a reason?
Thanks for any help.
Tobias Kilian
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4040563#4040563
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4040563
19 years
[EJB 3.0] - EntityManager Null when trying to inject into stateless sess
by BmanT
Hi,
I'm having an issue deploying to JBoss 4.0.5-ejb3. When I try to inject my EntityManager in my code:
| @PersistenceContext EntityManager em;
|
it is always null. However, if I do:
| EntityManagerFactory emf = Persistence.createEntityManagerFactory("myDS");
| em = emf.createEntityManager();
|
This is my setup:
I have a java web service that calls my Stateless Session bean. In my session bean, I try to inject the PersistenceContext, so I can utilize my Entity Beans.
I have a .ear archive that I deploy to the server/default/deploy directory (using JBuilder 2007) - with a .war (that contains my web service) and a .jar that contains my beans (entity and session).
I have everything annotated according to the documentation. All of the documentation says that it should work.
ISampleClass is the @Local Interface class.
| @Stateless (name="SampleClass")
| public class SampleClass implements ISampleClass
|
| @PersistenceContext (unitName="myDS")
| EntityManager em;
|
| public Resource findResource() {
| Resource resource = em.find(Resource.class, 1);
| return resource;
| }
| }
|
I've also tried: @TransactionAttribute (TransactionAttributeType.REQUIRED) at the class and method level.
I wrote a client that calls the web service (Axis 1.3 client generated). It calls the service fine, but I get a NullPointerException when it tries to call the em.persist() method inside my stateless session bean.
Here is my persistence.xml file:
| ><persistence-unit name="myDS">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/myDS</jta-data-source>
| <properties>
| <property name="hibernate.hbm2ddl.auto" value="validate"></property>
| <property name="hibernate.dialect"
| value="org.hibernate.dialect.MySQLInnoDBDialect" />
| <property name="hibernate.session_factory_name"
| value="java:hibernate/HibernateFactory" />
| <property name="transaction.factory_class"
| value="org.hibernate.transaction.JTATransactionFactory" />
| <property name="hibernate.cache.use_second_level_cache"
| value="false" />
| <property name="hibernate.transaction.manager_lookup_class"
| value="org.hibernate.transaction.JBossTransactionManagerLookup" />
| </properties>
| </persistence-unit>
|
I've also tried explicity setting the transaction-type to "JTA" at the persistence-unit level, not setting the provider and leaving the properties section empty.
Here is my mysql-ds.xml file:
| <datasources>
| <local-tx-datasource>
| <jndi-name>myDS</jndi-name>
| <connection-url>jdbc:mysql://localhost:3306/myDB</connection-url>
| <driver-class>com.mysql.jdbc.Driver</driver-class>
| <user-name>myuser</user-name>
| <password>mypass</password>
| <connection-property name="socketFactory">com.mysql.jdbc.NamedPipeSocketFactory</connection-property>
| <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
| <metadata>
| <type-mapping>mySQL</type-mapping>
| </metadata>
| </local-tx-datasource>
| </datasources
|
And looking at the JBoss logs with debug on I see this (which seems to me that it's loading correctly):
anonymous wrote :
| 2007-04-24 09:00:51,656 DEBUG [org.jboss.system.ServiceController] starting service jboss.j2ee:service=EJB3,module=MyApp.jar
| 2007-04-24 09:00:51,656 DEBUG [org.jboss.ejb3.Ejb3Module] Starting jboss.j2ee:service=EJB3,module=MyApp.jar
| 2007-04-24 09:00:51,656 DEBUG [org.jboss.ejb3.JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.entity.PersistenceUnitDeployment
| 2007-04-24 09:00:51,656 INFO [org.jboss.ejb3.JmxKernelAbstraction] installing MBean: persistence.units:ear=MyEar.ear,jar=MyApp.jar,unitName=myDS with dependencies
| 2007-04-24 09:00:51,656 INFO [org.jboss.ejb3.JmxKernelAbstraction] jboss.jca:name=pmacDS,service=DataSourceBinding
| 2007-04-24 09:00:51,656 DEBUG [org.jboss.system.ServiceController] Creating service persistence.units:ear=MyEar.ear,jar=MyApp.jar,unitName=myDS
| 2007-04-24 09:00:51,656 DEBUG [org.jboss.system.ServiceController] adding depends in ServiceController.register: [jboss.jca:name=myDS,service=DataSourceBinding]
| 2007-04-24 09:00:51,656 DEBUG [org.jboss.system.ServiceController] recording that persistence.units:ear=MyEar.ear,jar=MyApp.jar,unitName=myDS depends on jboss.jca:name=pmacDS,service=DataSourceBinding
| 2007-04-24 09:00:51,656 DEBUG [org.jboss.ejb3.ServiceDelegateWrapper] Creating persistence.units:ear=MyEar.ear,jar=MyApp.jar,unitName=myDS
| 2007-04-24 09:00:51,656 DEBUG [org.jboss.ejb3.ServiceDelegateWrapper] Created persistence.units:ear=MyEar.ear,jar=MyApp.jar,unitName=myDS
| 2007-04-24 09:00:51,656 DEBUG [org.jboss.system.ServiceController] Creating dependent components for: persistence.units:ear=MyEar.ear,jar=MyApp.jar,unitName=myDS dependents are: []
| 2007-04-24 09:00:51,656 DEBUG [org.jboss.system.ServiceController] starting service persistence.units:ear=MyEar.ear,jar=MyApp.jar,unitName=myDS
| 2007-04-24 09:00:51,656 DEBUG [org.jboss.ejb3.ServiceDelegateWrapper] Starting persistence.units:ear=MyEar.ear,jar=MyApp.jar,unitName=myDS
| 2007-04-24 09:00:51,671 DEBUG [org.jboss.ejb3.entity.PersistenceUnitDeployment] Found persistence.xml file in EJB3 jar
| 2007-04-24 09:00:51,687 INFO [org.hibernate.ejb.Version] Hibernate EntityManager 3.2.0.GA
| 2007-04-24 09:00:51,703 INFO [org.hibernate.cfg.annotations.Version] Hibernate Annotations 3.2.0.GA
| 2007-04-24 09:00:51,718 INFO [org.hibernate.cfg.Environment] Hibernate 3.2.0.ga
| 2007-04-24 09:00:51,734 INFO [org.hibernate.cfg.Environment] hibernate.properties not found
| 2007-04-24 09:00:51,734 INFO [org.hibernate.cfg.Environment] Bytecode provider name : javassist
| 2007-04-24 09:00:51,734 INFO [org.hibernate.cfg.Environment] using JDK 1.4 java.sql.Timestamp handling
| 2007-04-24 09:00:51,828 DEBUG [org.hibernate.ejb.Ejb3Configuration] 2007-04-20 09:31:26,390 DEBUG [org.hibernate.ejb.Ejb3Configuration] Processing PersistenceUnitInfo [
| name: myDS
| persistence provider classname: org.hibernate.ejb.HibernatePersistence
| classloader: org.jboss.mx.loading.UnifiedClassLoader3@174a144{ url=file:/C:/jboss-4.0.5.GA/server/default/tmp/deploy/tmp30571MyEAR.ear ,addedOrder=47}
| Temporary classloader: null
| excludeUnlistedClasses: false
| JTA datasource: org.jboss.resource.adapter.jdbc.WrapperDataSource@4eb98b
| Non JTA datasource: null
| Transaction type: JTA
| PU root URL: file:/C:/jboss-4.0.5.GA/server/default/tmp/deploy/tmp30571MyEAR.ear-contents/MyJAR.jar
| Jar files URLs []
| Managed classes names [ <list of my classes>]
| Mapping files names []
| Properties [
| hibernate.jacc.ctx.id: MyJAR.jar
| hibernate.jndi.java.naming.factory.initial: org.jnp.interfaces.NamingContextFactory
| hibernate.transaction.manager_lookup_class: org.hibernate.transaction.JBossTransactionManagerLookup
| hibernate.cache.provider_class: org.hibernate.cache.HashtableCacheProvider
| hibernate.dialect: org.hibernate.dialect.MySQLInnoDBDialect
| hibernate.bytecode.use_reflection_optimizer: false
| hibernate.jndi.java.naming.factory.url.pkgs: org.jboss.naming:org.jnp.interfaces
| hibernate.bytecode.provider: javassist
|
Any ideas?
Thanks,
Bryan
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4040561#4040561
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4040561
19 years