CreationException intermittently with Struts2 application on JBoss7.1.1 - struts2

I have an application developed in Struts2 and it is deployed on JBoss 7.1.1. We have used CDI for injecting the dependencies.
I have included below in Struts.xml: <constant name="struts.objectFactory.cdi.jndiKey" value="java:comp/some/weird/BeanManagerReference" />
Also included cdi-api-1.0-SP1.jar and struts2-cdi-plugin-2.3.4.1.jar jars along with other required jars for the application.
Intermittently I am getting the below exception and my server needs a restart to solve this.
Unable to instantiate Action, com.action.SearchAction, defined for 'searchAction' in namespace '/'null
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:316)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:397)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:194)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:553)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
root cause
javax.enterprise.inject.CreationException
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
java.lang.Class.newInstance0(Class.java:355)
java.lang.Class.newInstance(Class.java:308)
org.jboss.weld.util.reflection.SecureReflections$16.work(SecureReflections.java:343)
org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInstantiation(SecureReflectionAccess.java:173)
org.jboss.weld.util.reflection.SecureReflections.newInstance(SecureReflections.java:340)
org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:33)
org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:45)
org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:85)
org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:125)
org.jboss.weld.bean.ManagedBean.createInstance(ManagedBean.java:333)
org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.produce(ManagedBean.java:200)
org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:289)
org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:61)
org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:616)
org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:681)
org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:118)
org.jboss.weld.util.Beans.injectBoundFields(Beans.java:703)
org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:712)
org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1$1.proceed(ManagedBean.java:161)
org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1.work(ManagedBean.java:157)
org.jboss.weld.bean.ManagedBean$FixInjectionPoint.run(ManagedBean.java:131)
org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.inject(ManagedBean.java:153)
org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:290)
org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:61)
org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:616)
org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:681)
org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:118)
org.jboss.weld.util.Beans.injectBoundFields(Beans.java:703)
org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:712)
org.jboss.weld.manager.SimpleInjectionTarget$1.proceed(SimpleInjectionTarget.java:106)
org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
org.jboss.weld.manager.SimpleInjectionTarget.inject(SimpleInjectionTarget.java:102)
org.apache.struts2.cdi.CdiObjectFactory.buildBean(CdiObjectFactory.java:163)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:151)
com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:121)
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:297)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:397)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:194)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:553)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
Please let me know how to solve this.

The problem is that you're including app server provided JARs in your WAR file. Do not include the API jars for CDI, etc.

Related

After upgrading Struts to 2.5.10.1 no such method error

I upgraded the Struts jar to 2.5.10.1. But I get the following error. Initialy I had the Log4J 2.5 jar and I migrated it to Log4j 2.7.
SEVERE: Exception starting filter struts2
java.lang.NoSuchMethodError: java.util.Objects.requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
at org.apache.logging.log4j.spi.LoggerRegistry.<init>(LoggerRegistry.java:96)
at org.apache.logging.log4j.spi.LoggerRegistry.<init>(LoggerRegistry.java:92)
at org.apache.logging.log4j.simple.SimpleLoggerContext.<init>(SimpleLoggerContext.java:67)
at org.apache.logging.log4j.simple.SimpleLoggerContextFactory.<clinit>(SimpleLoggerContextFactory.java:29)
at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:122)
at org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.<clinit>(StrutsPrepareAndExecuteFilter.java:51)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:531)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:116)
following are the libraries I used in my project.
antlr-2.7.6.jar
asm-3.3.jar
asm-commons-3.3.jar
asm-tree-3.3.jar
cglib-3.2.6.jar
commons-beanutils-1.8.0.jar
commons-collections-3.2.1.jar
commons-digester-1.8.jar
commons-email-1.2.jar
commons-fileupload-1.3.2.jar
commons-io-2.4.jar
commons-lang3-3.4.jar
commons-logging-4.0.6.jar
commons-validator-1.3.1.jar
dom4j-1.6.1.jar
freemarker-2.3.23.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
hibernate3.jar
javassist-3.20.0-GA.jar
json-lib-2.3-jdk15.jar
jta-1.1.jar
log4j-api-2.7.jar
log4j-slf4j-impl-2.7.jar
mail.jar
ognl-3.1.12.jar
poi-3.9.jar
slf4j-api-1.7.25 (1).jar
slf4j-log4j12-1.7.25.jar
sslext-1.2-0.jar
struts2-config-browser-plugin-2.5.10.1.jar
struts2-convention-plugin-2.5.10.1.jar
struts2-core-2.5.10.1.jar
struts2-jquery-chart-plugin-3.7.0.jar
struts2-jquery-grid-plugin-3.7.1.jar
struts2-jquery-plugin-3.7.1.jar
struts2-jquery-richtext-plugin-3.7.1.jar
struts2-json-plugin-2.5.10.1.jar
xwork-core-2.3.15.1.jar
How to fix this?
You should remove asm jars from the class path.
The version of Struts 2.5.10.1 doesn't have dependency on xwork-core 2.3.15.

