Skip to main content

Help with service factory...

2 replies [Last post]
Iaiken
Offline
Joined: 2006-02-17
Points: 0

I am attempting to use a service factory to produce a service for me, the code is copyrighted so I can't post it. However, the line that it trows the exception on is a constructor within the service constructor as follows.

public MessageService() {
appContainer = ApplicationContainer.getInstance();
messageManager = appContainer.getMessageManager();
messageDAO = new MessageDAO(); //big bad error here. See below for details.
}

Any help would be greatly appreciated...

java.lang.ClassFormatError: com/theIMO/inui/dao/MessageDAO (Code attribute is absent in method that is not abstract or native)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1643)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:937)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1372)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1254)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at com.theIMO.inui.service.MessageService.(MessageService.java:40)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:306)
at java.lang.Class.newInstance(Class.java:259)
at com.theIMO.inui.service.ServiceFactory.createService(ServiceFactory.java:39)
at com.theIMO.inui.actions.BaseAction.getService(BaseAction.java:34)
at com.theIMO.inui.actions.AddMessageAction.execute(AddMessageAction.java:66)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:536)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
FerAJ
Offline
Joined: 2006-02-17
Points: 0

Hi!

I found a problem like yours.
When executing my class, I saw the same message: Code attribute is absent in method that is not abstract or native

I copied some code from my teacher's .ppt file by selecting the code, cntl+c and after cntrl+v to put it into my class.

Maybe the enters (or another thing) are codified different in the .pps files than JBuilder 9's editor, because I copied it again by myself (word by word) and that problem dissappered.

Good bye :)

this is jackieding
Offline
Joined: 2006-02-17
Points: 0

hi,i also has the problem.
And at last i find the bug.
u say there is something wrong in
messageDAO = new MessageDAO();

i think,i forget to add "abstract" in the class
which is abstract and extends from class dao.
Just see the stype
public abstract class myDao extends dao{
public abstract daoMethod();
}

u can contact me if have any questions.
Thanks.
My email is dingjq@21cn.com
From china.