Why is this exception happening?
See EDIT 2
Hello, I'm stumped of why this exception is happening
exception
javax.servlet.ServletException: Error instantiating servlet class controllers.Dashboard
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.ja开发者_如何学Pythonva:852)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Thread.java:662)
root cause
java.lang.RuntimeException: Uncompilable source code - missing method body, or declare abstract
DAO.OrderDAO.(OrderDAO.java:68)
BO.OrderForm.(OrderForm.java:33)
controllers.Dashboard.(Dashboard.java:23)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
java.lang.Class.newInstance0(Class.java:355)
java.lang.Class.newInstance(Class.java:308)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Thread.java:662)
At first I was getting this in NetBeans 6.9.1 and continued to search and found this
weird bug after trying th solution posted to no success I decided to switch IDE, so I downloaded the Intellij IDE 9 (loving it so far) and still got the same exception!! I mean come on.., the only three classes that do not belong to common libs are the DAO
,BO
and controllers
packages and they a
Now I'm lost as the code exists and there no colon typo or anything.
EDIT 1:
removed the source code of DAO.OrderDAO.java
, BO.OrderForm.java
and controllers.OrderSearch.java
as it was concluded that the problem was caused by one of the below classes (which one is yet to be determined.) So I configured IntelliJ debugger to stop whenever a Exception
is thrown and I have a ClassNotFoundException
being thrown in looking for the class org.apache.catalina.startup.bootstrap
I'm unsure if this has to do with PATH
variables because I have downloaded the apache-tomcat-6.0.30 and I verified that the troublesome class is there., Any suggestions?
Edit 2:
Switched back to NetBeans 6.9.1 added a bunch of libraries, the Runtime exception stopped, however I'm stuck again with the above exception and stack trace and I reiterate the method body is there!!. A link to the complete trace, the password is 1234
its right there in your stack trace
java.lang.RuntimeException: Uncompilable source code - missing method body, or declare abstract
You didn't show us all the code so I can't pinpoint it exactly, but it seems you have a class that extends an Abstract class, and you are not providing the implementation of a method that is abstract in the super class. So, as the exception says, you can either:
- Implement the missing method
- Make the class abstract, and provide the implementation in a subclass.
you probably want option 1.
EDIT -- you are going to have to dig down into the call stack. You are probably using some sort of external API, extending one of their classes that is abstract. Somewhere in these lines
at DAO.OrderDAO.(OrderDAO.java:68)
at BO.OrderForm.(OrderForm.java:33)
at controllers.OrderSearch.(OrderSearch.java:43)
I have seen your code and your exception. I am going to format by answer as coherently as possible, so any factual mistakes can be caught ( and mocked ;))
1- The Code is compilable. So the problem obviously is build process. May be the IDE is maintaining a stale cache.
Did you clean out the old build location? Use maven rather than depending on IDE build process? (especially Netbeans (let me do 100 things badly IDE))
Did you also check the packaged file. (.jar). Does the file size and timestamp make sense.
2- You switched IDE and got the same exception. (thumbs up for choosing IDEA 9)
This is tricky. How are you deploying the application to server? How are you building it.
Conclusion: Assuming the build is latest and you are deploying the latest build, did you check if there are spurious occurrence of the old jar in the server runtime. May be there is a lingering jar file somewhere in tmp or with different name. I will try deploying in another server.Or restart server and clean up server tmp locations.
java.io.NotSerializableException: DTO.ColorDTO
It seems ColorDTO
doesn't implement Serializable
AND / OR
java.lang.RuntimeException: Uncompilable source code - missing method body, or declare abstract
at DAO.OrderDAO.<init>(OrderDAO.java:68)
at BO.OrderForm.<init>(OrderForm.java:33)
OrderDAO
doesn't implement all the methods that it should implement or make it abstract and provide its implementation in subclass at last everything should be concrete.
Hello all sorry for not posting, the issue got solved, I just kept coding until one time I compiled and it stopped throwing the exception, I kept using IntelliJ by the way.I believe it was the cache but who knows, maybe we'll never now....Thanks to everyone for their support.
精彩评论