Target Unreachable, identifier 'navigationBean' resolved to null [duplicate]

I am developing an application for FB Login with website using Javascript and JSF. I have posted my code at here. The problem is, when I run my application it does't show the JSF page, it instead throws the following exception:
Nov 28, 2013 7:21:46 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path [/FacebookLogin] threw exception [javax/servlet/jsp/jstl/core/Config] with root cause
java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:344)
at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:153)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:99)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
What is the problem here and how can I solve it?
java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
As the package name hints, the mentioned class is part of JSTL. The exception is clearly telling that the class definition file of the mentioned class cannot be found in the runtime classpath. I.e. the Config.class file or at least the JAR file containing that class is missing in webapp's runtime classpath.
JSTL is normally already provided out the box by a full fledged Java EE container such as TomEE, JBoss AS/EAP/WildFly, Payara/GlassFish, WebLogic, etc but not by barebones JSP/Servlet containers such as Tomcat and Jetty. For them, you'd need to supply JSTL along with the web application yourself, exactly like as you'd do for JSF (which is also already provided out the box by full fledged Java EE containers).
You're facing this exception because Facelets has for its <c:xxx> tags a dependency on the JSTL implementation JAR file, while you're using Tomcat which doesn't ship with JSTL out the box. JSTL is as a separate library available in flavor of jstl-1.2.jar. Just download and drop it in your webapp's /WEB-INF/lib folder, along with the JSF JAR file(s) which you already placed there, and this exception should disappear. Maven users can achieve that by adding the below dependency (and performing a full rebuild/redeploy):
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
Alternatively, just replace Tomcat by a real Java EE container.
See also:
Our JSF wiki page - contains JSF installation instructions
I just want to add my contribute if someone gets this error trying to create a springframework-4.0.7-RELEASE module for jboss-eap-6.4.0.GA. My module.xml now contains:
<dependencies>
...
<!-- Contains javax.servlet.jsp.jstl.core.Config -->
<module name="javax.servlet.jstl.api"/>
...
</dependencies>

Error performing resource injection on glassfish

