Solved

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

Posted on 2004-04-20
9
2,346 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
custom annotations 9 42
maven module vs maven project 3 46
eclipse console opening separately 2 29
ejb entity bean example 2 11
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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 third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
The viewer will learn how to implement Singleton Design Pattern in Java.

856 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