OpenSAML throws java.lang.NoClassDefFoundError only on weblogic - java

Im trying to implement a SAML SSO using the opensaml library. Ive managed to do so and successfully and deploy my simple authorization request on tomcat 7 but when i moved my application to weblogic server 10.3.5 it throws the following error:
java.lang.NoClassDefFoundError: Could not initialize class org.opensaml.xml.XMLConfigurator
Im using Gradle 1.12 to build the project, and im requesting the following dependencies:
dependencies {
compile 'org.apache.logging.log4j:log4j-core:2.2'
compile 'org.slf4j:slf4j-api:1.7.12'
compile 'org.slf4j:slf4j-log4j12:1.7.12'
compile group: 'org.opensaml', name: 'opensaml', version: '2.6.4'
compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
testCompile group: 'junit', name: 'junit', version: '4.+'
}
I was searching the web and found that some people solved this problem by telling weblogic to use their libs, but it didn't work for me.
My deployment file weblogic.xml has this:
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.7/weblogic-web-app.xsd">
<prefer-application-packages>
<package-name>org.opensaml.*</package-name>
</prefer-application-packages>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</wls:weblogic-web-app>
Weblogic console stacktrace:
java.lang.NoClassDefFoundError: Could not initialize class org.opensaml.xml.XMLConfigurator
at org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:220)
at org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:207)
at org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:100)
at com.saml.ServiceProvider.<init>(ServiceProvider.java:37)
at com.saml.WebServices.auth(WebServices.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker.invoke(WLSInstanceResolver.java:92)
at weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker.invoke(WLSInstanceResolver.java:74)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:151)
at com.sun.xml.ws.server.sei.EndpointMethodHandlerImpl.invoke(EndpointMethodHandlerImpl.java:268)
at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:100)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:866)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:815)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:778)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:680)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:403)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:532)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:253)
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:140)
at weblogic.wsee.jaxws.WLSServletAdapter.handle(WLSServletAdapter.java:171)
at weblogic.wsee.jaxws.HttpServletAdapter$AuthorizedInvoke.run(HttpServletAdapter.java:708)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at weblogic.wsee.util.ServerSecurityHelper.authenticatedInvoke(ServerSecurityHelper.java:103)
at weblogic.wsee.jaxws.HttpServletAdapter$3.run(HttpServletAdapter.java:311)
at weblogic.wsee.jaxws.HttpServletAdapter.post(HttpServletAdapter.java:336)
at weblogic.wsee.jaxws.JAXWSServlet.doRequest(JAXWSServlet.java:95)
at weblogic.servlet.http.AbstractAsyncServlet.service(AbstractAsyncServlet.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3717)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
java.lang.NoClassDefFoundError: Could not initialize class org.opensaml.xml.XMLConfigurator
at org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:220)
at org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:207)
at org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:100)
at com.saml.ServiceProvider.<init>(ServiceProvider.java:37)
at com.saml.WebServices.auth(WebServices.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker.invoke(WLSInstanceResolver.java:92)
at weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker.invoke(WLSInstanceResolver.java:74)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:151)
at com.sun.xml.ws.server.sei.EndpointMethodHandlerImpl.invoke(EndpointMethodHandlerImpl.java:268)
at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:100)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:866)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:815)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:778)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:680)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:403)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:532)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:253)
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:140)
at weblogic.wsee.jaxws.WLSServletAdapter.handle(WLSServletAdapter.java:171)
at weblogic.wsee.jaxws.HttpServletAdapter$AuthorizedInvoke.run(HttpServletAdapter.java:708)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at weblogic.wsee.util.ServerSecurityHelper.authenticatedInvoke(ServerSecurityHelper.java:103)
at weblogic.wsee.jaxws.HttpServletAdapter$3.run(HttpServletAdapter.java:311)
at weblogic.wsee.jaxws.HttpServletAdapter.post(HttpServletAdapter.java:336)
at weblogic.wsee.jaxws.JAXWSServlet.doRequest(JAXWSServlet.java:95)
at weblogic.servlet.http.AbstractAsyncServlet.service(AbstractAsyncServlet.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3717)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Ive managed to overcome this problem by removing the libraries:
com.bea.core.bea.opensaml2_1.0.0.0_6-1-0-0
com.bea.core.bea.opensaml_1.0.0.0_6-1-0-0
Is it possible to disable the libraries instead of removing them?

