Friday, April 18, 2008

I love you OC4J

Recently our team found out that our deployment environment would use Oracle's OC4J App Server. So, after getting it up and going, I finally started working with it locally; deploying and testing our application.

One of the rest services in our application was returning a 500 response code. To investigate, I navigated to this WAR's application log for a look. I couldn't believe what I found....

The 500 was a result of an everyday NoClassDefFoundError. What blew me away was what OC4J had put in the log. Check it out...


08/04/18 13:41:16.484 10.1.3.1.0 Started
08/04/18 13:41:16.828 safxc-test: 10.1.3.1.0 Started
08/04/18 13:50:43.546 safxc-test: Servlet error
oracle.classloader.util.AnnotatedNoClassDefFoundError:

Missing class: javax.xml.bind.annotation.XmlRootElement

Dependent class: com.sun.ws.rest.impl.streaming.JAXBElementProvider
Loader: safxc-test.web.safxc-test:0.0.0
Code-Source: /C:/JEE/AppServers/oc4j/j2ee/home/applications/safxc-test/safxc-test/WEB-INF/lib/restbeans-impl-R2.jar
Configuration: WEB-INF/lib/ directory in C:\JEE\AppServers\oc4j\j2ee\home\applications\safxc-test\safxc-test\WEB-INF\lib

The missing class is available from the following locations:

1. Code-Source: /C:/JEE/AppServers/oc4j/j2ee/home/applications/safxc/safxc/WEB-INF/lib/jaxb-api-2.0.jar (from WEB-INF/lib/ directory in C:\JEE\AppServers\oc4j\j2ee\home\applications\safxc\safxc\WEB-INF\lib)
This code-source is available in loader safxc.web.safxc:0.0.0.

2. Code-Source: /C:/JEE/AppServers/oc4j/j2ee/home/applications/dashboard/dashboard/WEB-INF/lib/jaxb-api-2.0.jar (from WEB-INF/lib/ directory in C:\JEE\AppServers\oc4j\j2ee\home\applications\dashboard\dashboard\WEB-INF\lib)
This code-source is available in loader dashboard.web.dashboard:0.0.0.

3. Code-Source: /C:/JEE/AppServers/oc4j/j2ee/home/applications/cop/cop/WEB-INF/lib/jaxb-api-2.0.jar (from WEB-INF/lib/ directory in C:\JEE\AppServers\oc4j\j2ee\home\applications\cop\cop\WEB-INF\lib)
This code-source is available in loader cop.web.cop:0.0.0.

4. Code-Source: /C:/JEE/AppServers/oc4j/j2ee/home/applications/resource-discovery-widget-service/resource-discovery-widget-service/WEB-INF/lib/jaxb-api-2.0.jar (from WEB-INF/lib/ directory in C:\JEE\AppServers\oc4j\j2ee\home\applications\resource-discovery-widget-service\resource-discovery-widget-service\WEB-INF\lib)
This code-source is available in loader resource-discovery-widget-service.web.resource-discovery-widget-service:0.0.0.

at .... STACK TRACE WAS HERE ....


That's right! Unreal! In some beautiful, very readable output, it ...

  1. Tells you the exact class that is missing (outside of the stack trace)

  2. Tells you the dependent class

  3. Tells you what artifact contains the dependent class

  4. Tells you where you can go find the missing class !!!!



If I haven't said it already ... this is awesome. I can't wait to see what else is in store for me.

3 comments:

Anonymous said...

Hi Chad,

I'm getting the same error. How do i resolve it ?

If i remove the offending jar i get a straight forward class not found error. Its driving me nuts.

Any ideas in solving this would be great.

Thanks
al

alwynh1@yahoo.com

Anonymous said...

You poor deluded fool.

Edd said...

I have the same problem but maybe worst. Here is my message:

08/11/24 09:51:54.500 ExpedicionesWeb: Servlet error
oracle.classloader.util.AnnotatedNoClassDefFoundError:

Missing Class: co.com.camaleon.j2ee.expediciones.action.programacion.asignacion.AsignacionCommand (wrong name: co.com.camaleon.j2ee.expediciones.action.programacion.asignacion.AsignacionProgramacionTaller)

Dependent Class: co.com.camaleon.j2ee.expediciones.action.programacion.asignacion.AsignacionCommand
Loader: Expediciones.web.ExpedicionesWeb:0.0.0
Code-Source: /C:/oc4j/j2ee/home/applications/Expediciones/ExpedicionesWeb/WEB-INF/classes/
Configuration: WEB-INF/classes/ in C:\oc4j\j2ee\home\applications\Expediciones\ExpedicionesWeb\WEB-INF\classes

The missing class isn't available from any location.

And is worst cause it's not a jar but a class, and tells me that there is a wrong name... I can't understand