J2EE container marking a class as unavailable, good or bad?

July 6, 2009, Posted by admin at 5:32 am

I spent another frustrating 1/2 day trying to fix a ‘problem’ , a NoClassDefFound. Initially was only deploying the class to web directory then decided it need to be in the ejb classpath too, put it there, still to no avail, touched the file so that it will be updated and hope that it works, to no avail. I must have a missed an ibatis misconfiguration done by a new developer in the office but showed when i was running the app, because using oc4j, it will only show once the error and ‘marks’ the class as unavailable. Subsequently running the app, bloody NoClassDefFound error keeps coming up. Looked at log files, seeing the last few lines, it was the reporting the same thing as the error page generated by oracle.
After doing some other tasks, got back to fixing this thing, looked really hard at the log files, ibatis log showed nothing, then looked at the container generated log, above a few errors, suddenly, everything was clear, ibatis wasn’t logging this errors, most probably using a xml parser other than digester to process the xml file.

05/01/13 20:04:55 web/Product: Servlet error
java.lang.ExceptionInInitializerError: java.lang.RuntimeException: Could not initialize DaoConfig.
Cause: com.ibatis.dao.client.DaoException: Error while configuring DaoManager.
Cause: com.ibatis.sqlmap.client.SqlMapException: There was an error while building the SqlMap instance.
— The error occurred in com/mycompany/domain/dao/domain.xml.
— The error occurred while loading the SQL Map resource.
— Cause: com.ibatis.sqlmap.client.SqlMapException: XML Parser Error.  Cause: org.xml.sax.SAXException: Error: URI=null Line=4: : XML-0149: (Error) Element ’sql-map’ used but not declared.
Caused by: org.xml.sax.SAXException: Error: URI=null Line=4: : XML-0149: (Error) Element ’sql-map’ used but not declared.
Caused by: com.ibatis.sqlmap.client.SqlMapException: XML Parser Error.  Cause: org.xml.sax.SAXException: Error: URI=null Line=4: : XML-0149: (Error) Element ’sql-map’ used but not declared.
Caused by: org.xml.sax.SAXException: Error: URI=null Line=4: : XML-0149: (Error) Element ’sql-map’ used but not declared.
Caused by: com.ibatis.sqlmap.client.SqlMapException: There was an error while building the SqlMap instance.
— The error occurred in com/mycompany/domain/dao/domain.xml.
— The error occurred while loading the SQL Map resource.
— Cause: com.ibatis.sqlmap.client.SqlMapException: XML Parser Error.  Cause: org.xml.sax.SAXException: Error: URI=null Line=4: : XML-0149: (Error) Element ’sql-map’ used but not declared.
Caused by: org.xml.sax.SAXException: Error: URI=null Line=4: : XML-0149: (Error) Element ’sql-map’ used but not declared.
Caused by: com.ibatis.sqlmap.client.SqlMapException: XML Parser Error.  Cause: org.xml.sax.SAXException: Error: URI=null Line=4: : XML-0149: (Error) Element ’sql-map’ used but not declared.
Caused by: org.xml.sax.SAXException: Error: URI=null Line=4: : XML-0149: (Error) Element ’sql-map’ used but not declared.
at com.company.service.dao.DaoConfig.(DaoConfig.java:27)
at com.company.Domain1.bo.Domain1Service.(Domain1Service.java:27)
at com.company.Domain1.bo.Domain1Service.(Domain1Service.java:24)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at Domain1ListServ.findDomain1s(Domain1ListServ.java:147)
at Domain1ListServ.doPost(Domain1ListServ.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Unknown Source)
05/01/13 20:04:59 web/Product: IndexServ1: init
05/01/13 20:05:09 web/Product: Servlet error
java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at Domain1ListServ.findDomain1s(Domain1ListServ.java:147)
at Domain1ListServ.doPost(Domain1ListServ.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Unknown Source)
05/01/13 20:05:11 web/Product: Servlet error
java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at Domain1ListServ.findDomain1s(Domain1ListServ.java:147)
at Domain1ListServ.doPost(Domain1ListServ.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Unknown Source)
05/01/13 20:05:11 web/Product: Servlet error
java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at Domain1ListServ.findDomain1s(Domain1ListServ.java:147)
at Domain1ListServ.doPost(Domain1ListServ.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Unknown Source)
05/01/13 20:09:09 web/Product: Servlet error
java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at Domain1ListServ.findDomain1s(Domain1ListServ.java:147)
at Domain1ListServ.doPost(Domain1ListServ.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Unknown Source)

After fixing ibatis issues, the app finally worked but lost hours of precious time. I just wonder, why why why does the container takes out the class, which is suppose to call a DAO which is initialized with ibatis dao framework and make it a whole lot difficult to troubleshoot?

No comment yet.

Leave a Reply