yes you can change classloader priority, check this documentation :
https://docs.oracle.com/middleware/1213/wls/WLPRG/classloading.htm#WLPRG289
The idea is to skip using weblogic lib for you application, look at this part :prefer-web-inf-classes Element
Configuring a Filtering ClassLoader
To configure the FilteringClassLoader to specify that a certain package is loaded from an application, add a prefer-application-packages descriptor element to weblogic-application.xml which details the list of packages to be loaded from the application. The following example specifies that org.apache.log4j.* and antlr.* packages are loaded from the application, not the system classloader:
<prefer-application-packages>
<package-name>org.apache.log4j.*</package-name>
<package-name>antlr.*</package-name>
</prefer-application-packages>
The prefer-application-packages descriptor element can also be defined in weblogic.xml. For more information, see "prefer-application-packages".
You can specify that a certain package be loaded for a WAR file included within an EAR file by configuring the FilteringClassLoader in the weblogic.xml file of the WAR file.
For example, A.ear contains B.war. A.ear defines the FilteringClassLoader in weblogic-application.xml, and B.war defines a different FilteringClassLoader in weblogic.xml. When you deploy A.ear, B.war loads the package defined in the FilteringClassLoader in weblogic.xml. The WAR-level FilteringClassLoader has priority over the EAR-level FilteringClassLoader for this WAR file.
For aid in configuring filtering classloaders, see Using the Classloader Analysis Tool (CAT).

Related

In weblogic.xml, <prefer-application-packages> is not working?

I have tried a lot of solutions/ try and error which I got from stackover flow and through googling. Using Weblogic 12.2.1.3 and my project weblogic.xml
<wls:weblogic-web-app
xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app
http://xmlns.oracle.com/weblogic/weblogic-web-app/1.8/weblogic-web-app.xsd">
<security-role-assignment>
<role-name>admin</role-name>
<principal-name>Administrators</principal-name>
</security-role-assignment>
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>org.opensaml</wls:package-name>
</wls:prefer-application-packages>
<wls:show-archived-real-path-enabled>true</wls:show-archived-real-path-enabled>
</wls:container-descriptor>
</wls:weblogic-web-app>
The issue is, even I mentioned in weblogic.xml about opensaml that take from my project, then also Server is taking from Oracle weblogic. It is not taking from my project. I am using 2.6.6 version of opensaml jar for my project. I have tried with <wls:package-name>org.opensaml.*</wls:package-name> but no success.
The main reason to check weblogic.xml is that when I tried to open one specific url it is showing following error in the browser. But it works for Tomcat server when you open the same url. So my assumption is weblogic.xml --> prefer-application-packages tag is not working.
java.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at weblogic.utils.classloaders.GenericClassLoader.defineClassInternal(GenericClassLoader.java:1113)
at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:1046)
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:1038)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:990)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:104)
at weblogic.utils.classloaders.GenericClassLoader.doFindClass(GenericClassLoader.java:611)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:543)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:496)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:72)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:53)
at org.springframework.security.saml.SAMLBootstrap.postProcessBeanFactory(SAMLBootstrap.java:42)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:284)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:179)
Work Around:
When you delete com.oracle.weblogic.security.opensaml2 from
weblogic-->Module folder, the issue get fix. No need to delete
com.oracle.weblogic.security.opensaml jar.

Gradle Tomcat plugin dependencies

Perhaps I'm not understanding Gradle's configurations properly, but I can't seem to make sense of what's going on here. I need org.glassfish.web:javax.servlet.jsp.jstl:1.2.1 in my WAR because Tomcat doesn't provide JSTL, so I put the dependency on the runtime configuration (it's not needed for compilation). The tomcat configuration also requires this package. However, the tomcatRun task will only work if the dependency is ONLY added to the tomcat configuration. If the dependency is added to runtime, or to both runtime and tomcat, or to neither, the following stack trace results:
Servlet threw load() exception
org.apache.jasper.JasperException: /WEB-INF/jsp/index.jsp (line: 1, column: 63) Unable to read TLD "META-INF/c.tld" from JAR file "file:/home/rob/.gradle/caches/modules-2/files-2.1/org.glassfish.web/javax.servlet.jsp.jstl/1.2.1/7f687140e9d264ee00eaa924714adf9a82cc18dc/javax.servlet.jsp.jstl-1.2.1.jar": org.apache.jasper.JasperException: Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:443)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:219)
at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:184)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:475)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1410)
at org.apache.jasper.compiler.Parser.parse(Parser.java:138)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:374)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:341)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
at org.apache.jasper.servlet.JspServlet.init(JspServlet.java:138)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5231)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5518)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
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)
The gradle code is as follows. The offending line is commented out, allowing tomcatRun to work successfully but preventing my WAR from working. When the line is uncommented, tomcatRun fails and the WAR works.
dependencies {
runtime 'org.apache.derby:derby:10.10.2.0',
'com.sun.mail:javax.mail:1.5.2'/*,
'org.glassfish.web:javax.servlet.jsp.jstl:1.2.1'*/
compile 'javax.mail:javax.mail-api:1.5.2'
providedCompile "javax.servlet:javax.servlet-api:${servletSpec}"
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}",
"org.apache.tomcat:tomcat-dbcp:${tomcatVersion}",
files('ecj-4.3.1.jar'),
"org.glassfish.web:javax.servlet.jsp.jstl:1.2.1"
tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj'
}
}
Please use https://mvnrepository.com/artifact/javax.servlet/jstl/1.2
compile group: 'javax.servlet', name: 'jstl', version: '1.2'
I had used https://mvnrepository.com/artifact/javax.servlet.jsp.jstl/jstl and got same error.
I've fixed the problem by using 'javax.servlet:jstl:1.2' instead of 'org.glassfish.web:javax.servlet.jsp.jstl:1.2.1'.

