Glassfish 3.1: spring error during deploy of web application - spring

Strange thing: when I deploy the web application into GF 3.1 through the autodeploy directory, I recieve the following error. The deployment through the admin console works ok with the same war!
here is the exception:
[#|2011-03-19T20:36:06.836+0000|INFO|glassfish3.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=51;_ThreadName=Thread-1;|Adding
singleton for WebappClassLoader
(delegate=false;
repositories=WEB-INF/classes/)|#]
[#|2011-03-19T20:36:14.876+0000|SEVERE|glassfish3.1|org.apache.catalina.core.ContainerBase|_ThreadID=25;_ThreadName=Thread-1;|ContainerBase.addChild:
start:
org.apache.catalina.LifecycleException:
java.lang.IllegalArgumentException:
javax.servlet.ServletException:
com.sun.enterprise.container.common.spi.util.InjectionException:
Error creating managed object for
class
org.springframework.web.context.ContextLoaderListener
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5271)
at com.sun.enterprise.web.WebModule.start(WebModule.java:500)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:755)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1980)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1630)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:100)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:286)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1067)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1247)
at org.glassfish.deployment.autodeploy.AutoOperation.run(AutoOperation.java:145)
at org.glassfish.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:577)
at org.glassfish.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:463)
at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:395)
at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:380)
at org.glassfish.deployment.autodeploy.AutoDeployService$1.run(AutoDeployService.java:213)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Caused by:
java.lang.IllegalArgumentException:
javax.servlet.ServletException:
com.sun.enterprise.container.common.spi.util.InjectionException:
Error creating managed object for
class
org.springframework.web.context.ContextLoaderListener
at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:2688)
at org.apache.catalina.core.StandardContext.addApplicationListener(StandardContext.java:1932)
at com.sun.enterprise.web.TomcatDeploymentConfig.configureApplicationListener(TomcatDeploymentConfig.java:234)
at com.sun.enterprise.web.TomcatDeploymentConfig.configureWebModule(TomcatDeploymentConfig.java:93)
at com.sun.enterprise.web.WebModuleContextConfig.start(WebModuleContextConfig.java:274)
at com.sun.enterprise.web.WebModuleContextConfig.lifecycleEvent(WebModuleContextConfig.java:172)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:149)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5268)
... 26 more Caused by: javax.servlet.ServletException:
com.sun.enterprise.container.common.spi.util.InjectionException:
Error creating managed object for
class
org.springframework.web.context.ContextLoaderListener
at org.apache.catalina.core.StandardContext.createListener(StandardContext.java:2798)
at org.apache.catalina.core.StandardContext.loadListener(StandardContext.java:4745)
at com.sun.enterprise.web.WebModule.loadListener(WebModule.java:1603)
at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:2685)
... 33 more Caused by: com.sun.enterprise.container.common.spi.util.InjectionException:
Error creating managed object for
class
org.springframework.web.context.ContextLoaderListener
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:317)
at com.sun.enterprise.web.WebContainer.createListenerInstance(WebContainer.java:734)
at com.sun.enterprise.web.WebModule.createListenerInstance(WebModule.java:1981)
at org.apache.catalina.core.StandardContext.createListener(StandardContext.java:2796)
... 36 more Caused by: java.lang.NullPointerException
at com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.createManagedBean(ManagedBeanManagerImpl.java:485)
at com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.createManagedBean(ManagedBeanManagerImpl.java:428)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:300)
... 39 more
NPE in the official release?? Isn't this the indicator of new bug in GF?
Piece of my web.xml:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
Using the latest (3.0.2.RELEASE) version of Spring-web
Thanks.

Bug report is here :
http://java.net/jira/browse/GLASSFISH-16237
turned out to be mistake with Spring dependency.
I was hoping this had a real solution. Because I also got this problem and my app doesn't use Spring at all! Just Weld/CDI + EJB in GlassFish 3.1.

Related

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.jboss.classfilewriter.ClassFile

