java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener

While upgrade to a new version of our inhouse framework I got the following error when deploying the application to a Weblogic 10.3.5 webserver:

<22-Nov-2012 07:15:11 o'clock CET> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1353564894136' for task '8'. Error is: 'weblogic.application.ModuleException: '
weblogic.application.ModuleException:
        at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:393)
        at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)
        at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
        at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:517)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:159)
        at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:45)
        at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:613)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:184)
        at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:58)
        at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154)
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98)
        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747)
        at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250)
        at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:46)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused By: java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener
        at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
        at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
        at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
        at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43)
        at weblogic.servlet.internal.EventsManager.registerEventListeners(EventsManager.java:108)
        at weblogic.servlet.internal.EventsManager.registerPreparePhaseListeners(EventsManager.java:71)
        at weblogic.servlet.internal.WebAppServletContext.initContextListeners(WebAppServletContext.java:1852)
        at weblogic.servlet.internal.WebAppServletContext.prepare(WebAppServletContext.java:1196)
        at weblogic.servlet.internal.HttpServer.doPostContextInit(HttpServer.java:453)
        at weblogic.servlet.internal.HttpServer.loadWebApp(HttpServer.java:428)
        at weblogic.servlet.internal.WebAppModule.registerWebApp(WebAppModule.java:972)
        at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:382)
        at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)
        at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
        at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:517)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:159)
        at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:45)
        at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:613)
        at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
        at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:184)
        at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:58)
        at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154)
        at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207)
        at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98)
        at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747)
        at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216)
        at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250)
        at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)
        at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:46)
        at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

Trying to add com.sun.faces.config.ConfigureListener would only result in an instant dead of the webserver 😦 .

The solution is actually very simple: inside the javax:javaee-web-api and javax:javaee-api there are some reference to the ConfigureListener, just ensure that they aren’t packed inside your ear by setting the scope of your dependency to ‘provided’ (if you are using maven).
In fact, these API jars should never be inside your ear because your webserver is supposed to provide the implementation of the API’s.

	<dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>6.0</version>
	    <scope>provided</scope>
        </dependency>
	<dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>6.0</version>
	    <scope>provided</scope>
        </dependency>

If still packaged inside the ear than you can use maven dependency:tree to find out why it’s added and exclude it from that dependency:

[INFO] ------------------------------------------------------------------------
[INFO] Building YourEarModule
[INFO]    task-segment: [dependency:tree]
[INFO] ------------------------------------------------------------------------
[INFO] [dependency:tree {execution: default-cli}]
[INFO] c.c.d.s:App:ear:2.1.5
[INFO] +- c.c.d.s:AppModel:jar:2.1.5:compile
[INFO] |  \- c.c.d.s:AppUtil:jar:2.1.5:compile
[INFO] +- c.c.d.s:AppService:ejb:2.1.5:compile
[INFO] |  +- c.c.d.s:AppBusiness:jar:2.1.5:compile
[INFO] |  +- javax:ejb:jar:3.0.1:compile
[INFO] |  +- c.c.d.s:TaskmanagerClient:jar:2.1.5:compile
[INFO] |  |  +- org.apache.axis:axis:jar:1.4:compile
[INFO] |  |  +- org.apache.axis:axis-jaxrpc:jar:1.4:compile
[INFO] |  |  \- org.apache.axis:axis-saaj:jar:1.4:compile
[INFO] |  +- c.c.d.s:App-sitran-ws-client:jar:2.1.5:compile
[INFO] |  |  +- c.c.d.s:App-sitran-ws:jar:2.1.5:compile
[INFO] |  |  +- c.c.d.s:App-sitran-ws-client-messages:jar:2.1.5:compile
[INFO] |  |  +- xalan:xalan:jar:2.7.1:compile
[INFO] |  |  |  \- xalan:serializer:jar:2.7.1:compile
[INFO] |  |  \- com.sun.xml.ws:jaxws-rt:jar:2.2.1:compile
[INFO] |  |     +- javax.xml.ws:jaxws-api:jar:2.2.1:compile
[INFO] |  |     |  +- javax.xml.bind:jaxb-api:jar:2.2.1:compile
[INFO] |  |     |  +- javax.xml.soap:saaj-api:jar:1.3.1:compile
[INFO] |  |     |  +- javax.annotation:jsr250-api:jar:1.0:compile
[INFO] |  |     |  \- javax.jws:jsr181-api:jar:1.0-MR1:compile
[INFO] |  |     +- com.sun.xml.bind:jaxb-impl:jar:2.2.1.1:compile
[INFO] |  |     +- com.sun.xml.messaging.saaj:saaj-impl:jar:1.3.4:compile
[INFO] |  |     +- com.sun.xml.stream.buffer:streambuffer:jar:1.1:compile
[INFO] |  |     |  \- javax.activation:activation:jar:1.1:compile
[INFO] |  |     +- org.jvnet.staxex:stax-ex:jar:1.2:compile
[INFO] |  |     |  \- javax.xml.stream:stax-api:jar:1.0:compile
[INFO] |  |     +- com.sun.org.apache.xml.internal:resolver:jar:20050927:compile
[INFO] |  |     +- org.jvnet:mimepull:jar:1.4:compile
[INFO] |  |     +- com.sun.xml.ws:policy:jar:2.2.1:compile
[INFO] |  |     |  +- com.sun.xml.txw2:txw2:jar:20090102:compile
[INFO] |  |     |  \- com.sun.istack:istack-commons-runtime:jar:2.2:compile
[INFO] |  |     \- org.glassfish.gmbal:gmbal-api-only:jar:3.0.0-b023:compile
[INFO] |  |        \- org.glassfish.external:management-api:jar:3.0.0-b012:compile
[INFO] |  \- c.c.d.s:IrisPagerClient:jar:1.0:compile
[INFO] +- c.c.d.s:AppGUI:war:2.1.5:compile
[INFO] +- org.glassfish.extras:glassfish-embedded-all:jar:3.0.1:test
[INFO] +- org.apache.struts:struts2-core:jar:2.1.8.1:compile
[INFO] |  +- com.opensymphony:xwork-core:jar:2.1.6:compile
[INFO] |  |  \- org.springframework:spring-test:jar:2.5.6:compile
[INFO] |  +- org.freemarker:freemarker:jar:2.3.15:compile
[INFO] |  +- ognl:ognl:jar:2.7.3:compile
[INFO] |  \- com.sun:tools:jar:1.5.0:system
[INFO] +- b.f.m.s.App:jmesa:jar:3.0:compile
[INFO] +- org.apache.poi:poi:jar:3.2-FINAL:compile
[INFO] +- org.apache.taglibs:standard:jar:1.0.2:compile
[INFO] +- org.apache.struts:struts2-tiles-plugin:jar:2.1.8.1:compile
[INFO] +- org.apache.tiles:tiles-core:jar:2.0.6:compile
[INFO] |  +- org.apache.tiles:tiles-api:jar:2.0.6:compile
[INFO] |  \- commons-logging:commons-logging-api:jar:1.1:compile
[INFO] +- org.apache.tiles:tiles-jsp:jar:2.0.6:compile
[INFO] +- c.c.d.App-CharteGraphique:tld:jar:2.20.2.34:compile
[INFO] +- b.f.m.c.fwk:PlatformWeblogic:jar:3.9.1.4:provided
[INFO] +- commons-logging:commons-logging:jar:1.0.4:provided (scope not updated to compile)
[INFO] +- commons-net:commons-net:jar:1.2.2:compile
[INFO] +- commons-collections:commons-collections:jar:3.2:compile
[INFO] +- commons-validator:commons-validator:jar:1.1.4:compile
[INFO] +- commons-digester:commons-digester:jar:1.8:compile
[INFO] |  \- commons-beanutils:commons-beanutils:jar:1.7.0:compile
[INFO] +- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- commons-fileupload:commons-fileupload:jar:1.2:compile
[INFO] +- commons-io:commons-io:jar:1.3:compile
[INFO] +- commons-discovery:commons-discovery:jar:0.4:compile
[INFO] +- org.safehaus.jug:jug:jar:lgpl:2.0.0:provided
[INFO] +- c.c.d.s:DocumentsClient:jar:5.1.0:compile
[INFO] |  +- javax:javaee-web-api:jar:6.0:provided (scope not updated to compile)
[INFO] |  +-javax:javaee-api:jar:6.0:provided (scope not updated to compile)
[INFO] |  +- org.apache.axis2:axis2:jar:1.4:compile
[INFO] |  +- org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile
[INFO] |  |  \- stax:stax-api:jar:1.0.1:compile
[INFO] |  +- org.apache.ws.commons.axiom:axiom-impl:jar:1.2.7:compile
[INFO] |  |  +- org.apache.ws.commons.axiom:axiom-api:jar:1.2.7:compile
[INFO] |  |  |  +- jaxen:jaxen:jar:1.1.1:compile
[INFO] |  |  |  \- xml-apis:xml-apis:jar:1.3.04:compile
[INFO] |  |  +- org.apache.geronimo.specs:geronimo-activation_1.1_spec:jar:1.0.1:compile
[INFO] |  |  +- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.2:compile
[INFO] |  |  +- org.codehaus.woodstox:wstx-asl:jar:3.2.4:compile
[INFO] |  |  \- org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0.1:compile
[INFO] |  +- wsdl4j:wsdl4j:jar:1.6.2:compile
[INFO] |  +- org.apache.ws.commons.schema:XmlSchema:jar:1.4.2:compile
[INFO] |  +- backport-util-concurrent:backport-util-concurrent:jar:3.1:compile
[INFO] |  +- org.apache.neethi:neethi:jar:2.0.4:compile
[INFO] |  +- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO] |  +- org.apache.woden:woden-api:jar:1.0M8:compile
[INFO] |  |  +- org.apache.ant:ant:jar:1.7.0:compile
[INFO] |  |  |  \- org.apache.ant:ant-launcher:jar:1.7.0:compile
[INFO] |  |  +- xerces:xercesImpl:jar:2.8.1:compile
[INFO] |  |  \- xerces:xmlParserAPIs:jar:2.6.0:compile
[INFO] |  +- commons-codec:commons-codec:jar:1.4:compile
[INFO] |  \- javax.jcr:jcr:jar:1.0:compile
[INFO] +- com.bea.weblogic:wl-all-dependencies:jar:10.3.2.0:provided
[INFO] +- org.json:json:jar:20090211:compile
[INFO] +- log4j:log4j:jar:1.2.9:provided (scope not updated to compile)
[INFO] +- org.slf4j:slf4j-api:jar:1.5.3:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.5.3:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.5.6:compile
[INFO] +- junit:junit:jar:4.0:test (scope not updated to compile)
[INFO] +- org.easymock:easymock:jar:3.0:test
[INFO] |  +- cglib:cglib-nodep:jar:2.2:test
[INFO] |  \- org.objenesis:objenesis:jar:1.2:test
[INFO] +- dwr:dwr:jar:2.0.6:compile
[INFO] \- com.google.code.findbugs:annotations:jar:1.3.9:compile
<dependency>
	<groupId>c.c.d.s</groupId>
	<artifactId>DocumentsClient</artifactId>
	<version>1.0</version>
	<exclusions>
		<exclusion>
			<groupId>javax</groupId>
			<artifactId>javaee-web-api</artifactId>
		</exclusion>
		<exclusion>
			<groupId>javax</groupId>
			<artifactId>javaee-api</artifactId>
		</exclusion>
	</exclusions>
</dependency>
Advertisements

3 thoughts on “java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s