Solved

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

Posted on 2004-04-20
9
2,372 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
Technology Partners: 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 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

688 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