Can't inject dependencies to JSF bean with eager=true (Websphere, Myfaces) - java

I have a simple eager application scoped JSF bean:
#ManagedBean(eager = true, name = "SetupBean")
#ApplicationScoped
public class SetupBean {
#ManagedProperty(value = "#{myBean}")
private MyBean myBean;
public void setMyBean(final MyBean myBean) {
this.myBean = myBean;
}
#PostConstruct
public void postConstruct() {
System.err.println("I'm here!");
}
}
While the #ManagedProperty line is commented out (no dependecy injection) everything works "OK" (with the exception, I can't do anything useful in that bean).
However, after uncommenting I get the error:
java.lang.UnsupportedOperationException: This method is not supported during startup
Unfortunatelly, I can't find any useful information WHAT method is not supported during the startup. I know only that there's something wrong with dependency injection. The MyBean is nothing special, it's Application Scoped, it has no dependency, it has only some private properties, that need to be configured per application (the bean is in shared library).
Here's the full stack trace:
java.lang.UnsupportedOperationException: This method is not supported
during startup at
org.apache.myfaces.context.servlet.StartupServletExternalContextImpl.getRequestMap(StartupServletExternalContextImpl.java:149)
at
org.apache.myfaces.config.ManagedBeanBuilder.getScope(ManagedBeanBuilder.java:540)
at
org.apache.myfaces.config.ManagedBeanBuilder.getNarrowestScope(ManagedBeanBuilder.java:462)
at
org.apache.myfaces.config.ManagedBeanBuilder.isInValidScope(ManagedBeanBuilder.java:433)
at
org.apache.myfaces.config.ManagedBeanBuilder.initializeProperties(ManagedBeanBuilder.java:322)
at
org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:169)
at
org.apache.myfaces.webapp.AbstractFacesInitializer._createEagerBeans(AbstractFacesInitializer.java:235)
at
org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:152)
at
org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:111)
at
com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1678)
at
com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:414)
at
com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at
com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
at
com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
at
com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
at
com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
at
com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
at
com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1173)
at
com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)
at
com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
at
com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
at
com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:772)
at
com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1367)
at
com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2172)
at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:445)
at
com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:388)
at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:116)
at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl$1.run(CompositionUnitMgrImpl.java:663)
at
com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5459)
at
com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5585)
at
com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:677)
at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:621)
at
com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1259)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611) at
sun.reflect.misc.Trampoline.invoke(MethodUtil.java:49) at
sun.reflect.GeneratedMethodAccessor66.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611) at
sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:256) at
javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1148)
at
java.security.AccessController.doPrivileged(AccessController.java:252)
at
com.ibm.oti.security.CheckedAccessControlContext.securityCheck(CheckedAccessControlContext.java:30)
at
sun.misc.JavaSecurityAccessWrapper.doIntersectionPrivilege(JavaSecurityAccessWrapper.java:41)
at
javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1142)
at
javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:995)
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:848)
at
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:774)
at
com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335)
at
com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at
com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228)
at
com.ibm.ws.management.application.sync.StartDeploymentTask.startDeployment(StartDeploymentTask.java:247)
at
com.ibm.ws.management.application.sync.StartDeploymentTask.fullAppUpdate(StartDeploymentTask.java:119)
at
com.ibm.ws.management.application.sync.StartDeploymentTask.performTask(StartDeploymentTask.java:107)
at
com.ibm.ws.management.application.sync.AppBinaryProcessor$ExpandApp.expand(AppBinaryProcessor.java:1709)
at
com.ibm.ws.management.application.sync.AppBinaryProcessor.postProcessSynchronousExt(AppBinaryProcessor.java:749)
at
com.ibm.ws.management.bla.sync.BLABinaryProcessor.postProcess(BLABinaryProcessor.java:590)
at
com.ibm.ws.management.bla.sync.BLABinaryProcessor.onChangeCompletion(BLABinaryProcessor.java:467)
at
com.ibm.ws.management.bla.sync.BinaryProcessorWrapper.onChangeCompletion(BinaryProcessorWrapper.java:109)
at
com.ibm.ws.management.repository.FileRepository.postNotify(FileRepository.java:1924)
at
com.ibm.ws.management.repository.FileRepository.update(FileRepository.java:1433)
at
com.ibm.ws.management.repository.client.LocalConfigRepositoryClient.update(LocalConfigRepositoryClient.java:189)
at
com.ibm.ws.sm.workspace.impl.WorkSpaceMasterRepositoryAdapter.update(WorkSpaceMasterRepositoryAdapter.java:665)
at
com.ibm.ws.sm.workspace.impl.RepositoryContextImpl.update(RepositoryContextImpl.java:1998)
at
com.ibm.ws.sm.workspace.impl.RepositoryContextImpl.synch(RepositoryContextImpl.java:1946)
at
com.ibm.ws.sm.workspace.impl.WorkSpaceImpl.synch(WorkSpaceImpl.java:549)
at
com.ibm.ws.management.configservice.ConfigServiceImpl.save(ConfigServiceImpl.java:719)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611) at
sun.reflect.misc.Trampoline.invoke(MethodUtil.java:49) at
sun.reflect.GeneratedMethodAccessor66.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611) at
sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:256) at
javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1148)
at
java.security.AccessController.doPrivileged(AccessController.java:252)
at
com.ibm.oti.security.CheckedAccessControlContext.securityCheck(CheckedAccessControlContext.java:30)
at
sun.misc.JavaSecurityAccessWrapper.doIntersectionPrivilege(JavaSecurityAccessWrapper.java:41)
at
javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1142)
at
javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:995)
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:848)
at
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:774)
at
com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335)
at
com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at
com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228)
at
com.ibm.ws.management.remote.AdminServiceForwarder.invoke(AdminServiceForwarder.java:346)
at
javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1465)
at
javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:85)
at
javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1306)
at
javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1398)
at
javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
at
javax.management.remote.rmi._RMIConnectionImpl_Tie.invoke(_RMIConnectionImpl_Tie.java:751)
at
javax.management.remote.rmi._RMIConnectionImpl_Tie._invoke(_RMIConnectionImpl_Tie.java:158)
at
com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:669)
at
com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:523)
at com.ibm.rmi.iiop.ORB.process(ORB.java:523) at
com.ibm.CORBA.iiop.ORB.process(ORB.java:1575) at
com.ibm.rmi.iiop.Connection.doRequestWork(Connection.java:3039) at
com.ibm.rmi.iiop.Connection.doWork(Connection.java:2922) at
com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:64) at
com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:118) at
com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1815)
The running configuration: WebSphere 8.5 with MyFaces 2.0.2 (IBM custom version).
What does that error mean? What need to be done in order to get the dependency injection work?

