Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
AS 4.2.3.GA
-
None
-
None
Description
I'm developing an application and I want my EJBs JNDI mapping to be controlled by me. To do so, I have this annotation in my EJB:
@Stateless(name="LocalDataSource", mappedName="LocalDataSource")
public class LocalDataSourceBean implements LocalDataSourceLocal, LocalDatasourceRemote {
But as JBoss seems to ignore the mappedName attribute at least when it's deployed in an EAR, I include also the following jboss.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<jboss
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://www.jboss.org/j2ee/schema/jboss_5_0.xsd"
version="3.0">
<enterprise-beans>
<session>
<ejb-name>LocalDataSource</ejb-name>
<local-jndi-name>LocalDataSource</local-jndi-name>
</session>
</enterprise-beans>
</jboss>
That seems to work as my EJB is deployed to the LocalDataSource global JNDI address. This jar will be deployed in an ear eventually but now that I'm doing development, I'm deploying it as an EJB jar directly. That jar has also some JPA classes and a persitence.xml file.
I can deploy and use the file the first time that I copy it to the deploy directory or the first time that I start JBoss, but when I try to undeploy it I get this:
15:46:57,411 INFO [EJBContainer] STOPPED EJB: com.andago.healthassistant.datasource.local.LocalDataSourceBean ejbName: LocalDataSource
15:46:57,413 WARN [JmxKernelAbstraction] jboss.j2ee:jar=OHA-local-backend-1.0-SNAPSHOT.jar,name=LocalDataSource,service=EJB3 is not registered
15:46:57,414 INFO [PersistenceUnitDeployment] Stopping persistence unit persistence.units:jar=OHA-local-backend-1.0-SNAPSHOT.jar,unitName=DocumentPersistenceJTA
15:46:57,414 INFO [SessionFactoryImpl] closing
15:46:57,414 INFO [SessionFactoryObjectFactory] Unbinding factory from JNDI name: persistence.units:jar=OHA-local-backend-1.0-SNAPSHOT.jar,unitName=DocumentPersistenceJTA
15:46:57,414 INFO [NamingHelper] JNDI InitialContext properties:
15:46:57,414 INFO [SessionFactoryObjectFactory] Unbound factory from JNDI name: persistence.units:jar=OHA-local-backend-1.0-SNAPSHOT.jar,unitName=DocumentPersistenceJTA
15:46:57,415 WARN [JmxKernelAbstraction] persistence.units:jar=OHA-local-backend-1.0-SNAPSHOT.jar,unitName=DocumentPersistenceJTA is not registered
and when I try to redeploy it, I get the following error:
..........................
15:57:28,480 INFO [NamingHelper] JNDI InitialContext properties:
15:57:28,489 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
15:57:28,489 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=OHA-local-backend-1.0-SNAPSHOT.jar,name=LocalDataSource,service=EJB3 with dependencies:
15:57:28,489 INFO [JmxKernelAbstraction] persistence.units:jar=OHA-local-backend-1.0-SNAPSHOT.jar,unitName=DocumentPersistenceJTA
15:57:28,494 INFO [EJBContainer] STARTED EJB: com.andago.healthassistant.datasource.local.LocalDataSourceBean ejbName: LocalDataSource
15:57:28,496 INFO [EJBContainer] STOPPED EJB: com.andago.healthassistant.datasource.local.LocalDataSourceBean ejbName: LocalDataSource
15:57:28,497 WARN [ServiceController] Problem starting service jboss.j2ee:jar=OHA-local-backend-1.0-SNAPSHOT.jar,name=LocalDataSource,service=EJB3
java.lang.ClassCastException: $Proxy173 cannot be cast to javax.naming.Context
at org.jboss.util.naming.Util.createSubcontext(Util.java:69)
at org.jboss.util.naming.Util.rebind(Util.java:125)
at org.jboss.util.naming.Util.rebind(Util.java:113)
at org.jboss.ejb3.stateless.BaseStatelessProxyFactory.bindProxy(BaseStatelessProxyFactory.java:231)
at org.jboss.ejb3.stateless.BaseStatelessProxyFactory.start(BaseStatelessProxyFactory.java:216)
at org.jboss.ejb3.stateless.StatelessRemoteProxyFactory.start(StatelessRemoteProxyFactory.java:120)
at org.jboss.ejb3.ProxyDeployer.start(ProxyDeployer.java:83)
at org.jboss.ejb3.SessionContainer.start(SessionContainer.java:157)
at org.jboss.ejb3.stateless.StatelessContainer.start(StatelessContainer.java:102)
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:597)
at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:103)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy177.start(Unknown Source)
at org.jboss.ejb3.JmxKernelAbstraction.install(JmxKernelAbstraction.java:120)
at org.jboss.ejb3.Ejb3Deployment.registerEJBContainer(Ejb3Deployment.java:301)
at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:362)
at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:91)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy33.start(Unknown Source)
at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:512)
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:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy34.start(Unknown Source)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy9.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
15:57:28,498 INFO [EJB3Deployer] Deployed: file:/home/jsanchez/apps/jboss/jboss-4.2.3.GA/server/default/deploy/OHA/OHA-local-backend-1.0-SNAPSHOT.jar
15:57:28,500 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
— MBeans waiting for other MBeans —
ObjectName: jboss.j2ee:jar=OHA-local-backend-1.0-SNAPSHOT.jar,name=LocalDataSource,service=EJB3
State: FAILED
Reason: java.lang.ClassCastException: $Proxy173 cannot be cast to javax.naming.Context
I Depend On:
persistence.units:jar=OHA-local-backend-1.0-SNAPSHOT.jar,unitName=DocumentPersistenceJTA
— MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM —
ObjectName: jboss.j2ee:jar=OHA-local-backend-1.0-SNAPSHOT.jar,name=LocalDataSource,service=EJB3
State: FAILED
Reason: java.lang.ClassCastException: $Proxy173 cannot be cast to javax.naming.Context
I Depend On:
persistence.units:jar=OHA-local-backend-1.0-SNAPSHOT.jar,unitName=DocumentPersistenceJTA
I cannot redeploy the jar and I have to restart JBoss in order to be able to update the ejb-jar. If I go to the JNDI list in the jmx-console, I see that, once the ejb-jar is deleted, the name LocalDataSource is still registered.