I am using Jboss EAP 7.2.6 and trying to deploy and EJB3 application. I am getting below error during the application deployment.
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.jboss.classfilewriter.ClassFile
at org.jboss.as.ejb3#7.2.6.GA-redhat-00001//org.jboss.as.ejb3.iiop.handle.SerializationHackProxy.proxy(SerializationHackProxy.java:55)
at org.jboss.as.ejb3#7.2.6.GA-redhat-00001//org.jboss.as.ejb3.iiop.handle.HandleDelegateImpl.<init>(HandleDelegateImpl.java:58)
at org.jboss.as.ejb3#7.2.6.GA-redhat-00001//org.jboss.as.ejb3.deployment.processors.IIOPJndiBindingProcessor.bindService(IIOPJndiBindingProcessor.java:108)
at org.jboss.as.ejb3#7.2.6.GA-redhat-00001//org.jboss.as.ejb3.deployment.processors.IIOPJndiBindingProcessor.deploy(IIOPJndiBindingProcessor.java:83)
at org.jboss.as.server#6.0.21.Final-redhat-00001//org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:144) ```

Liferay upgrade 7.2 to register spring beans with osgi

While I am trying to configure a spring mvc portlet with beans and bring up the deployed war on my server I get following errors
I tried all the stuff related to spring inorder to solve NameSpaceHandler issue, but I still get error related to portlet.xml, registration of beans with container
I am using spring 4.2.5-RELEASE and XML schema all I using 3.0 version for XSD inorder for it to be compliant with webapp 3.0 XSD just to be safe.
Logs are as mentioned below
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context]_Offending resource: ServletContext resource [/WEB-INF/spring-context/portlet-application-context.xml]_ [Sanitized]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:118)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:110)
2020-05-18 08:16:53.947 ERROR [fileinstall-/project_war_Path/][HotDeployImpl:232] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering servlet context listeners for project-spring-portlet-1.0.0
com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering servlet context listeners for project-spring-portlet-1.0.0
at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:38)
at com.liferay.portal.deploy.hot.ServletContextListenerHotDeployListener.invokeDeploy(ServletContextListenerHotDeployListener.java:40)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:229)
at com.liferay.portal.deploy.hot.HotDeployImpl.fireDeployEvent(HotDeployImpl.java:96)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.liferay.portal.deploy.hot.ServletContextListenerHotDeployListener.doInvokeDeploy(ServletContextListenerHotDeployListener.java:73)
at com.liferay.portal.deploy.hot.ServletContextListenerHotDeployListener.invokeDeploy(ServletContextListenerHotDeployListener.java:37)
... 63 more
Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context]_Offending resource: ServletContext resource [/WEB-INF/spring-context/portlet-application-context.xml]_ [Sanitized]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:118)
2020-05-18 08:16:53.957 WARN [fileinstall-/project_war_Path/][PortletLocalServiceImpl:881] Portlet with the name apiusersspring_WAR_apiusersspringportlet100 is described in portlet.xml but does not have a matching entry in liferay-portlet.xml
2020-05-18 08:16:53.958 WARN [fileinstall-/project_war_Path/][PortletLocalServiceImpl:893] Portlet with the name apiusersspringportlet_WAR_apiusersspringportlet100 is described in liferay-portlet.xml but does not have a matching entry in portlet.xml
2020-05-18 08:16:53.958 ERROR [fileinstall-/project_war_Path/][PortletBagFactory:288] java.lang.ClassNotFoundException: org.springframework.web.portlet.DispatcherPortlet cannot be found by project-spring-portlet-1.0.0_1.0.0
java.lang.ClassNotFoundException: org.springframework.web.portlet.DispatcherPortlet cannot be found by project-spring-portlet-1.0.0_1.0.0
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:508)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:419)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:411)
2020-05-18 08:16:53.963 ERROR [fileinstall-/project_war_Path/][PortletBagFactory:214] javax.portlet.PortletException: java.lang.NullPointerException
javax.portlet.PortletException: java.lang.NullPointerException
at com.liferay.portlet.internal.InvokerPortletFactoryImpl.create(InvokerPortletFactoryImpl.java:111)
at com.liferay.portal.monitoring.internal.portlet.MonitoringInvokerPortletFactoryImpl.create(MonitoringInvokerPortletFactoryImpl.java:115)
at com.liferay.portlet.internal.PortletInstanceFactoryImpl.init(PortletInstanceFactoryImpl.java:275)
at com.liferay.portlet.internal.PortletInstanceFactoryImpl.create(PortletInstanceFactoryImpl.java:181)
Caused by: java.lang.NullPointerException
at com.liferay.portlet.internal.InvokerPortletImpl.<init>(InvokerPortletImpl.java:122)
at com.liferay.portlet.internal.InvokerPortletFactoryImpl.create(InvokerPortletFactoryImpl.java:107)
... 80 more
2020-05-18 08:16:53.966 ERROR [fileinstall-/project_war_Path/][HotDeployImpl:232] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for project-spring-portlet-1.0.0
com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for project-spring-portlet-1.0.0
at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:38)
at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:99)
at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:229)
at com.liferay.portal.deploy.hot.HotDeployImpl.fireDeployEvent(HotDeployImpl.java:96)
at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:27)
at com.liferay.portal.kernel.servlet.PluginContextListener.fireDeployEvent(PluginContextListener.java:189)