This is my problem:
I'm learning Java EE development and I wanted to build up a WebApplication using Ejb. First of all I tried developing on the same machine, creating a EJB module on a glassfish domain and accessing it through a web application running on the same machine but on different domain: all worked fine. I was able, using glassfish 3.1, to access to the EJBmodule from the webapp thanks to the definition of glassfish-web.xml in my WEB-ING folder:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<ejb-ref>
<ejb-ref-name>ejb/FirstBeanRemote</ejb-ref-name>
<jndi-name>corbaname:iiop:127.0.0.1:3700#java:global/EJBModule/FirstBean!ejb.FirstBeanRemote</jndi-name>
</ejb-ref>
</glassfish-web-app>
After this, I wanted to change experiment, using different machines for the ejb module and the webapp. First of all I installed on a debian machine glassfish 3.1 and deployed my module including the required interfaces. No errors returned in the deploying so I proceeded starting the domain and again all seems to work fine. In server.log I copied the portable jndi names for my EJB FirstBean:
Portable JNDI names for EJB FirstBean: [java:global/EJBModule/FirstBean, java:global/EJBModule/FirstBean!ejb.FirstBeanRemote]
So now on another machine using Netbeans ( under windows 7 ) I created the same webapp as the previous one just changing the glassfish-web.xml in this way:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<ejb-ref>
<ejb-ref-name>ejb/FirstBeanRemote</ejb-ref-name>
<jndi-name>corbaname:iiop:192.168.1.110:3700#java:global/EJBModule/FirstBean!ejb.FirstBeanRemote</jndi-name>
</ejb-ref>
</glassfish-web-app>
I'm sure about Ip(static in my lan) and port (I create a default domain on glassfish).
The problem comes now. When I start the webapplication I get the error:
com.sun.faces.mgbean.ManagedBeanCreationException: An error occurred performing resource injection on managed bean prova
at com.sun.faces.mgbean.BeanBuilder.injectResources(BeanBuilder.java:211)
at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:103)
at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409)
at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269)
at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244)
at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:103)
at com.sun.el.parser.AstValue.getValue(AstValue.java:179)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:224)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
at javax.faces.component.UIOutput.getValue(UIOutput.java:169)
at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1764)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:722)
Caused by: com.sun.faces.spi.InjectionProviderException: com.sun.enterprise.container.common.spi.util.InjectionException: Eccezione durante il tentativo di inserire Remote ejb-ref name=ejb/FirstBeanRemote,Remote 3.x interface =ejb.FirstBeanRemote,ejb-link=null,lookup=,mappedName=,jndi-name=corbaname:iiop:192.168.1.110:3700#java:global/EJBModule123/FirstBean!ejb.FirstBeanRemote,refType=Session in class ciao.Prova: Lookup failed for 'java:comp/env/ejb/FirstBeanRemote' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
at org.glassfish.faces.integration.GlassFishInjectionProvider.inject(GlassFishInjectionProvider.java:194)
at com.sun.faces.mgbean.BeanBuilder.injectResources(BeanBuilder.java:205)
... 51 more
Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Eccezione durante il tentativo di inserire Remote ejb-ref name=ejb/FirstBeanRemote,Remote 3.x interface =ejb.FirstBeanRemote,ejb-link=null,lookup=,mappedName=,jndi-name=corbaname:iiop:192.168.1.110:3700#java:global/EJBModule123/FirstBean!ejb.FirstBeanRemote,refType=Session in class ciao.Prova: Lookup failed for 'java:comp/env/ejb/FirstBeanRemote' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:703)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:470)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:171)
at org.glassfish.faces.integration.GlassFishInjectionProvider.inject(GlassFishInjectionProvider.java:184)
... 52 more
Caused by: javax.naming.NamingException: Lookup failed for 'java:comp/env/ejb/FirstBeanRemote' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=ejb/FirstBeanRemote,Remote 3.x interface =ejb.FirstBeanRemote,ejb-link=null,lookup=,mappedName=,jndi-name=corbaname:iiop:192.168.1.110:3700#java:global/EJBModule123/FirstBean!ejb.FirstBeanRemote,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'corbaname:iiop:192.168.1.110:3700#java:global/EJBModule123/FirstBean__3_x_Internal_RemoteBusinessHome__' [Root exception is org.omg.CORBA.BAD_PARAM: Buono: IOP00100009: string_to_object conversion failed due to bad schema specific part in name java:global/EJBModule123/FirstBean__3_x_Internal_RemoteBusinessHome__ vmcid: SUN minor code: 9 completed: No]]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:518)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:599)
... 55 more
Caused by: javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=ejb/FirstBeanRemote,Remote 3.x interface =ejb.FirstBeanRemote,ejb-link=null,lookup=,mappedName=,jndi-name=corbaname:iiop:192.168.1.110:3700#java:global/EJBModule123/FirstBean!ejb.FirstBeanRemote,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'corbaname:iiop:192.168.1.110:3700#java:global/EJBModule123/FirstBean__3_x_Internal_RemoteBusinessHome__' [Root exception is org.omg.CORBA.BAD_PARAM: Buono: IOP00100009: string_to_object conversion failed due to bad schema specific part in name java:global/EJBModule123/FirstBean__3_x_Internal_RemoteBusinessHome__ vmcid: SUN minor code: 9 completed: No]
at com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:191)
at com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl$EjbReferenceProxy.create(ComponentEnvManagerImpl.java:1109)
at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:776)
at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:744)
at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:169)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:498)
... 59 more
Caused by: org.omg.CORBA.BAD_PARAM: Buono: IOP00100009: string_to_object conversion failed due to bad schema specific part in name java:global/EJBModule123/FirstBean__3_x_Internal_RemoteBusinessHome__ vmcid: SUN minor code: 9 completed: No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:248)
at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:95)
at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.handleFullLogging(WrapperGenerator.java:387)
at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.access$400(WrapperGenerator.java:107)
at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator$2.invoke(WrapperGenerator.java:511)
at com.sun.corba.ee.spi.orbutil.proxy.CompositeInvocationHandlerImpl.invoke(CompositeInvocationHandlerImpl.java:99)
at $Proxy151.soBadSchemaSpecific(Unknown Source)
at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveCorbaname(INSURLOperationImpl.java:227)
at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveINSURL(INSURLOperationImpl.java:154)
at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.operate(INSURLOperationImpl.java:145)
at com.sun.corba.ee.impl.orb.ORBImpl.string_to_object(ORBImpl.java:976)
at com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:184)
... 64 more
Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)
at org.omg.CosNaming._NamingContextExtStub.resolve_str(_NamingContextExtStub.java:165)
at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveCorbaname(INSURLOperationImpl.java:222)
... 68 more
It seems to me a jndi problem, infact in the exception list I can read "Lookup failed for 'java:comp/env/ejb/FirstBeanRemote', so the webapp is not even able to access to the EJBModule. But I'm wondering why, since I'm using the portable jndi provided me by the glassfish server itself!
I hope I was clear and someone can help me.
Max

