cancel
Showing results for 
Search instead for 
Did you mean: 

JCO connection from J2EE server

Former Member
0 Kudos

Hi all,

I'm trying to connect to a R/3 system with JCo. Using it within a local java project works fine. However, using the connector within a servlet gives me some trouble. I did the following:

1) created a J2EE Server Component -> Library and added the sapjco.jar to this library

2) deployed this library to the j2ee engine

3) created a web module project, added a servlet, added a reference of my library to this project so that the build path is correct

4) created an enterprise application project, referenced the web module project in it, added a reference to my library at the application-j2ee-engine.xml file.

5) deployed the enterprise project

Everything works fine until here. However, when I start my project, it throws the following error

<b>500 - Internal Server Error

java.lang.NoClassDefFoundError: null</b>

when processing the line

m_pool = JCO.getClientPoolManager().getPool(PoolName);

Just for comparision: when I remove the reference to my library within the enterprise application project, I get the following error (which is clear):

<b>500 - Internal Server Error

java.lang.NoClassDefFoundError: com/sap/mw/jco/JCO$Record</b>

Does anyone know what a <i>NoClassDefFoundError: null</i> means? Have I forgotten something?

Thank you for your feedback, I'm going to reward points to you.

Regards

Mathias

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos

Hi Mathias,

You don`t need to deploy JCO as separate library to SAP J2EE WAS. It is already there!

Just add reference in your enterprise application in file META-INF\application-j2ee-engine.xml :


<reference reference-type="hard">
 <reference-target provider-name="sap.com" target-type="library">com.sap.mw.jco</reference-target>
</reference>

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hi Maksim,

thank you very much, that worked!

However, is it the correct way to create a local J2EE Server Component -> Library referencing sapjco.jar in order to be able to build the source code on the development machine (without deploying that library)? 'Cause when adding the jar file directly via "add external jars", the file is going to be included in the resulting ear file...

By the way, is the following the right way to manage the same scenario with the BI Java SDK in order to connect to a BW system?

1) deploy the BI XMLA connector to the J2EE Engine as described in the How_To_BI_Java_SDK_J2EE_App.pdf

2) Create a local library which includes the jar files in the lib folder of the SDK

3) Reference this library on your development machine in order to be able to compile the source code

Thank you very much

Mathias