on 05-11-2007 11:14 AM
Hello!
I created a WebDynpro project and want to reference some classes from an existing Java project created in NWDS. I added a Project Reference to the Java project, added the project to the Java Build Path and selected it for export in the project properties of the WebDynpro project.
During design time, everything ist fine; I can reference all packages and classes in my Java project from the WebDynpro project. Deployment shows no errors, but at Runtime, I get a NoClassDefFoundError when I hit the first reference to one of the Java projects classes.
Any hints on what I'm missing or doing wrong or any links to ressources where I might find something helpful ?
I suggest to use DC's instead of simple projects.
So Solution for DCs:
1. go to Java project and create public part with type 'assembly' - include to it all the classes you need (and there dependences also)
2. go to the WD project. open used DC and add reference to the JavaDC (use pp from the step 1) with parameter build time
3. build WD DC - and go to the \_comp\gen\default\deploy\*.ear file. open it, open wda file inside it. Than \PORTAL-INF\lib\ - it should contain jar file from java dc
4. deploy WD dc
now all should work fine.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot! After creating DC's (one of type "Java" and one of type "WebDynpro"), exposing all classes in a public part of type "compilation" and in another public part of type "assembly" and adding the DC as UsedDC in the WebDynpro DC, the Java classes are being found in the WebDynpro.
Now, I do have another problem since the Java DC needs to use an external jar. I put this into another DC of type "External Library", exposed the jar file in two public parts (one assembly, one compilation) and selected the Library DC as a used DC to my Java DC.
At runtime, I get an error from the class loader; the jar doesn't seem to be present after deployment.
Any hints ?
I am having a similar problem.
I have a Java DC, External Library DC and a Web Dynpro DC.
I've exposed the Java DC and External Library DC stuff with Public Parts. Then I've defined Used DCs in the Java DC pointing to External Library DC and Used DCs in the Web Dynpro DC pointing to the Java DC (and later to the External Library DC also just in case).
When I deploy the Web Dynpro DC the jar file for the Java DC is in the .wda file but the jar from the External Library is NOT!
When I try to run the Web Dynpro app on server it fails with class not found.
Has anyone been able to make this work?
Thanks!
@David:
Finally, I made all this work in the following way:
Create two public parts for your External Library DC, one of type assembly, one of type compilation. Add your jar as an entity in both public parts.
Create two public parts for your Java DC, one of type assembly, one of type compilation. Add your java packages as entities in both public parts.
In your Java DC, set the compilation public part of your External Library DC as Used DC.
In your WebDynpro DC, set the assembly public part of your External Library DC as Used DC.
In your WebDynpro DC, set the assembly public part of your Java DC as Used DC.
In your WebDynpro DC, set the compilation public part of your Java DC as Used DC.
This should be sufficient, but I also set the Java DC itself as used DC in the WebDynpro DC.
Make sure your jar entity has the subtype "Java Library" in the External Library DC public parts.
HTH
Michael
Michael,
If you indeed use "Java Project" type, then the problem is obvious -- your classes is never deployed on server.
Instead, create WD project, place Java classes here, expose them via public part, __build and deploy__ WD project. Now you can refere your classes from other WD projects, just add Used DC for compilation and project reference (as you did previously).
Valery Silaev
SaM Solutions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Michael,
can you post the error trace please you obtain at runtime?
Regards,
Gianluca Barile
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Gianluca:
Is that the information you wanted ? The is the complete runtime exception chain.
java.lang.NoClassDefFoundError: myReferencedJavaNamespace/MyReferencedClassName
at lvr.ecmzu.mv.ECMZUAuskunftInputView.myWebDynproMethod(ECMZUAuskunftInputView.java:583)
at lvr.ecmzu.mv.ECMZUAuskunftInputView.onActionfindResults(ECMZUAuskunftInputView.java:231)
at lvr.ecmzu.mv.wdp.InternalECMZUAuskunftInputView.wdInvokeEventHandler(InternalECMZUAuskunftInputView.java:278)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleAction(WebDynproMainTask.java:101)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:304)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:659)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:251)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:55)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java(Compiled Code))
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java(Compiled Code))
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java(Inlined Compiled Code))
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java(Compiled Code))
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java(Compiled Code))
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java(Compiled Code))
at com.sap.engine.services.httpserver.server.Client.handle(Client.java(Compiled Code))
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java(Compiled Code))
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java(Compiled Code))
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java(Compiled Code))
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java(Compiled Code))
at java.security.AccessController.doPrivileged1(Native Method)
at java.security.AccessController.doPrivileged(AccessController.java(Compiled Code))
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java(Compiled Code))
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java(Compiled Code))
Thanks
Michael
Hi,
I think no need to import the classes from other java projects.
If u want to import any classes by
Right click->Source->Organize Imports..
Automatically it will import the classes.
Try this one.
Regards,
Lavanya.G
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.