Solved

Unable to make connection to SAP using SAP's JCO in Linux environment

Posted on 2004-04-20
9
2,329 Views
Last Modified: 2012-06-27
Hi,
 I am trying to create a connection to SAP using the following piece of code

                                JCO.Client mConnection = null;
            try {
                  mConnection = JCO.createClient(this.client, // SAP client
                  this.userName.toUpperCase(), // userid
                  this.password.toUpperCase(), // password
                  this.language.toUpperCase(), // language
                  this.hostName, // application server host name
                  this.system); // system number
                  mConnection.connect();
            }catch (JCO.Exception jex) {
                  throw new Exception(jex.getMessage());
            }catch(Exception ex){
                  throw new Exception("Exception occured while creating Connection to SAP.");
            }

In windows I am able to connect to SAP system but when I execute the same in Linux environment I get the following exception.
               "Exception in thread main java.lang.ExceptionInInitializerError: JCO.classInitialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC' default_cpc_mode"


 If anyone has come across the same issue and have fixed it, please let me know. I am using JDK 1.4.2 / RedHat Linux 8.0 / sapjco-linuxintel-2.1.2

Thanks in advance,
Nimai
0
Comment
Question by:nimaig
9 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 10867697
0
 
LVL 9

Author Comment

by:nimaig
ID: 10867708
Hi,
 I have tried this out and it doesn't help.

Thanks,
Nimai
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10867762
That error means that an unexpected exception has occurred in a static initializer during evaluation or in the initializer for a static variable. Do you have any static blocks {} ? Please post their code.
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10867773
Also - could you please post the complete stack-trace? I have a feeling that there could be a nested "access denied".
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 9

Author Comment

by:nimaig
ID: 10867807
Hi,
I am pasting the stack trace of the exception I get when I run the java client.


Creating Connection using the following parameters : username -> TEST ; language -> EN ; client -> 840 password :TEST hostName 203.200.131.133
Exception in thread "main" java.lang.ExceptionInInitializerError: JCO.classInitialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'
default_cpc_mode
        at com.sap.mw.jco.JCO.<clinit>(Unknown Source)
        at SAPAdapter.createConnection(SAPAdapter.java:138)
        at SAPAdapter.main(SAPAdapter.java:19)

Thanks,
Nimai
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10868925
Looks to me like you have missing dependencies. Make sure the class com.sap.mw.jco.rfc.MiddlewareRFC and possibly other thngs in that package is/are available on the system
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 10872970
Is that the complete error message?
Can u also post the stack trace?

Did you make the shared libraries available under Linux?
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 10876600
>> I am pasting the stack trace of the exception I get when I run the java client

I also asked for any code in static blocks ;-)

>> at SAPAdapter.main(SAPAdapter.java:19)

What is that line?
0
 
LVL 9

Author Comment

by:nimaig
ID: 10876763
Hi All,
 I have resolved the issue. I put the shared library files under /usr/lib directory. Thanks for all you help.


Thanks,
Nimai
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now