[jboss-user] [JNDI/Naming/Network] - Migration from JBoss 4.2.3.GA to JBoss 5.0.0.GA
Mailman2009
do-not-reply at jboss.com
Tue Feb 24 03:11:27 EST 2009
Hi,
in JBoss 4 this code will works fine:
| @Stateless
| public class GetUserName implements GetUserNameLocal {
|
| public GetUserName() {
| }
|
| @Override
| public String getUserName() throws NamingException {
| InitialContext ic = new InitialContext();
| EJBContext sctxLookup = (EJBContext) ic.lookup("java:comp/EJBContext");
| Principal principal = sctxLookup.getCallerPrincipal();
| String userName = principal.getName();
|
| return userName;
| }
| }
|
On JBoss 5 i get the following exception:
| 08:56:29,719 INFO [STDOUT] javax.naming.NamingException: Could not dereference object [Root exception is java.lang.NullPointerException]
| 08:56:29,719 INFO [STDOUT] at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1463)
| 08:56:29,719 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:809)
| 08:56:29,719 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:820)
| 08:56:29,719 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:673)
| 08:56:29,750 INFO [STDOUT] at javax.naming.InitialContext.lookup(InitialContext.java:392)
| 08:56:29,750 INFO [STDOUT] at de.test.riedel.ejb.service.GetUserName.getUserName(GetUserName.java:28)
| 08:56:29,750 INFO [STDOUT] at de.test.riedel.ejb.revision.RevisionListener.newRevision(RevisionListener.java:22)
| 08:56:29,750 INFO [STDOUT] at org.jboss.envers.revisioninfo.DefaultRevisionInfoGenerator.newRevision(DefaultRevisionInfoGenerator.java:73)
| 08:56:29,750 INFO [STDOUT] at org.jboss.envers.revisioninfo.DefaultRevisionInfoGenerator.generate(DefaultRevisionInfoGenerator.java:80)
| 08:56:29,750 INFO [STDOUT] at org.jboss.envers.synchronization.VersionsSync.executeInSession(VersionsSync.java:109)
| 08:56:29,750 INFO [STDOUT] at org.jboss.envers.synchronization.VersionsSync.beforeCompletion(VersionsSync.java:144)
| 08:56:29,750 INFO [STDOUT] at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:101)
| 08:56:29,750 INFO [STDOUT] at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:263)
| 08:56:29,750 INFO [STDOUT] at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:86)
| 08:56:29,750 INFO [STDOUT] at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
| 08:56:29,750 INFO [STDOUT] at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1414)
| 08:56:29,750 INFO [STDOUT] at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
| 08:56:29,750 INFO [STDOUT] at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
| 08:56:30,250 INFO [STDOUT] at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:170)
| 08:56:30,250 INFO [STDOUT] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
| 08:56:30,250 INFO [STDOUT] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)
| 08:56:30,250 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| 08:56:30,250 INFO [STDOUT] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
| 08:56:30,250 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| 08:56:30,250 INFO [STDOUT] at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
| 08:56:30,250 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| 08:56:30,250 INFO [STDOUT] at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorv2.invoke(RoleBasedAuthorizationInterceptorv2.java:201)
| 08:56:30,250 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| 08:56:30,250 INFO [STDOUT] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:159)
| 08:56:30,250 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| 08:56:30,250 INFO [STDOUT] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
| 08:56:30,250 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| 08:56:30,281 INFO [STDOUT] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| 08:56:30,281 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| 08:56:30,281 INFO [STDOUT] at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:65)
| 08:56:30,281 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| 08:56:30,281 INFO [STDOUT] at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
| 08:56:30,281 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| 08:56:30,281 INFO [STDOUT] at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:486)
| 08:56:30,281 INFO [STDOUT] at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:56)
| 08:56:30,281 INFO [STDOUT] at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
| 08:56:30,281 INFO [STDOUT] at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| 08:56:30,281 INFO [STDOUT] at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:908)
| 08:56:30,281 INFO [STDOUT] at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:742)
| 08:56:30,281 INFO [STDOUT] at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:695)
| 08:56:30,281 INFO [STDOUT] at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:522)
| 08:56:30,281 INFO [STDOUT] at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:230)
| 08:56:30,281 INFO [STDOUT] Caused by: java.lang.NullPointerException
| 08:56:30,281 INFO [STDOUT] at org.jboss.ejb3.EJBContextFactory.getObjectInstance(EJBContextFactory.java:57)
| 08:56:30,281 INFO [STDOUT] at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
| 08:56:30,281 INFO [STDOUT] at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1438)
| 08:56:30,281 INFO [STDOUT] at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1455)
| 08:56:30,281 INFO [STDOUT] ... 46 more
| 08:56:30,874 INFO [STDOUT] javax.naming.NamingException: Could not dereference object [Root exception is java.lang.NullPointerException]
| 08:56:30,874 INFO [STDOUT] at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1463)
| 08:56:30,874 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:809)
| 08:56:30,874 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:820)
| 08:56:30,874 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:673)
| 08:56:31,281 INFO [STDOUT] at javax.naming.InitialContext.lookup(InitialContext.java:392)
| 08:56:31,281 INFO [STDOUT] at de.test.riedel.ejb.service.GetUserName.getUserName(GetUserName.java:28)
| 08:56:31,281 INFO [STDOUT] at de.test.riedel.ejb.revision.RevisionListener.newRevision(RevisionListener.java:22)
| 08:56:31,281 INFO [STDOUT] at org.jboss.envers.revisioninfo.DefaultRevisionInfoGenerator.newRevision(DefaultRevisionInfoGenerator.java:73)
| 08:56:31,281 INFO [STDOUT] at org.jboss.envers.revisioninfo.DefaultRevisionInfoGenerator.generate(DefaultRevisionInfoGenerator.java:80)
| 08:56:31,281 INFO [STDOUT] at org.jboss.envers.synchronization.VersionsSync.executeInSession(VersionsSync.java:109)
| 08:56:31,281 INFO [STDOUT] at org.jboss.envers.synchronization.VersionsSync.beforeCompletion(VersionsSync.java:144)
| 08:56:31,281 INFO [STDOUT] at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:101)
| 08:56:31,281 INFO [STDOUT] at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:263)
| 08:56:31,281 INFO [STDOUT] at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:86)
| 08:56:31,281 INFO [STDOUT] at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
| 08:56:31,281 INFO [STDOUT] at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1414)
| 08:56:31,281 INFO [STDOUT] at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
| 08:56:31,281 INFO [STDOUT] at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
| 08:56:31,281 INFO [STDOUT] at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:170)
| 08:56:31,281 INFO [STDOUT] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
| 08:56:31,281 INFO [STDOUT] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)
| 08:56:31,281 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| 08:56:31,281 INFO [STDOUT] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
| 08:56:31,281 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| 08:56:31,281 INFO [STDOUT] at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
| 08:56:31,281 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| 08:56:31,281 INFO [STDOUT] at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorv2.invoke(RoleBasedAuthorizationInterceptorv2.java:201)
| 08:56:31,281 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| 08:56:31,281 INFO [STDOUT] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:159)
| 08:56:31,281 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| 08:56:31,281 INFO [STDOUT] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
| 08:56:31,281 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| 08:56:31,281 INFO [STDOUT] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| 08:56:31,281 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| 08:56:31,281 INFO [STDOUT] at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:65)
| 08:56:31,281 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| 08:56:31,281 INFO [STDOUT] at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
| 08:56:31,281 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| 08:56:31,281 INFO [STDOUT] at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:486)
| 08:56:31,281 INFO [STDOUT] at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:56)
| 08:56:31,281 INFO [STDOUT] at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
| 08:56:31,281 INFO [STDOUT] at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| 08:56:31,281 INFO [STDOUT] at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:908)
| 08:56:31,281 INFO [STDOUT] at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:742)
| 08:56:31,281 INFO [STDOUT] at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:695)
| 08:56:31,281 INFO [STDOUT] at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:522)
| 08:56:31,281 INFO [STDOUT] at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:230)
| 08:56:31,281 INFO [STDOUT] Caused by: java.lang.NullPointerException
| 08:56:31,281 INFO [STDOUT] at org.jboss.ejb3.EJBContextFactory.getObjectInstance(EJBContextFactory.java:57)
| 08:56:31,281 INFO [STDOUT] at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
| 08:56:31,281 INFO [STDOUT] at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1438)
| 08:56:31,281 INFO [STDOUT] at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1455)
| 08:56:31,281 INFO [STDOUT] ... 46 more
|
What's wrong?
Thanks for help.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4212518#4212518
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4212518
More information about the jboss-user
mailing list