Spring Integration migration from 1.0.x to 2.2.6

I am migrating my project which was build on spring integration 1.0.x to 2.2.6 with spring framework 3.2.8
I have added the new JAR spring-integration-core-2.2.6.RELEASE.jar and removed the old one and also updated the xsd in my applicationContext.xml file.
Below is the xml schema details added in the applicationContext.xml
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:stream="http://www.springframework.org/schema/integration/stream"
xmlns:jms="http://www.springframework.org/schema/integration/jms"
xmlns:httpinvoker="http://www.springframework.org/schema/integration/httpinvoker"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-2.2.xsd">
Now I am facing some difficulties for the below case:
Below is a small section which was working fine in SI 1.0.x :
<channel id="msg.incoming">
<queue capacity="600" />
</channel>
<service-activator input-channel="msg.incoming" ref="consumer"
method="doPolling">
<poller task-executor="consumerpool">
<interval-trigger interval="1" time-unit="SECONDS" />
</poller>
</service-activator>
<thread-pool-task-executor id="consumerpool"
core-size="5" max-size="30" keep-alive-seconds="1000" queue-capacity="20" />
Now I want the same thing to be done with SI 2.2.6, After going through the SI docs, I have updated the above section with the below one:
<channel id="dnd.incoming">
<queue capacity="600" />
</channel>
<service-activator input-channel="dnd.incoming" ref="consumer" method="doDNDScrubbing">
<poller fixed-delay="1000" />
</service-activator>
But unfortunately it is not working and also I am not able configure like behavior in SI 2.2.6.
​I am getting below exceptions:
BeanDefinitionParsingException: Configuration problem: A <poller> element must include either an <interval-trigger/> or <cron-trigger/> child element.
2014-04-18 11:55:07,254 ERROR main [ContextLoader.initWebApplicationContext] - Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: A <poller> element must include either an <interval-trigger/> or <cron-trigger/> child element.
Offending resource: class path resource [applicationContext.xml]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:72)
at org.springframework.integration.config.xml.PollerParser.configureTrigger(PollerParser.java:100)
at org.springframework.integration.config.xml.PollerParser.parseInternal(PollerParser.java:77)
at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
at org.springframework.integration.config.xml.IntegrationNamespaceHandler.parse(IntegrationNamespaceHandler.java:53)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1438)
at org.springframework.integration.config.xml.IntegrationNamespaceUtils.configurePollerMetadata(IntegrationNamespaceUtils.java:149)
at org.springframework.integration.config.xml.AbstractConsumerEndpointParser.parseInternal(AbstractConsumerEndpointParser.java:87)
at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
at org.springframework.integration.config.xml.IntegrationNamespaceHandler.parse(IntegrationNamespaceHandler.java:53)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1438)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1428)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:195)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:139)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4205)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4704)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Please help me resolving this.
Regards,
Sandip Paul
Don't use versions for XSD at all. It will be easier to migrate to the new version.
Remove, please, unused xmlnses.
<thread-pool-task-executor> should be replaced with <task:executor>
A <poller> element must include either an <interval-trigger/> or <cron-trigger/> child element.
It is a message from Spring Integration <= 2.0, not 2.2 =>. So, be sure that you use correct jars of Spring Integration.
All other configuration is OK.
That is a big jump (1.0.x to 2.2.x).
Those child elements were deprecated in 2.0 and removed in 2.1.
Please review the migration guides 2.0->2.1 and 2.1->2.2. 3.0.2 is the current release; its migration guide is here.

Weblogic 12c web service generates null pointer exception on deployment

When upgrading to weblogic 12c from 10.3 we are getting the following null pointer exception on deployment for our web service. The same web service works fine in weblogic 10.3. I am using wsgen to build the webservice. I am also using java 1.7, but have tried the same with 1.6
com.sun.xml.ws.transport.http.servlet.WSServletContextListener parseAdaptersAndCreateDelegate
SEVERE: WSSERVLET11: failed to parse runtime descriptor java.lang.NullPointerException
java.lang.NullPointerException
at org.eclipse.persistence.jaxb.compiler.SchemaGenerator.addSchemaComponents(SchemaGenerator.java:206)
at org.eclipse.persistence.jaxb.compiler.SchemaGenerator.generateSchema(SchemaGenerator.java:144)
at org.eclipse.persistence.jaxb.compiler.SchemaGenerator.generateSchema(SchemaGenerator.java:132)
at org.eclipse.persistence.jaxb.compiler.Generator.generateSchemaFiles(Generator.java:209)
at org.eclipse.persistence.jaxb.JAXBContext.generateSchema(JAXBContext.java:242)
at org.eclipse.persistence.jaxb.JAXBContext.generateSchema(JAXBContext.java:215)
at com.sun.xml.ws.db.toplink.JAXBContextWrapper.generateSchema(JAXBContextWrapper.java:116)
at com.sun.xml.ws.wsdl.writer.WSDLGenerator.generateTypes(WSDLGenerator.java:433)
at com.sun.xml.ws.wsdl.writer.WSDLGenerator.generateDocument(WSDLGenerator.java:409)
at com.sun.xml.ws.wsdl.writer.WSDLGenerator.doGeneration(WSDLGenerator.java:306)
at com.sun.xml.ws.db.DatabindingImpl.generateWSDL(DatabindingImpl.java:224)
at com.sun.xml.ws.server.EndpointFactory.generateWSDL(EndpointFactory.java:528)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:240)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:546)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:525)
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:257)
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:151)
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDelegate(WSServletContextListener.java:131)
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:152)
at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:582)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
at weblogic.servlet.internal.EventsManager.executeContextListener(EventsManager.java:233)
at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:190)
at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:175)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1730)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2740)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1704)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:781)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:213)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:208)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:70)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:212)
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:111)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:213)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:208)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:70)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:24)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:729)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:258)
at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:61)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:192)
at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:369)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:186)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:94)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
I ran into this issue and discovered that I had included two (2) Weblogic 10 files in my WAR file which cause this issue; weblogic-10.3.6.jar and wlfullclient-10.3.6.jar.
Once I removed the, it started up fine.

Log4jConfigListener cannot be found -- context fails to start

I am trying to set up a web application on Eclipse. I am using Tomcat 6.0 and jdk 1.6.0_23.
For some reason I am getting this error:
SEVERE: Error configuring application listener of class org.springframework.web.util.Log4jConfigListener
java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4078)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Jan 24, 2011 11:44:08 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4078)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
I checked if all libraries have been added to the build path and everything seems correct. log4j-1.2.15.jar is included and all the necessary spring libraries.
I am very confused as to what the problem especially because the project was working fine in another computer. Any help with this problem will be highly appreciated.
Naftal
Reticulogic's second suggestion is correct. However, in Eclipse Helios, the "Java EE Module Dependencies" option has been removed. The fix for Helios is as follows:
Right click on your project in Eclipse and go to Properties-->Deployment Assembly
Click "Add..."
Select "Java Build Path Entries" and click "Next"
select "Maven Dependencies" and click "Finish"
The org.springframework.web.util.Log4jConfigListener class is definitely not in your classpath.
The first thing I would suggest is that you turn up the logging level in Tomcat -- in the conf folder -- to "ALL" or "DEBUG" so that you can see exactly what is going on in the container that is preventing this class from being found.
Second, I'd recommend you check your JAR files for the missing class file by running grep, if on linux/mac:
# run at the root of your lib folders:
grep -ri "org.springframework.web.util.Log4jConfigListener" *
The above command will return all JAR files that contain that package. Once the JAR file is isolated, then you can further troubleshoot.
Third, make sure you don't have any conflicts. Multiple versions of Log4j being in your classpath will wreak havoc. How is the system supposed to know which org.springframework.web.util.Log4jConfigListener package to load if there are 2 of them? Tomcat has 3 different classpath folders:
shared/lib
lib
webapps/yourapp/WEB-INF/lib
Make sure you have only one log4j JAR file in only one of these folders.
A simple solution is to clean the Tomcat directory in Eclipse. It worked for me.
If you are using maven and eclipse
1) Look in your web project .classpath file. If you have a classpath entry "org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER", then make sure the attribute is there as well.
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
2) If that does not work, then right click on your web project in eclipse and go to Properties-->JavaEE Module dependencies. Make sure the Maven Dependencies box is checked.
Then save, build deploy yada yada
Migrating to log4j2?
Don't forget to check your webapp/WEB-INF/web.xml (Web Application Deployment Descriptor) for extraneous Event Listener definitions.
If you use, log4j2, you can find these classes in
org.apache.logging.log4j.web.*
package.
As you can see from the class name org.springframework.web.util.Log4jConfigListener is part of spring framework.
And it was depricated since spring 4.2.1 . So check your spring version.

Categories

Resources