Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kundera + Jave EE (CDI) + JBoss 7.2 = Persistence Unit not found. #534

Open
dtraverso opened this issue Feb 21, 2014 · 4 comments
Open

Kundera + Jave EE (CDI) + JBoss 7.2 = Persistence Unit not found. #534

dtraverso opened this issue Feb 21, 2014 · 4 comments
Assignees
Labels

Comments

@dtraverso
Copy link

Hello,

We are encountering an issue that appears to be specific to deployment on JBoss 7.x (7.2 used in example). I have uploaded a sample Java EE 6 webapp to a public BitBucket git repo to exhibit the erroneous behavior.

KunderaJbossCDI sample webapp Java EE stack:

  • JPA Provided by Kundera (Cassandra)
  • CDI container provided
  • JAX-RS Jersey provided

Prereqs:

  • local Cassandra DB (we used 2.0.5)
  • Java7
  • Maven
  • JBoss 7.2, Glassfish 4 (to see example of correct behavior)

Steps to reproduce:

  1. Acquire source @ https://bitbucket.org/d_traverso/kunderajbosscdi
  2. Use Maven to build source & produce WAR
  3. Deploy webapp WAR to JBoss 7.2
  4. Verify app greeting page @ http://localhost:8080/KunderaJbossCDI/
  5. Make HTTP GET request @ http://localhost:8080/KunderaJbossCDI/services/students
  6. Observe server error stack.

If you repeat these steps, but substitute JBoss 7.2 with GlassFish V4, no errors are encountered.

Because the CDI beans are @RequestScoped, the app should deploy without incident, but produce errors upon making a request.

Also, I am aware that there is a sample Kundera JBoss deployment app, however that sample uses SpringFramework. The issue here is Kundera in conjunction with Java EE APIs (specifically CDI / weld), when deployed to JBoss 7.x.

Error Stack trace:

11:50:23,835 SEVERE com.sun.jersey.spi.container.ContainerResponse The RuntimeException could not be mapped to a response, re-throwing to the HTTP container: org.jboss.msc.service.ServiceNotFoundException: Service service jboss.persistenceunit."KunderaJbossCDI-1.0-SNAPSHOT.war#cassandra_pu" not found
at org.jboss.msc.service.ServiceContainerImpl.getRequiredService(ServiceContainerImpl.java:448)
at org.jboss.as.weld.services.bootstrap.WeldJpaInjectionServices.resolvePersistenceUnit(WeldJpaInjectionServices.java:81) [jboss-as-weld-7.2.0.Final.jar:7.2.0.Final]
at org.jboss.weld.util.Beans.injectEEFields(Beans.java:691) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1$1.proceed(ManagedBean.java:160) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1.work(ManagedBean.java:157) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bean.ManagedBean$FixInjectionPoint.run(ManagedBean.java:131) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.inject(ManagedBean.java:153) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:293) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:68) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:608) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:674) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:136) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:763) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:772) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1$1.proceed(ManagedBean.java:161) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1.work(ManagedBean.java:157) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bean.ManagedBean$FixInjectionPoint.run(ManagedBean.java:131) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.inject(ManagedBean.java:153) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:293) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:103) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:90) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79) [weld-core-1.1.10.Final.jar:2012-10-12 10:00]
at com.umbrella.webapp.ws.Students$Proxy$_$$WeldClientProxy.getDefaultStudent(Students$Proxy$$$_WeldClientProxy.java) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_25]
at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_25]
at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) [jersey-server-1.18.jar:1.18]
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185) [jersey-server-1.18.jar:1.18]
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) [jersey-server-1.18.jar:1.18]
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302) [jersey-server-1.18.jar:1.18]
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) [jersey-server-1.18.jar:1.18]
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) [jersey-server-1.18.jar:1.18]
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) [jersey-server-1.18.jar:1.18]
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542) [jersey-server-1.18.jar:1.18]
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473) [jersey-server-1.18.jar:1.18]
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419) [jersey-server-1.18.jar:1.18]
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409) [jersey-server-1.18.jar:1.18]
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409) [jersey-servlet-1.18.jar:1.18]
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540) [jersey-servlet-1.18.jar:1.18]
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715) [jersey-servlet-1.18.jar:1.18]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final.jar:1.0.2.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.0.Final.jar:7.2.0.Final]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.2.0.Final.jar:7.2.0.Final]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.0.Final.jar:7.2.0.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]

@dtraverso
Copy link
Author

An additional concern I'd like to point out. Per the documentation on Kundera GitHub Wiki, we have configured our persistence.xml with the property:

property name="jboss.as.jpa.managed" value="false"

I am wondering if perhaps for Java EE environment this is creating an issue that is absent in your provided sample Spring based data-keeper app? However, removing it did not seem to fix the issue..

@mevivs
Copy link
Collaborator

mevivs commented Feb 24, 2014

Hi,
I will have a look and get back to you on this.

Sincerely,
-Vivek

@dtraverso
Copy link
Author

Hi Vivek,

Just wanted to follow up and see if there's been any updates on this issue? I appreciate you looking into this matter.

Thanks,
Dario

@mevivs
Copy link
Collaborator

mevivs commented Mar 1, 2014

Hi Dario,
I did post it over kundera-discuss but somehow missed to update here.

Since Support to enable OSGI is in progress { https://github.com/impetus-opensource/Kundera/pull/525}. Until it is completed , as an alternative we can deploy EJB ear/war over EJB container(e.g. Jboss 7.x) by explicitly disabling JBoss to manage Container managed EM/EMF beans as: 

<property name="jboss.as.jpa.managed" value="false" /> and using Spring's DI and LocalContainerEntityManagerFactoryBean 
https://github.com/impetus-opensource/Kundera/blob/trunk/examples/container/jboss/data-keeper/src/main/resources/appContext.xml#L32. I am not sure whether any such alternative is available with CDI. That's why i proposed to go with Producer approach. Not sure, if any other alternative is possible. 

Once OSGfying Kundera task gets completed, this should also work. 

Still i need to work on #525.

Hope it helps,

-Vivek

@chhavigangwal chhavigangwal modified the milestones: 2.16, 2.15 Jan 6, 2015
@chhavigangwal chhavigangwal modified the milestones: 3.0, 2.16 Apr 14, 2015
@chhavigangwal chhavigangwal modified the milestones: 3.0 , 2.17 May 11, 2015
@chhavigangwal chhavigangwal removed this from the 3.0 milestone Dec 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants