This discussion is archived
1 Reply Latest reply: Nov 7, 2012 3:57 AM by 343927 RSS

prefer-application-packages causes weblogic to use application classes!

343927 Newbie
Currently Being Moderated
I recently discovered the the Classloader Analysis Tool (CAT) and saw that our legacy application was full of conflicts and it recomended the following solution.

<prefer-application-packages>
<package-name>javax.xml.*</package-name>
<package-name>javax.xml.datatype.*</package-name>
<package-name>javax.xml.namespace.*</package-name>
<package-name>javax.xml.parsers.*</package-name>
<package-name>javax.xml.rpc.*</package-name>
<package-name>javax.xml.soap.*</package-name>
<package-name>javax.xml.transform.*</package-name>
<package-name>javax.xml.validation.*</package-name>
<package-name>javax.xml.xpath.*</package-name>
<package-name>org.apache.commons.*</package-name>
<package-name>org.apache.oro.*</package-name>
<package-name>org.apache.xerces.*</package-name>
<package-name>org.apache.xmlcommons.*</package-name>
<package-name>org.w3c.dom.*</package-name>
<package-name>org.xml.sax.*</package-name>
</prefer-application-packages>

I added this to META-INF/weblogic-applcation.xml of my ear file.

On startup I get :-

Caused By: java.lang.NoSuchMethodError: javax.xml.parsers.DocumentBuilderFactory.newInstance(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljavax/xml/parsers/DocumentBuilderFactory;
     at com.bea.core.repackaged.springframework.beans.factory.xml.DefaultDocumentLoader.createDocumentBuilderFactory(Unknown Source)
     at com.bea.core.repackaged.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(Unknown Source)
     at com.bea.core.repackaged.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(Unknown Source)
     at com.bea.core.repackaged.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(Unknown Source)
     at com.bea.core.repackaged.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(Unknown Source)
     at com.bea.core.repackaged.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
     at com.bea.core.repackaged.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
     at com.bea.core.repackaged.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
     at com.oracle.pitchfork.server.DefaultContainerBootstrap.bootstrap(DefaultContainerBootstrap.java:51)
     at com.oracle.pitchfork.server.Bootstrap.deploy(Bootstrap.java:147)
     at com.oracle.pitchfork.spi.WLSBootstrap.deploy(WLSBootstrap.java:108)
     at com.oracle.pitchfork.server.Bootstrap.deploy(Bootstrap.java:114)
     at com.oracle.pitchfork.spi.BaseComponentBrokerImpl.initialize(BaseComponentBrokerImpl.java:45)
     at com.oracle.pitchfork.spi.EjbComponentCreatorBrokerImpl.initialize(EjbComponentCreatorBrokerImpl.java:43)
     at weblogic.ejb.container.injection.EjbComponentCreatorImpl.initialize(EjbComponentCreatorImpl.java:65)
     at weblogic.ejb.container.deployer.EJBDeployer.initializeComponentCreator(EJBDeployer.java:721)
     at weblogic.ejb.container.deployer.EJBDeployer.activate(EJBDeployer.java:942)
     at weblogic.ejb.container.deployer.EJBModule.activate(EJBModule.java:470)
     at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:192)
     at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:187)
     at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
     at weblogic.application.internal.flow.ModuleStateDriver.activate(ModuleStateDriver.java:58)
     at weblogic.application.internal.flow.ScopedModuleDriver.activate(ScopedModuleDriver.java:206)
     at weblogic.application.internal.ExtensibleModuleWrapper.activate(ExtensibleModuleWrapper.java:97)
     at weblogic.application.internal.flow.ModuleListenerInvoker.activate(ModuleListenerInvoker.java:114)
     at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:192)
     at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:187)
     at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:35)
     at weblogic.application.internal.flow.ModuleStateDriver.activate(ModuleStateDriver.java:58)
     at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:145)
     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)


If I back out and use the CAT, I see that DefaultDocumentLoader is available from

file:/C:/Program%20Files/Java/jdk1.7.0_04/jre/lib/rt.jar!/javax/xml/parsers/DocumentBuilderFactory.class

file:/D:/bea12c/modules/org.apache.ant_1.7.1/lib/xml-apis.jar!/javax/xml/parsers/DocumentBuilderFactory.class

D:/bea12c/user_projects/domains/XXXDomain/servers/xxxServer/tmp/_WL_user/XXX_ear/trv4bv/APP-INF/lib/xmlparserv2.jar!/javax/xml/parsers/DocumentBuilderFactory.class

A quick decompile of these shows that only the first has a createInstance(String, ClassLoader) method.

This whole stack is Weblogic code, so it seems odd that it is effected by prefer-application-packages!?!?!?!

(By the way, there is no Spring in this old application, regardless of what the stack says)

Edited by: nxs on 18-Jul-2012 09:18

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points