Solved

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

Posted on 2004-04-20
9
2,339 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:Mayank S
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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 30

Expert Comment

by:Mayank S
ID: 10867773
Also - could you please post the complete stack-trace? I have a feeling that there could be a nested "access denied".
0
 
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:Mayank S
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sites similar to codingbat to improve coding hanson skills 3 49
servlet doXXX methods 3 47
by zero exception 10 39
Java string replace 11 43
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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

813 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

11 Experts available now in Live!

Get 1:1 Help Now