Info, http://docs.oracle.com/javaee/6/api/javax/faces/bean/ManagedBean.html
Eager with application. Forces it to load first. Remove eager, seems others have similar bugs Eager ApplicationScoped managed beans constructed multiple times
There are duplicate packages for the some annotations. Cam u chec. They are right

Related

Method of local ejb threw exception

We are migrating our java applications from WAS 7 to WAS 8.5. After logging into one of our application we are calling a local ejb method from controller to get details for an id. The method gets called,it queries the data, but when returning to controller it errors out giving, Method of local EJB threw exception. Would be great if someone could shed some light on the issue. I have checked multiple forums, but couldn't get a proper explanation. Below is the stack trace.
I've mentioned some places as "package name" as it cannot be shared.
javax.ejb.TransactionRolledbackLocalException: ; nested exception is: javax.transaction.SystemException
at com.ibm.tx.jta.impl.TransactionImpl.stage3CommitProcessing(TransactionImpl.java:1251)
at com.ibm.tx.jta.impl.TransactionImpl.processCommit(TransactionImpl.java:1042)
at com.ibm.tx.jta.impl.TransactionImpl.commit(TransactionImpl.java:963)
at com.ibm.ws.tx.jta.TranManagerImpl.commit(TranManagerImpl.java:439)
at com.ibm.tx.jta.impl.TranManagerSet.commit(TranManagerSet.java:191)
at com.ibm.ejs.csi.TranStrategy.commit(TranStrategy.java:949)
at com.ibm.ejs.csi.TranStrategy.postInvoke(TranStrategy.java:262)
at com.ibm.ejs.csi.RequiresNew.postInvoke(RequiresNew.java:154)
at com.ibm.ejs.csi.TransactionControlImpl.postInvoke(TransactionControlImpl.java:567)
at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:4491)
at <package name>EJSLocalStatelessInvestigationProcessingService_8d39cc4e.epGetDetailsForInvestigationProcessing(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
at java.lang.reflect.Method.invoke(Method.java:620)
at org.springframework.ejb.access.LocalSlsbInvokerInterceptor.invokeInContext(LocalSlsbInvokerInterceptor.java:70)
at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.invoke(AbstractSlsbInvokerInterceptor.java:188)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy28.epGetDetailsForInvestigationProcessing(Unknown Source)
at <package name>.processGetRequest(MaintainInvestigationController.java:286)
at com.pmigroup.jpmiframework.web.mvc.controller.ApplMultiActionFormController.showForm(ApplMultiActionFormController.java:269)
at org.springframework.web.servlet.mvc.AbstractFormController.showNewForm(AbstractFormController.java:338)
at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:278)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
The caused by trace is as follows.
Caused by: javax.ejb.TransactionRolledbackLocalException: ; nested exception is: javax.transaction.SystemException
at com.ibm.tx.jta.impl.TransactionImpl.stage3CommitProcessing(TransactionImpl.java:1251)
at com.ibm.tx.jta.impl.TransactionImpl.processCommit(TransactionImpl.java:1042)
at com.ibm.tx.jta.impl.TransactionImpl.commit(TransactionImpl.java:963)
at com.ibm.ws.tx.jta.TranManagerImpl.commit(TranManagerImpl.java:439)
at com.ibm.tx.jta.impl.TranManagerSet.commit(TranManagerSet.java:191)
at com.ibm.ejs.csi.TranStrategy.commit(TranStrategy.java:949)
at com.ibm.ejs.csi.TranStrategy.postInvoke(TranStrategy.java:262)
at com.ibm.ejs.csi.RequiresNew.postInvoke(RequiresNew.java:154)
at com.ibm.ejs.csi.TransactionControlImpl.postInvoke(TransactionControlImpl.java:567)
at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:4491)
at <package_name>EJSLocalStatelessInvestigationProcessingService_8d39cc4e.epGetDetailsForInvestigationProcessing(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
at java.lang.reflect.Method.invoke(Method.java:620)
at org.springframework.ejb.access.LocalSlsbInvokerInterceptor.invokeInContext(LocalSlsbInvokerInterceptor.java:70)
at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.invoke(AbstractSlsbInvokerInterceptor.java:188)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy28.epGetDetailsForInvestigationProcessing(Unknown Source)
at <package_name>.processGetRequest(MaintainInvestigationController.java:286)
at <package_name>.showForm(ApplMultiActionFormController.java:269)

java.lang.NoClassDefFoundError: during deployment on web sphere WAS 8.5

I am getting java.lang.NoClassDefFoundError error during my deployment on WAS 8.5.I have included the icu4j jar but still I am getting below error .I have put the jar in lib folder.Could you please advise.
[2/4/16 15:41:49:952 GMT] 00000054 webapp E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E: Exception caught while initializing context: {0}
java.lang.NoClassDefFoundError: com.vertexinc.tps.xml.calc.parsegenerate.builder.NonSpecificTransactionBuilder (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:175)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:250)
at com.vertexinc.tps.xml.calc.parsegenerate.builder.BuilderRegistration.register(BuilderRegistration.java:33)
at com.vertexinc.tps.xml.calc.service.XmlTaxCalculator.init(XmlTaxCalculator.java:76)
at com.ford.finance.taxconnector.engine.VertexTaxEngine.initVertex(VertexTaxEngine.java:103)
at com.ford.finance.taxconnector.engine.VertexTaxEngine.<init>(VertexTaxEngine.java:77)
at com.ford.finance.taxconnector.engine.VertexTaxEngine.initialize(VertexTaxEngine.java:51)
at com.ford.finance.taxconnector.config.Config.init(Config.java:154)
at com.ford.finance.taxconnector.config.Config.getInstance(Config.java:83)
at com.ford.finance.taxconnector.TaxConnectorStartupListener.contextInitialized(TaxConnectorStartupListener.java:51)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1689)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:410)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:422)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:714)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1167)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:773)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1369)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2170)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:435)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:378)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:126)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$1.run(CompositionUnitMgrImpl.java:653)
at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5471)
at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5597)
at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:667)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:611)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1259)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:69)
at sun.reflect.GeneratedMethodAccessor120.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:272)
at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1152)
at java.security.AccessController.doPrivileged(AccessController.java:388)
at com.ibm.oti.security.CheckedAccessControlContext.securityCheck(CheckedAccessControlContext.java:30)
at sun.misc.JavaSecurityAccessWrapper.doIntersectionPrivilege(JavaSecurityAccessWrapper.java:41)
at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1146)
at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:999)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:847)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:783)
at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1350)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1243)
at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181)
at com.ibm.ws.management.connector.ipc.CallRouter.route(CallRouter.java:247)
at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink.doWork(IPCConnectorInboundLink.java:360)
at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink$IPCConnectorReadCallback.complete(IPCConnectorInboundLink.java:602)
at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$QueuedWork.run(SSLReadServiceContext.java:1981)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1720)
Caused by: java.lang.NoClassDefFoundError: com.ibm.icu.text.Normalizer
at com.vertexinc.util.unicode.Normalizer.normalize(Normalizer.java:26)
at com.vertexinc.util.config.SysConfig.getEnv(SysConfig.java:744)
at com.vertexinc.tps.common.domain.CalcEnv.loadConfig(CalcEnv.java:84)
at com.vertexinc.tps.common.domain.CalcEnv.<init>(CalcEnv.java:73)
at com.vertexinc.tps.common.domain.CalcEnvManager.createService(CalcEnvManager.java:32)
at com.vertexinc.tps.common.domain.CalcEnvManager.getService(CalcEnvManager.java:22)
at com.vertexinc.tps.common.calc.app.direct.CalcEngine.isDefaultAutoCommit(CalcEngine.java:1110)
at com.vertexinc.tps.common.calc.app.direct.TransactionFactory.<init>(TransactionFactory.java:96)
at com.vertexinc.tps.common.calc.app.direct.CalcEngine.createTransactionFactory(CalcEngine.java:506)
at com.vertexinc.tps.xml.calc.parsegenerate.builder.CreateUtil.getTransactionFactory(CreateUtil.java:35)
at com.vertexinc.tps.xml.calc.parsegenerate.builder.CreateUtil.createTransaction(CreateUtil.java:40)
at com.vertexinc.tps.xml.calc.parsegenerate.builder.NonSpecificTransactionBuilder.<clinit>(NonSpecificTransactionBuilder.java:40)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:235)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:250)
at com.vertexinc.tps.xml.calc.parsegenerate.builder.BuilderRegistration.register(BuilderRegistration.java:33)
at com.vertexinc.tps.xml.calc.service.XmlTaxCalculator.init(XmlTaxCalculator.java:76)
at com.ford.finance.taxconnector.engine.VertexTaxEngine.initVertex(VertexTaxEngine.java:103)
at com.ford.finance.taxconnector.engine.VertexTaxEngine.<init>(VertexTaxEngine.java:77)
at com.ford.finance.taxconnector.engine.VertexTaxEngine.initialize(VertexTaxEngine.java:51)
at com.ford.finance.taxconnector.config.Config.init(Config.java:154)
at com.ford.finance.taxconnector.config.Config.getInstance(Config.java:83)
at com.ford.finance.taxconnector.TaxConnectorStartupListener.contextInitialized(TaxConnectorStartupListener.java:51)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1689)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:410)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
What version are you attempting to use? It's very likely you're hitting a library conflict with open source software packages as described here and here. Of particular interest is either crafting an isolated shared library or using the Always-Protected Packages function to hide the com.ibm.icu packages from the JavaEE application.
Application Server 8.5 includes ICU version 4.4.2 as described in the MANIFEST.MF of WAS_HOME/plugins/com.ibm.icu.jar.

