on 07-14-2015 7:21 PM
Hello, i have this java application that uses JCO to connecto to SAP backend system and it's working fine.
Next i wanted to try those classes inside a web application. I'm using Struts 1.3 and Glassfish 4.1 and inside the web app it's not working, i get the following message:
java.lang.ExceptionInInitializerError: JCo initialization failed with java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path
Does someone know what could be wrong? The sapjco3.jar file is in the projects libraries. I don't know what is missing, since it's working in my java app that's not web (just some classes).
I added the complete path on the VM options and escaped that error, but now i'm getting this one:
java.lang.NoClassDefFoundError: Could not initialize class com.sap.conn.jco.rt.JCoRuntimeFactory
Hi Fernando,
the latter exception I can't explain without seeing more context, the first one is caused by the fact that JCo does not find its native library. Instead of adding the path to the VM options, please try to put the native library next to the sapjco3.jar that's the first place JCo is looking for it. In case the second issue remains then, a deeper look in the context would be required.
Best regards,
Markus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Markus,
In fact de sapjco3.dll and sapjco3.jar are in the same directory.
I can get it to work on a simple java project, i think that the problem comes in terms of where to place those libraries (or something like that) in the glassfish deployment.
I'm using Netbeans+Glassfish by the way.
Hope this helps.
Thanks Markus.
Hi Fernando,
I recommend not to deploy the JCo files together with your application.
Even if you get it to work, you might get into trouble if multiple applications do the same and the native library would be loaded multiple times then. JCo can only be loaded once in a process.
If possible, either create some separate project which can be referenced by all other applications or add the JCo into the web application server startup classpath.
Best regards,
Stefan
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.