As described in the reply of my previous post, an exception occurred after weblogic cache was cleared.
java 代码
- weblogic.application.ModuleException:
- at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:295)
- at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)
- at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)
- at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:360)
- at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
- Truncated. see log file for complete stacktrace
- java.lang.ClassCastException: com.ctc.wstx.stax.WstxInputFactory
- at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:136)
- at weblogic.servlet.internal.WebAppHelper.addListenerElements(WebAppHelper.java:244)
- at weblogic.servlet.internal.WebAppHelper$IOHelperImpl.parseXML(WebAppHelper.java:224)
- at weblogic.descriptor.DescriptorCache.parseXML(DescriptorCache.java:324)
- at weblogic.servlet.internal.WebAppHelper.registerTagLibListeners(WebAppHelper.java:174)
- Truncated. see log file for complete stacktrace
- >
After consulting google, I was suggested to overwrite weblogic's default stax parser by setting the Djavax.xml.stream.XMLInputFactory property to com.ctc.wstx.stax.WstxInputFactory. However, jvm quickly complained of not being able to find WstxInputFactory class.
java 代码
- weblogic.management.ManagementException: [Management:141266]Parsing Failure in config.xml: Provider com.ctc.wstx.stax.WstxInputFactory not found
- at weblogic.management.provider.internal.RuntimeAccessImpl.<init>(RuntimeAccessImpl.java:122)
- at weblogic.management.provider.internal.RuntimeAccessService.start(RuntimeAccessService.java:38)
- at weblogic.t3.srvr.ServerServicesManager.startService(ServerServicesManager.java:374)
- at weblogic.t3.srvr.ServerServicesManager.startInStandbyState(ServerServicesManager.java:125)
- at weblogic.t3.srvr.T3Srvr.initializeStandby(T3Srvr.java:630)
- at weblogic.t3.srvr.T3Srvr.startup(T3Srvr.java:402)
- at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:361)
- at weblogic.Server.main(Server.java:67)
This is easy. Adding the lib into classpath will do. Sadly, another shock bursted right after wstx.jar was included.
java 代码
- <error> <j2ee> <bea-< span="">160197> <unable to load descriptor d:\bea\weblogic92\server\lib\consoleapp meta-inf="" application.xml of module consoleapp. the error is weblogic.descriptor.descriptorexception: unmarshaller failed="" <="" span="">
- at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:147)
- at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:280)
- at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:248)
- at weblogic.application.descriptor.AbstractDescriptorLoader2.getDescriptorBeanFromReader(AbstractDescriptorLoader2.java:749)
- at weblogic.application.descriptor.AbstractDescriptorLoader2.createDescriptorBean(AbstractDescriptorLoader2.java:376)
- at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBeanWithoutPlan(AbstractDescriptorLoader2.java:720)
- at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBean(AbstractDescriptorLoader2.java:729)
- at weblogic.application.ApplicationDescriptor.getApplicationDescriptor(ApplicationDescriptor.java:277)
- at weblogic.application.internal.EarDeploymentFactory.findOrCreateComponentMBeans(EarDeploymentFactory.java:174)
- at weblogic.application.internal.MBeanFactoryImpl.findOrCreateComponentMBeans(MBeanFactoryImpl.java:48)
- at weblogic.application.internal.MBeanFactoryImpl.createComponentMBeans(MBeanFactoryImpl.java:110)
- at weblogic.application.internal.MBeanFactoryImpl.initializeMBeans(MBeanFactoryImpl.java:76)
- at weblogic.deploy.internal.InternalAppProcessor.createBeansForInternalApp(InternalAppProcessor.java:396)
- at weblogic.deploy.internal.InternalAppProcessor.stageFilesAndCreateBeansForInternalApp(InternalAppProcessor.java:250)
- at weblogic.deploy.internal.InternalAppProcessor.updateConfiguration(InternalAppProcessor.java:196)
- at weblogic.management.deploy.internal.DeploymentServerService.init(DeploymentServerService.java:144)
- at weblogic.management.deploy.internal.DeploymentPreStandbyServerService.start(DeploymentPreStandbyServerService.java:32)
- at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
- at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
- at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
- Caused by: com.bea.xml.XmlException: weblogic.descriptor.BeanAlreadyExistsException: Bean already exists: "weblogic.j2ee.descriptor.ModuleBeanImpl@8120252(/Modules[weblogic.descriptor.internal.DescriptorBeanKey@8426316])"
- at com.bea.staxb.runtime.internal.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:54)
- at com.bea.staxb.runtime.internal.RuntimeBindingType$BeanRuntimeProperty.setValue(RuntimeBindingType.java:483)
- at com.bea.staxb.runtime.internal.AttributeRuntimeBindingType$QNameRuntimeProperty.fillCollection(AttributeRuntimeBindingType.java:385)
- at com.bea.staxb.runtime.internal.MultiIntermediary.getFinalValue(MultiIntermediary.java:52)
- at com.bea.staxb.runtime.internal.AttributeRuntimeBindingType.getFinalObjectFromIntermediary(AttributeRuntimeBindingType.java:145)
- at com.bea.staxb.runtime.internal.UnmarshalResult.unmarshalBindingType(UnmarshalResult.java:185)
- at com.bea.staxb.runtime.internal.UnmarshalResult.unmarshalDocument(UnmarshalResult.java:154)
- at com.bea.staxb.runtime.internal.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:65)
- at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:136)
What the hell...
Seems like wstx parser can't read weblogic descriptors... Now what? Think hard...
The default consoleapp will be loaded before my application. Why not delay the introduction of wstx libraries? Insteadof setting propeties inside jvm arguments, I put them in a static block of the codes. This guarantees a late loading.
java 代码
- static {
- System.setProperty("javax.xml.stream.XMLInputFactory",
- "com.ctc.wstx.stax.WstxInputFactory");
- System.setProperty("javax.xml.stream.XMLOutputFactory",
- "com.ctc.wstx.stax.WstxOutputFactory");
- System.setProperty("javax.xml.stream.XMLEventFactory",
- "com.ctc.wstx.stax.evt.WstxEventFactory");
- }
Keep wstx.jar inside classpath to avoid the exception below during server start.
java 代码
- javax.xml.stream.FactoryConfigurationError: Provider com.ctc.wstx.stax.WstxInputFactory not found
- at javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:72)
- at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:120)
- at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:92)
- at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:136)
- at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:79)
- Truncated. see log file for complete stacktrace
Now clear the cache and test again...
Yes, it's working! Finally!