Exception on job execution (Websphere)

I am getting the following exception when I try to execute a query by the entity manager with jpa.
it seems I am with a jta configuration problem, but I am not sure.
I am using quartz with a java ee 5 application and I running in a webpshere server.
E org.hibernate.ejb.AbstractEntityManagerImpl handlePersistenceException Unable to mark for rollback on PersistenceException:
org.hibernate.HibernateException: javax.naming.ConfigurationException: A JNDI operation on a "java:" name cannot be completed because the server runtime is not able to associate the operation's thread with any J2EE application component.
This condition can occur when the JNDI client using the "java:" name is not executed on the thread of a server application request. Make sure that a J2EE application does not execute JNDI operations on "java:" names within static code blocks or in threads created by that J2EE application. Such code does not necessarily run on the thread of a server application request and therefore is not supported by JNDI operations on "java:" names. [Root exception is javax.naming.NameNotFoundException: Name comp/websphere not found in context "java:".]
at
org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter$TransactionAdapter.<init>(WebSphereExtendedJTATransactionLookup.java:188)
at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter$TransactionAdapter.<init>(WebSphereExtendedJTATransactionLookup.java:178)
at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter.getTransaction(WebSphereExtendedJTATransactionLookup.java:140)
at org.hibernate.ejb.transaction.JoinableCMTTransaction.isTransactionInProgress(JoinableCMTTransaction.java:64)
at org.hibernate.ejb.transaction.JoinableCMTTransaction.tryJoiningTransaction(JoinableCMTTransaction.java:78)
at org.hibernate.ejb.transaction.JoinableCMTTransactionFactory.isTransactionInProgress(JoinableCMTTransactionFactory.java:51)
at org.hibernate.jdbc.JDBCContext.isTransactionInProgress(JDBCContext.java:235)
at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:200)
at org.hibernate.impl.SessionImpl.checkTransactionSynchStatus(SessionImpl.java:2112)
at org.hibernate.impl.SessionImpl.getSessionFactory(SessionImpl.java:1853)
at org.hibernate.ejb.AbstractEntityManagerImpl.markAsRollback(AbstractEntityManagerImpl.java:1123)
at org.hibernate.ejb.AbstractEntityManagerImpl.handlePersistenceException(AbstractEntityManagerImpl.java:1296)
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1390)
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1317)
at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:1252)
at org.hibernate.ejb.AbstractEntityManagerImpl.postInit(AbstractEntityManagerImpl.java:168)
at org.hibernate.ejb.EntityManagerImpl.<init>(EntityManagerImpl.java:84)
at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:112)
at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:388)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:541)
at com.sun.proxy.$Proxy521.createEntityManager(Unknown Source)
at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:285)
at com.sun.proxy.$Proxy524.createQuery(Unknown Source)
at br.com.vr.platpedidos.infrastructure.pedido.persistence.PedidoORMRepositoryImpl.buscarReferencia(PedidoORMRepositoryImpl.java:44)
at br.com.vr.platpedidos.application.pedido.repository.PedidoRepositoryImpl.buscarModalidadeProdutoDoPedido(PedidoRepositoryImpl.java:29)
at br.com.vr.platpedidos.application.pedido.services.PedidoApplicationServiceImpl.obterModalidadeDeProdutoDoPedido(PedidoApplicationServiceImpl.java:42)
at br.com.vr.platpedidos.application.facade.PlatpedidosFacadeImpl.obterModalidadeDeProduto(PlatpedidosFacadeImpl.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
at br.com.vr.platpedidos.infrastructure.exception.ExceptionLoggingAspect.logException(ExceptionLoggingAspect.java:14)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy540.obterModalidadeDeProduto(Unknown Source)
at br.com.vr.platpedidos.orquestracao.infrastructure.PlataformaDePedidosGateway.obterModalidadeDeProduto(PlataformaDePedidosGateway.java:60)
at br.com.vr.platpedidos.orquestracao.application.OrquestracaoApplicationServiceImpl.importarArquivosDePedido(OrquestracaoApplicationServiceImpl.java:40)
at br.com.vr.platpedidos.orquestracao.facade.OrquestracaoFacadeImpl.importarArquivosDePedido(OrquestracaoFacadeImpl.java:16)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:257)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
I've just found the answer in the following post:
http://gybas.com/2014/quartz-websphere-spring/
You have detailed answer in the error message and the stack trace:
ConfigurationException: A JNDI operation on a "java:" name cannot be
completed because the server runtime is not able to associate the
operation's thread with any J2EE application component. This
condition can occur when the JNDI client using the "java:" name is not
executed on the thread of a server application request.
And below:
org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Either replace quartz with for example ejbTimers or managedThreads if you are on WebSphere Liberty, or change the JNDI to global name.
Using quartz is not recommended in Java EE applications, since it creates unmanaged threads.