Grails application is throwing NPE on Websphere 6.1

I have deployed my Grails 1.3.7 app to websphere 6.1.0.25. The app throws NPE
ERROR webapp.WebApp - [Servlet Error]-[Filter [DeclaredResourcesPluginFilter]: filter is unavailable.]: java.lang.NullPointerException
and it does not display the images. It seems they are related but not sure.
Things that might be related:
1- These are some of the related plugins I'm using
runtime ":resources:1.1.6"
runtime ":zipped-resources:1.0"
runtime ":cached-resources:1.0"
compile ":cache-headers:1.1.5"
compile ":lesscss-resources:1.3.0"
2- I have setup Websphere according to Grails deployment document
meaning I have set
"Generic JVM arguments" to "-Xverify:none" and
com.ibm.ws.classloader.getInputStream.enableIOException value: true and
com.ibm.ws.webcontainer.invokeFiltersCompatibility value: true
I appreciate any suggestion on how to debug this issue.
Here: is the full stacktrace:
[WebContainer : 0] ERROR webapp.WebApp - [Servlet Error]-[Filter [DeclaredResourcesPluginFilter]: filter is unavailable.]: java.lang.NullPointerException
at com.ibm.ws.webcontainer.srt.SRTServletResponse.setContentType(SRTServletResponse.java:1141)
at sun.reflect.GeneratedMethodAccessor635.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2395)
at groovy.lang.ExpandoMetaClass.setProperty(ExpandoMetaClass.java:1129)
at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3315)
at org.codehaus.groovy.runtime.InvokerHelper.setProperty(InvokerHelper.java:183)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setProperty(ScriptBytecodeAdapter.java:483)
at org.grails.plugin.resource.ResourceProcessor.processModernResource(ResourceProcessor.groovy:293)
at org.grails.plugin.resource.ResourceProcessor$processModernResource.call(Unknown Source)
at org.grails.plugin.resource.ProcessingFilter.doFilter(ProcessingFilter.groovy:39)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:837)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:747)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:700)
at com.ibm.ws.wswebcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:115)
at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.invokeFilters(DefaultExtensionProcessor.java:849)
at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:785)
at com.ibm.ws.wswebcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:113)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3507)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:269)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:815)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1466)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:122)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:267)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
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$1.run(AsyncChannelFuture.java:205)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497)
I added this JIRA for the Resources Plugin
here
This is a problem with WAS environment for versions 7.x and below.
This exception is generally seen when MIME types of the static resources are not set in WAS (default_host), hence you do not see the images. If you are looking for the .jpg or .png images which missing in the view then the corresponding MIME types has to be added in the server. WAS Admin -> Environments -> Virtual Host -> default_host -> MIME Types.
This issue is persistent in Websphere 7.x as well.

Tomcat ClassNotFound exception when trying to run Application

