Failed to load java type corresponding to e=web-app@http://java.sun.com/xml/ns/javaee

Working with various versions of Weblogic application server, you might have encountered the error partially described in the title. The error would not appear during the build but during deployment. A more complete stack trace of this error is presented below:

  1.  
  2. com.bea.xml.XmlException: failed to load java type corresponding to e=web-app@http://java.sun.com/xml/ns/javaee
  3. at com.bea.staxb.runtime.internal.UnmarshalResult.getPojoBindingType(UnmarshalResult.java:325)
  4. at com.bea.staxb.runtime.internal.UnmarshalResult.determineTypeForGlobalElement(UnmarshalResult.java:292)
  5. at com.bea.staxb.runtime.internal.UnmarshalResult.determineTypeForGlobalElement(UnmarshalResult.java:302)
  6. at com.bea.staxb.runtime.internal.UnmarshalResult.determineRootType(UnmarshalResult.java:283)
  7. at com.bea.staxb.runtime.internal.UnmarshalResult.unmarshalDocument(UnmarshalResult.java:153)
  8. at com.bea.staxb.runtime.internal.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:65)
  9. at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:136)
  10. at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:280)
  11. at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:248)
  12. at weblogic.application.descriptor.AbstractDescriptorLoader2.getDescriptorBeanFromReader(AbstractDescriptorLoader2.java:749)
  13. at weblogic.application.descriptor.AbstractDescriptorLoader2.createDescriptorBean(AbstractDescriptorLoader2.java:378)
  14. at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBeanWithoutPlan(AbstractDescriptorLoader2.java:720)
  15. at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBean(AbstractDescriptorLoader2.java:729)
  16. at weblogic.servlet.internal.WebAppDescriptor.getWebAppBean(WebAppDescriptor.java:134)
  17. at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:775)
  18. at weblogic.servlet.internal.WebAppModule.prepare(WebAppModule.java:272)
  19. at weblogic.application.internal.flow.ScopedModuleDriver.prepare(ScopedModuleDriver.java:176)
  20. at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:93)

This was very strange at first. It seemed that the DTD currently mentioned in the web.xml file corresponding to a web module was not correct. The problem was that the project had worked before, with the same Weblogic version.

Trying to remove the DTD definition and actually make the web.xml compliant with the latest standards (xml schema, qualify the elements with the adequate namespaces) did not fix the problem. I would not have gone with such a solution anyway, as the project works for at least one year in the current configuration.

[adsense]

Eventually I found the issue: The build was done pointing to the wrong Weblogic version (used the weblogic.jar from 10.3 instead of 9.2) No code changes were actually necessary to fix the problem just a rebuild while pointing to the right library repository.

No issue was signaled during the build and I am sure that I could have deployed it on weblogic 10 without any issues, however on Weblogic 9 did not work.

As soon as the build was correctly executed, the problem disappeared. So if you experience the same behavior, first ensure your build runs with the adequate parameters and most important Weblogic libraries and only afterwards start applying code changes.