Error running CXF REST web service on Apache Tomee

I'm trying to build a RESTful web service using the "org.apache.cxf.archetype:cxf-jaxrs-service" maven archetype. When I deploy it on Apache Tomee I get the following error:
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'services': Invocation of init method failed; nested exception is org.apache.cxf.service.factory.ServiceConstructionException
...
...
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:219)
...
...
Caused by: java.lang.ClassCastException: Cannot cast org.apache.cxf.management.jmx.InstrumentationManagerImpl to org.apache.cxf.management.InstrumentationManager*
My guess is I'm missing some configuration but I thought the archetype would 'just work'.
Any ideas?
this error means you have a conflict between cxf in the webapp (WEB-INF/lib) and tomee. You either have to configure the classloading to do that or (recommanded and expected by EE) just remove CXF from the webapp since it is in tomee and tomee does the job for you.
Side note: you will also likely need to clean up the web.xml since tomee will handle the deployment without the need to register a servlet.

RESTEasy 3 broken with Spring 4.0

I am using Spring 4, Resteasy 3.0.6 and Tomcat 7
Tomcat startup fine but I get a 404 for all REST endpoints.
I think I am running into exactly is described here:
https://issues.jboss.org/browse/RESTEASY-1012
I created that custom class and updated the web.xml
<listener>
<listener-class>com.example.CustomContextLoaderListener</listener-class>
</listener>
However now I get this exception and Tomcat fails to start
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException:
Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].Stand
ardContext[]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.ja
va:1123)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java
:800)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.
java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.
java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [St
andardEngine[Tomcat].StandardHost[localhost].StandardContext[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 6 more
Caused by: java.lang.ClassCastException: org.springframework.web.SpringServletCo
ntainerInitializer cannot be cast to javax.servlet.ServletContainerInitializer
at org.apache.catalina.startup.ContextConfig.getServletContainerInitiali
zer(ContextConfig.java:1661)
at org.apache.catalina.startup.ContextConfig.processServletContainerInit
ializers(ContextConfig.java:1569)
Any help will be appreciated. Thanks
Answering my own question. The problem was that javax-servlet was a compile dependency so I had to change its scope to provided as that was causing a conflict with Tomcat (I'm using Maven)

Spring web service Servlet.init() for servlet spring-ws threw exception

I am trying to learn Spring web services, I found this tutorial :
http://jeromebulanadi.wordpress.com/2010/02/25/basic-spring-web-service-tutorial-from-contract-to-security/#comment-302
I imported the project prerson in eclipse, added the jar files, but when I run the project and typed :
http://localhost:8080/person/Person.wsdl
I got this error :
javax.servlet.ServletException: Servlet.init() for servlet spring-ws threw exception
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Thread.java:662)
root cause
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘Person’ defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/xml/serializer/TreeWalker
Can you please help me ?
thanks.
java.lang.NoClassDefFoundError: org/apache/xml/serializer/TreeWalker
Add xalan-2.7.1.jar to your CLASSPATH.
Use xalan-2.7.0.jar. It worked for me.
I found a solution to this problem, just added serializer.jar to my classpath and it's working now, it looks like xalan-2.7.1.jar is missing TreeWalker.

Resources