I recently migrated my application from JBoss AS 4.2.1 to JBoss AS 7.1, but I am not being able to access the application vua http request since I am getting the below error:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Unable to instantiate Action, payment.PaymentBean, defined for 'prepayment' in namespace '/payment'javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jnp.interfaces.NamingContextFactory from classloader ModuleClassLoader for Module "deployment.TPGWeb.war:main" from Service Module Loader - action - vfs:/content/TPGWeb.war/WEB-INF/classes/struts.xml:26:64
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:518)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)
root cause
Unable to instantiate Action, payment.PaymentBean, defined for 'prepayment' in namespace '/payment'javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jnp.interfaces.NamingContextFactory from classloader ModuleClassLoader for Module "deployment.TPGWeb.war:main" from Service Module Loader - action - vfs:/content/TPGWeb.war/WEB-INF/classes/struts.xml:26:64
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:289)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:360)
com.opensymphony.xwork2.DefaultActionInvocation.access$000(DefaultActionInvocation.java:38)
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:78)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:70)
com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:66)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:497)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)
root cause
java.lang.RuntimeException: javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jnp.interfaces.NamingContextFactory from classloader ModuleClassLoader for Module "deployment.TPGWeb.war:main" from Service Module Loader
utils.ResourceCenter.lookupGatewaySecurityBean(ResourceCenter.java:76)
payment.PaymentBean.<init>(PaymentBean.java:39)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:532)
java.lang.Class.newInstance0(Class.java:372)
java.lang.Class.newInstance(Class.java:325)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:121)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:152)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:141)
com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:111)
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:270)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:360)
com.opensymphony.xwork2.DefaultActionInvocation.access$000(DefaultActionInvocation.java:38)
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:78)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:70)
com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:66)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:497)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)
root cause
javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory org.jnp.interfaces.NamingContextFactory from classloader ModuleClassLoader for Module "deployment.TPGWeb.war:main" from Service Module Loader
org.jboss.as.naming.InitialContextFactoryBuilder.createInitialContextFactory(InitialContextFactoryBuilder.java:64)
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:681)
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:305)
javax.naming.InitialContext.init(InitialContext.java:240)
javax.naming.InitialContext.<init>(InitialContext.java:192)
utils.ResourceCenter.lookupGatewaySecurityBean(ResourceCenter.java:66)
payment.PaymentBean.<init>(PaymentBean.java:39)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:532)
java.lang.Class.newInstance0(Class.java:372)
java.lang.Class.newInstance(Class.java:325)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:121)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:152)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:141)
com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:111)
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:270)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:360)
com.opensymphony.xwork2.DefaultActionInvocation.access$000(DefaultActionInvocation.java:38)
com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:78)
com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:70)
com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:66)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:497)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)
note The full stack trace of the root cause is available in the JBoss Web/7.0.13.Final logs.
JBoss Web/7.0.13.Final
From post above... "Add "Dependencies: org.jboss.remote-naming" to META-INF/manifest.mf of your .WAR file."
Thanks so much for the above help. It got me a step closer to migrating to JBoss EAP 6.
An alternative to above, if you have a War file that has to be deployed on non-JBoss servers, is to add the following to the jboss-deployment-structure.xml file.
That has the benefit of separating out the JBoss specific elements to their own JBoss specific files.
regards, Owen
Add "Dependencies: org.jboss.remote-naming" to META-INF/manifest.mf of your .WAR file. This will load org.jboss.remote-naming module and eliminate "Failed instantiate InitialContextFactory" exception. Details here: https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7
use jboss-ejb-client.properties file and place it to WEB-INF folder vs content like this:
and lookup this way:
For details see: https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI
Good luck!