on 08-30-2010 8:39 PM
Hi,
I would be thankful if someone could help me with this -
I need to call the external jar files into my EJB project - Here is what I have done and am getting runtime exception as -
java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/glance/pdf/pt/PTDoc
1. Created a EJB project" HelloWorld " using Java perspective in NWDS 7.1 called with client as HelloWorldClient and EAR project as HelloWorldEAR.
2. Am working on HelloWorld project (1st one).
3. In my code I am instantiating a class which is a class in one of the external jar file that I need to refer in my project.
4. I have set the Java Build path but it works only for the compile time and fails during runtime.
5. Have read I need to create external library DC and refer in my project "HelloWorld".
Can anyone help me with exact steps what needs to be done - during creation of external library project and then for my "HelloWorld" EJB project. How would I be able to reference or set the external library project in my EJB project?
Looking forward to hear from experts.
Thanks,
Shiv
Edited by: Shiv Khullar on Aug 30, 2010 9:39 PM
Hi Edson,
Did you get chance to see my previous reply.
Thanks,
Shiv
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shiv, you need create a Public Part of External Library and this Public Part in your DC as Used DC.
The link below have a step-by-step how to do this.
/people/bala.krishnan2/blog/2006/09/25/bid-adieu-to-bots--using-captchas
Regards,
Edson Thomaz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Edson,
The link was quite useful.
But I still have a question -
1. Do I need to convert my EJB project to Development Component first to set the dependency of external library (build time) in my EJB project. I usually work in Java perspective in NWDS and so I am use to setting the Java Build path (for classpath and related projects) using right click on project and then going to Properties -> Java Build Path.
Can I set the dependency using the Java Perspective.
2. Also since I am using "SAP NetWeaver 7.2 SP03" the way Public parts "Compilation" and "Assembly" are defined is different from the way described in the document. I think in CE 7.2, I go the "Public Parts" tab and then go to Defined Public Part and then click "Add" and create two public parts - "Compilation" and "Assembly".
Thanks again.
--Shiv
Shiv, I think that I make a mistake. If you don't have a DC, you don't need do this.
You just add you external library in lib folder (use Package Explorer tab in Java Perspective to see this folder) and right click on project and then go to Properties -> Java Build Path and click on "Add JARs" open your project and folder Lib and select the library.
Regards,
Edson Thomaz
Hi Edson,
I tried it , but it still gives me runtime exception.
javax.ejb.EJBException: nested exception is: java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/glance/pdf/pt/PTDoc
java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/glance/pdf/pt/PTDoc
Steps I performed are -
1. Created a library project and created 2 Public parts "Compilation" and "Assembly"
2. Build the library project.
Now in my EJB project using Project Explorer - set the classpath and added both compilation jar and assembly jar files.
This is how the classpath entries for external library looks like -
<classpathentry kind="lib" path="/LocalDevelopmentLocalDevelopmentexternallibrarypdftoolsforwatermarkingdemo.sap.com/gen/default/public/WatermarkAssembly/lib/java/demo.sap.comexternallibrarypdftoolsforwatermarking~WatermarkAssembly.jar"/>
<classpathentry kind="lib" path="/LocalDevelopmentLocalDevelopmentexternallibrarypdftoolsforwatermarkingdemo.sap.com/gen/default/public/WatermarkCompilation/lib/java/demo.sap.comexternallibrarypdftoolsforwatermarking~WatermarkCompilation.jar"/>
I have also added the jar files I used in my external library project as "User Library" from Java Build Path . I dont do it , then the code fails during compilation itself.
Regards,
Shiv
Hi Edson,
My mistake - I didnt explain about the library project -
Here is complete picture -
1. Created a library DC using Development Infrastructure perspective and build the assembly and compilation jar files.
2. Created EJB project using Java perspective and I am calling the library in this EJB project. The EJB project has EAR project (HelloWorldEAR), the client project(HelloWorldClient) and the project itself (HelloWorld). Now in this project i.e HelloWorld I have a class where I am trying to instantiate a class of external jar file and its failing during runtime.
Let me know incase I have missed out anything that I should have.
Thanks,
Shiv
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.