cancel
Showing results for 
Search instead for 
Did you mean: 

How to refer to J2EE library server component from a web service?

Former Member
0 Kudos

Hi,

I need help! I created a web service and it worked fine. However, I started having problems when I tried to use java classes from my deployable J2EE library server component. I got the NoClassDefFound error.

I tried to include the library DC in the Used DC list and put the reference of it in the web service deployment descriptor xml (application.xml and application-j2ee-engine.xml), but it did not work.

How do I refer and use java classes from my deployable J2EE library at run time from my web service application? What should I do?

Thanks,

Giavinh Pham

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Additional troubleshooting information:

I tried to build the web service in different ways. I went to File -> New -> Other -> Web Service -> Web Service Archive. Then point the browse to my web service project. The EAR is generated at put to the root path of the project. This EAR works fine and point to my j2ee library.

If I used the Build option from "right click" the project to open the context menu: Development Component -> Build. The EAR is generated by this procedure will be put in the deploy folder. This EAR did not work as I mention earlier.

Why does this happen? Why can I not make a working EAR file from the second way which is the typical way to build a DC? Is the first way the right way to build a web service EAR?

Former Member
0 Kudos

Hello,

Have you resolve this problem ?

Regards

Former Member
0 Kudos

I would like to clarify more about the web service project. I created a Java DC project and converted it into a web service as the SAP manual instructions. It worked fine by itself, but I now want to use some of my classes that I deployed as a J2EE library server component.

It was compiled and built when I refer to my J2EE library server component DC in the UsedDC. It was deployed fine as well. However, it broke when I tested the web service calls. The class declarations and usage from the J2EE server component could not be found (NoClassDefFound error.)

I thought it was because I did not have an application-j2ee-engine.xml in my META-INF folder so I created one and referred to the library in xml as type library and reference 'strong'. I built and deployed again. It still did not work.

I examined the EAR and noticed that there were two parts of the EAR. One is the WSAR archive file that contains the META-INF folder from my project and other web service assemblies. The other part is the META-INF folder generated by the SAP NetWeaver IDE.

The strange thing was that SAP NetWeaver IDE generated an application-j2ee-engine.xml without any reference to my J2EE library server component. However, the nested application-j2ee-engine.xml in the WSAR archive file did contain the info.

Since I cannot control the application-j2ee-engine.xml generated by SAP NetWeaver IDE, what should I do? Is it the cause for my problem?

Please advice, anyone?

Giavinh

Former Member
0 Kudos

Hi,

did you deploy your library on the J2EE Engine? It must be deployed there (hence, its classes be available at runtime), and the reference to it should be defined in the deployment descriptors of your application (which you obviously did already.)

Here's some docu about deploying libraries:

<a href="http://help.sap.com/saphelp_nw04/helpdata/en/9f/2ade3fc6c6ec06e10000000a1550b0/frameset.htm">Using the NetWeaver Developer Studio</a>

<a href="http://help.sap.com/saphelp_nw04/helpdata/en/0c/86b46fae4039428760a11890d2a14a/frameset.htm">Using the Deploy Tool</a>

Hope that helps!

Former Member
0 Kudos

Hi Ivaylo,

Thank you for taking time to help me. I did deploy the J2EE library server component before I deployed my web service. I also put hard references in the deployment descriptor as well. I did all the required work for referencing. I think I missed something here. Since SAP Web Service is not a normal J2EE application project. I am wondering there is something specific that I would miss.