-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
None
-
None
If a singleton session bean throws an application exception in a method annotated with @PostConstruct the application exception is not visible in the log. The exceptiona that are thrown are a java.lang.RuntimeException and a java.lang.NullPointerException instead of the application exception.
A simple singleton session bean to replicate the bug:
import javax.annotation.PostConstruct; import javax.ejb.Singleton; import javax.ejb.Startup; @Startup @Singleton public class TestSingletonBean { @PostConstruct public void init() throws Exception { throw new Exception("Where did I go?"); } }
The exception from server.log:
11.01 03:04:13,853 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (WorkerThread#0[144.202.230.44:53189]:) Error installing to Start: name=startup-singleton-initiator:topLevelUnit=test.war,unit=test.war,bean=InitializerServiceBean aliases=[startup-singleton-initiator:bean=InitializerServiceBean,topLevelUnit=test.war,unit=test.war] state=Create: java.lang.RuntimeException: Could not invoke PostConstruct on the newly created bean instance at org.jboss.ejb3.singleton.impl.container.SingletonEJBInstanceManagerImpl.create(SingletonEJBInstanceManagerImpl.java:137) at org.jboss.ejb3.singleton.impl.container.SingletonEJBInstanceManagerImpl.get(SingletonEJBInstanceManagerImpl.java:152) at org.jboss.ejb3.singleton.deployer.StartupSingletonInitiator.start(StartupSingletonInitiator.java:84) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:60) at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:168) at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:257) at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:125) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:72) at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:202) at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:894) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:641) at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:103) at org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar.install(Ejb3McRegistrar.java:394) at org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar.bind(Ejb3McRegistrar.java:245) at org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase.registerProxyFactory(JndiSessionRegistrarBase.java:1169) at org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase.createJndiReferenceBindingSet(JndiSessionRegistrarBase.java:510) at org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase.bindEjb(JndiSessionRegistrarBase.java:156) at org.jboss.ejb3.session.SessionContainer.lockedStart(SessionContainer.java:223) at org.jboss.ejb3.session.SessionSpecContainer.lockedStart(SessionSpecContainer.java:735) at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:1105) at sun.reflect.GeneratedMethodAccessor449.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:60) at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:168) at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:257) at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:125) at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:72) at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:202) at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) at org.jboss.deployers.plugins.deployers.DeployersImpl.change(DeployersImpl.java:1983) at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:1076) at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:679) at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.process(MainDeployerPlugin.java:106) at org.jboss.profileservice.dependency.ProfileControllerContext$DelegateDeployer.process(ProfileControllerContext.java:143) at org.jboss.profileservice.plugins.deploy.actions.DeploymentStartAction.doPrepare(DeploymentStartAction.java:98) at org.jboss.profileservice.management.actions.AbstractTwoPhaseModificationAction.prepare(AbstractTwoPhaseModificationAction.java:101) at org.jboss.profileservice.management.ModificationSession.prepare(ModificationSession.java:87) at org.jboss.profileservice.management.AbstractActionController.internalPerfom(AbstractActionController.java:234) at org.jboss.profileservice.management.AbstractActionController.performWrite(AbstractActionController.java:213) at org.jboss.profileservice.management.AbstractActionController.perform(AbstractActionController.java:150) at org.jboss.profileservice.plugins.deploy.AbstractDeployHandler.startDeployments(AbstractDeployHandler.java:168) at org.jboss.profileservice.management.upload.remoting.DeployHandlerDelegate.startDeployments(DeployHandlerDelegate.java:74) at org.jboss.profileservice.management.upload.remoting.DeployHandler.invoke(DeployHandler.java:156) at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:967) at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:791) at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:744) at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:548) at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234) Caused by: java.lang.RuntimeException: java.lang.NullPointerException at org.jboss.ejb3.singleton.aop.impl.AOPBasedSingletonContainer.invokeCallback(AOPBasedSingletonContainer.java:1065) at org.jboss.ejb3.EJBContainer.invokePostConstruct(EJBContainer.java:1396) at org.jboss.ejb3.singleton.aop.impl.AOPBasedSingletonContainer.postConstruct(AOPBasedSingletonContainer.java:762) at org.jboss.ejb3.singleton.impl.container.SingletonEJBInstanceManagerImpl.create(SingletonEJBInstanceManagerImpl.java:133) ... 79 more Caused by: java.lang.NullPointerException at org.jboss.ejb3.EJBContainer.getApplicationException(EJBContainer.java:509) at org.jboss.ejb3.singleton.aop.impl.ConstructionInvocationContextAdapter.getApplicationException(ConstructionInvocationContextAdapter.java:62) at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:163) at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:251) at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:392) at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invoke(CMTTxInterceptor.java:211) at org.jboss.ejb3.tx2.aop.CMTTxInterceptorWrapper.invoke(CMTTxInterceptorWrapper.java:52) at org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:80) at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) at org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:80) at org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47) at org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:80) at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:90) at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_259085584.invoke(InvocationContextInterceptor_z_setup_259085584.java) at org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:80) at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67) at org.jboss.aop.joinpoint.ConstructionInvocation.invokeNext(ConstructionInvocation.java:80) at org.jboss.ejb3.singleton.aop.impl.AOPBasedSingletonContainer.invokeCallback(AOPBasedSingletonContainer.java:1061) ... 82 more 11.01 03:04:13,868 INFO [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (WorkerThread#0[144.202.230.44:53189]:) deploy, ctxPath=/test 11.01 03:04:14,060 INFO [org.jboss.resteasy.cdi.CdiInjectorFactory] (WorkerThread#0[144.202.230.44:53189]:) Found BeanManager at java:comp/BeanManager 11.01 03:04:14,159 INFO [org.jboss.resteasy.spi.ResteasyDeployment] (WorkerThread#0[144.202.230.44:53189]:) Deploying javax.ws.rs.core.Application: class com.ecolane.mpk.rest.RestApplication$Proxy$_$$_WeldClientProxy 11.01 03:04:14,195 INFO [org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase] (WorkerThread#0[144.202.230.44:53189]:) Binding the following Entries in Global JNDI: CallOutSenderBean/local - EJB3.x Default Local Business Interface CallOutSenderBean/local-com.ecolane.mpk.scheduler.interfaces.CallOutSenderLocal - EJB3.x Local Business Interface 11.01 03:04:14,195 WARN [org.jboss.ejb3.TimerServiceContainer] (WorkerThread#0[144.202.230.44:53189]:) EJBTHREE-2193: using deprecated TimerServiceFactory for restoring timers 11.01 03:04:14,219 WARN [org.jboss.profileservice.management.upload.remoting.DeployHandler] (WorkerThread#0[144.202.230.44:53189]:) Failed to complete command: [start] for deployment: names=[test.war]: org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): DEPLOYMENTS IN ERROR: Deployment "startup-singleton-initiator:topLevelUnit=test.war,unit=test.war,bean=InitializerServiceBean" is in error due to the following reason(s): java.lang.NullPointerException at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1370) at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1316) at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:968) at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:82) at org.jboss.profileservice.dependency.ProfileControllerContext$DelegateDeployer.checkComplete(ProfileControllerContext.java:138) at org.jboss.profileservice.plugins.deploy.actions.DeploymentStartAction.doPrepare(DeploymentStartAction.java:104) at org.jboss.profileservice.management.actions.AbstractTwoPhaseModificationAction.prepare(AbstractTwoPhaseModificationAction.java:101) at org.jboss.profileservice.management.ModificationSession.prepare(ModificationSession.java:87) at org.jboss.profileservice.management.AbstractActionController.internalPerfom(AbstractActionController.java:234) at org.jboss.profileservice.management.AbstractActionController.performWrite(AbstractActionController.java:213) at org.jboss.profileservice.management.AbstractActionController.perform(AbstractActionController.java:150) at org.jboss.profileservice.plugins.deploy.AbstractDeployHandler.startDeployments(AbstractDeployHandler.java:168) at org.jboss.profileservice.management.upload.remoting.DeployHandlerDelegate.startDeployments(DeployHandlerDelegate.java:74) at org.jboss.profileservice.management.upload.remoting.DeployHandler.invoke(DeployHandler.java:156) at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:967) at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:791) at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:744) at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:548) at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234)
- is cloned by
-
EJBTHREE-2237 Application exception lost if thrown in method annotated with @PostConstruct
- Closed