Upgrade to Spring 3.2 on Websphere 8.5 error: Resource annotations on DispatcherServlet will be ignored

I've tried to upgrade Spring version from 3.1.2 to 3.2.8 on the WebSphere 8.5, but I've got the error:
CWNEN0047W: Resource annotations on the fields of the
org.springframework.web.servlet.DispatcherServlet class will be
ignored. The annotations could not be obtained because of the
exception : java.lang.NoClassDefFoundError:
org.springframework.web.context.WebApplicationContext
The jar spring-web-3.2.8.RELEASE.jar is present in the WAR/WEB-INF/lib directory. The archive is not damaged, the WebApplicationContext class is present there. Everything looks like before, only the spring version is higher.
Everything is working with Spring 3.1.2 with the same maven build configuration and EAR descriptors! But after changing Spring version (and nothing more), the mentioned error occurs.
Is there anything special that must be done when upgrading Spring version on Websphere? Or it's just a kind of incompatibility?
That call comes somewhere from JmxMBeanServer. It comes in the web application initialization phase, when the EAR is deployed/updated from IBM RAD. Full stack trace included:
[5/8/14 10:12:42:866 CEST] 0000004b InjectionProc W CWNEN0047W:
Resource annotations on the fields of the
org.springframework.web.servlet.DispatcherServlet class will be
ignored. The annotations could not be obtained because of the
exception : java.lang.NoClassDefFoundError:
org.springframework.web.context.WebApplicationContext at
java.lang.J9VMInternals.verifyImpl(Native Method) at
java.lang.J9VMInternals.verify(J9VMInternals.java:93) at
java.lang.J9VMInternals.verify(J9VMInternals.java:91) at
java.lang.J9VMInternals.prepare(J9VMInternals.java:490) at
java.lang.Class.getDeclaredFields(Class.java:605) at
com.ibm.wsspi.injectionengine.InjectionProcessor.getAllDeclaredFields(InjectionProcessor.java:554)
at
com.ibm.wsspi.injectionengine.InjectionProcessor.processAllAnnotations(InjectionProcessor.java:722)
at
com.ibm.wsspi.injectionengine.InjectionProcessorContextImpl.processAllAnnotations(InjectionProcessorContextImpl.java:50)
at
com.ibm.ws.injectionengine.AbstractInjectionEngine.processAnnotations(AbstractInjectionEngine.java:750)
at
com.ibm.ws.injectionengine.AbstractInjectionEngine.processInjectionMetaData(AbstractInjectionEngine.java:559)
at
com.ibm.ws.injectionengine.SharedInjectionEngineImpl.processInjectionMetaData(SharedInjectionEngineImpl.java:208)
at
com.ibm.ws.injectionengine.ReferenceContextImpl.process(ReferenceContextImpl.java:838)
at
com.ibm.ws.webcontainer.webapp.WebAppImpl.populateJavaNameSpace(WebAppImpl.java:1112)
at
com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:328)
at
com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at
com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
at
com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
at
com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
at
com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
at
com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
at
com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1173)
at
com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)
at
com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
at
com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
at
com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:772)
at
com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1367)
at
com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2172)
at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:445)
at
com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:388)
at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:116)
at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl$1.run(CompositionUnitMgrImpl.java:663)
at
com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5459)
at
com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5585)
at
com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:677)
at
com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:621)
at
com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1259)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611) at
sun.reflect.misc.Trampoline.invoke(MethodUtil.java:49) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611) at
sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:256) at
javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1148)
at
java.security.AccessController.doPrivileged(AccessController.java:252)
at
com.ibm.oti.security.CheckedAccessControlContext.securityCheck(CheckedAccessControlContext.java:30)
at
sun.misc.JavaSecurityAccessWrapper.doIntersectionPrivilege(JavaSecurityAccessWrapper.java:41)
at
javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1142)
at
javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:995)
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:848)
at
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:774)
at
com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1335)
at
com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at
com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1228)
at
com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181)
at
com.ibm.ws.management.connector.ipc.CallRouter.route(CallRouter.java:247)
at
com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink.doWork(IPCConnectorInboundLink.java:360)
at
com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink$IPCConnectorReadCallback.complete(IPCConnectorInboundLink.java:602)
at
com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1784)
at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) at
com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) at
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) at
com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1815) Caused by:
java.lang.ClassNotFoundException:
org.springframework.web.context.WebApplicationContext at
java.net.URLClassLoader.findClass(URLClassLoader.java:434) at
com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:204)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:688) at
java.lang.ClassLoader.loadClass(ClassLoader.java:667) at
com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:119)
at java.lang.ClassLoader.loadClass(ClassLoader.java:650) at
com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
at
com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
at
com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584)
at java.lang.ClassLoader.loadClass(ClassLoader.java:650) at
com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584)
at java.lang.ClassLoader.loadClass(ClassLoader.java:650) at
com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584)
at java.lang.ClassLoader.loadClass(ClassLoader.java:650) ... 72 more
As the stacktrace says:
The annotations could not be obtained because of the exception : java.lang.NoClassDefFoundError: org.springframework.web.context.WebApplicationContext
Your spring-web-xyz.jar is not loaded. Make sure it is located in the classpath, i.e. using the admin app. It should be here somewhere: Servers -> ApplicationServers -> Servername -> Process Definition -> Java Virtual Machine.

