?
Solved

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

Posted on 2004-04-20
9
Medium Priority
?
2,395 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 1500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Suggested Courses
Course of the Month8 days, 23 hours left to enroll

764 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