I have a grails application that I was running fine until yesterday when I decided to download an Email plugin into the STS. The download failed for some reason and I got around the issue with a few searches around. Once I resolved the plugin issues, my application stopped to work. I tried a lot of things including re-installing STS. I was maintaining a GIT repository and I reverted all my changes to the last known working one. This did not help either. I created a new Grails project and copied all my source files over there and everything was working fine.
I compared all the build paths and properties files between the working one and the non working one and they seem to be the same except the .classpath which is getting changed every time I try to run the application like the below
+ <classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
<classpathentry kind="con" path="com.springsource.sts.grails.core.CLASSP
- <classpathentry kind="src" path=".link_to_grails_plugins/tomcat-1.3.7/sr
- <attributes>
- <attribute name="com.springsource.sts.grails.core.SOURCE
- </attributes>
- </classpathentry>
Can anyone please help me with where I should be looking to get this application back on track??
Here is the Error that I get:
Welcome to Grails 1.3.7 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /Users/mymac/springsource/grails-1.3.7/
Base Directory: /Users/mymac/MyProjects/MyGitSources/books_grails/books
Resolving dependencies...
Dependencies resolved in 862ms.
Running script /Users/mymac/springsource/grails-1.3.7/scripts/RunApp.groovy
Environment set to development
[copy] Copying 1 file to /Users/mymac/.grails/1.3.7/projects/books
WARNING: No default container found, installing Tomcat..
Resolving plugin tomcat. Please wait...
Error executing script RunApp: java.lang.ClassNotFoundException: org.grails.tomcat.TomcatServerFactory
java.lang.ClassNotFoundException: org.grails.tomcat.TomcatServerFactory
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:391)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:590)
at gant.Gant.executeTargets(Gant.groovy:589)
Caused by: java.lang.ClassNotFoundException: org.grails.tomcat.TomcatServerFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java_lang_ClassLoader$loadClass.call(Unknown Source)
at _GrailsRun_groovy$_loadServerFactory_closure11.doCall(_GrailsRun_groovy:85)
at _GrailsRun_groovy.loadServerFactory(_GrailsRun_groovy:101)
at _GrailsRun_groovy.this$4$loadServerFactory(_GrailsRun_groovy)
at _GrailsRun_groovy$this$4$loadServerFactory.callCurrent(Unknown Source)
at _GrailsRun_groovy.runInline(_GrailsRun_groovy:114)
at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59)
at RunApp$_run_closure1.doCall(RunApp:33)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
... 10 more
--- Nested Exception ---
java.lang.ClassNotFoundException: org.grails.tomcat.TomcatServerFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java_lang_ClassLoader$loadClass.call(Unknown Source)
at _GrailsRun_groovy$_loadServerFactory_closure11.doCall(_GrailsRun_groovy:85)
at _GrailsRun_groovy.loadServerFactory(_GrailsRun_groovy:101)
at _GrailsRun_groovy.this$4$loadServerFactory(_GrailsRun_groovy)
at _GrailsRun_groovy$this$4$loadServerFactory.callCurrent(Unknown Source)
at _GrailsRun_groovy.runInline(_GrailsRun_groovy:114)
at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59)
at RunApp$_run_closure1.doCall(RunApp:33)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:590)
at gant.Gant.executeTargets(Gant.groovy:589)
Error executing script RunApp: java.lang.ClassNotFoundException: org.grails.tomcat.TomcatServerFactory
[UPDATE]:
When I tried to install the mail plugin in my new working project again, The same error is reproduced if I try to run my application. Somehow the plugin is screwing up my application. Now I don't know how the plugins are installed and what they change in a project :-(
Thanks!!
Posting it as an answer just in case anybody needs to find a solution...
I removed all the projects from under ~/.grails and also cleared the files that had my Project references. I re-imported my project into STS and it started to work again.
I guess the issue was because of the mail plugin. Since my maven repositories was commented out in the BuildConfig.groovy
//mavenLocal()
//mavenCentral()
installation of plugin failed and somehow messed up my project. I created a temp project, installed these plugins with the above lines uncommented, cleaned the original project as mentioned above and re-built my project.
Since now my plugins are locally available, I was able to install them into my main project without any hassle.
Though not a clean one and not sure if there is an existing issue with the failed plugin installations, I am posting this in case anyone runs into the same issue again!
Thanks!!

Resources