JSF 2.1 Spring Session Scope

I have the following confguration in my JSF Spring application:
<bean id="userSessionBean" class="com.vanilla.beans.UserSessionBean" scope="session">
<aop:scoped-proxy/>
</bean>
Then I ha have Spring bean
#Service("userService")
public class UserServiceImpl implements UserService,Serializable{
#Autowired
private UserSessionBean userSessionBean;
public String getCurrentUser(){
return this.userSessionBean.getUserName;
}
}
Now I have my managed bean:
#ManagedBean(name="userBean")
#RequestScoped
public class UserBean {
#ManagedProperty(value="#{userService}")
UserService userService;
public Sttring getUserName(){
return userService.getCurrentUser();
}
}
then I have xhtml
<h:outputText value="#{userBeanBean.userName}" />
All my flow works fine, but when my session expires I'm getting the following error and I'm clicking on refresh I have the following stacktrace:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.userSessionBean': Scope 'session' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: Cannot create a session after the response has been committed
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:339)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:33)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.getTarget(Cglib2AopProxy.java:653)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:604)
at com.vanilla.beans.UserSessionBean$$EnhancerByCGLIB$$fe05fe49.getCurrentMokdanName(<generated>)
at com.vanilla.bl.UserServiceImpl.getCurrentUser(UserServiceImpl.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy18.getCurrentMokedUser(Unknown Source)
at com.ewave.upromotions.beans.MokedBean.getMokedName(MokedBean.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:83)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at org.apache.el.parser.AstValue.getValue(AstValue.java:123)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
... 43 more
Caused by: java.lang.IllegalStateException: Cannot create a session after the response has been committed
at org.apache.catalina.connector.Request.doGetSession(Request.java:2400)
at org.apache.catalina.connector.Request.getSession(Request.java:2120)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833)
at org.springframework.web.context.request.ServletRequestAttributes.getSession(ServletRequestAttributes.java:79)
at org.springframework.web.context.request.ServletRequestAttributes.getSessionMutex(ServletRequestAttributes.java:211)
at org.springframework.web.context.request.SessionScope.get(SessionScope.java:90)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
... 73 more
Can I solve it somehow?
Please add this:
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
To your web.xml
If that will not help please add more info about your web.xml and jsf config.

Categories

Resources