cancel
Showing results for 
Search instead for 
Did you mean: 

java.lang.LinkageError : loader constraints violated when linking

Former Member
0 Kudos

Hi,

I had a A_EJB and A_WEB program. I create an EAR and deployed to the server. I used my A_EJB.jar file as an external library file for my new B_EJB and B_WEB. Added as external JAR. When i deploy and run it, i hit this error.

My A_EJB do include the sapjco.jar and also B_EJB also include the sapjco.jar as external library.


Caused by: java.lang.LinkageError: loader constraints violated when linking com/sap/mw/jco/JCO$Table class

This is when i want it run this command as I'm declaring the JCO.Table


JCO.Structure DetStructure = function.getImportParameterList().getStructure("MESSAGE");
JCO.Table DetTable = function.getTableParameterList().getTable("DET");

Before i declare this table i do have a declare the structure as i show at the top. The Structure don't have any error but the table hit error. Syntax i pretty sure is correct as i used this for others table. Doesn't have any problem.

I tried to google out regarding this java.lang.LinkageError. Found out that is related to classloader problem. As the object class is package in EJB and WEB. It asked me to remove the class and will solve the problem. I did it and seem still having the problem. The weird is previously it work and suddenly it caught in this error. It is not stable as sometime work sometime not.

Any way to solve this?

Thanks in advance for helping.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

The JCO jar must not be a part of the EJB. It has to be declared as a application reference in the application-j2ee-engine.xml EAR descriptor file.

The linkage error is basically caused by the native part of the JCO library.

Tsvetomir

Former Member
0 Kudos

Hi Tsvetomir,

Thanks for your info.

I tried to remove all the External JAR from my build path and add as variable for sapjco.jar and jrfc.jar as previously i include as external JAR in my EJB. If i don't include it in my EJB application, i unable to import that lib in my program.

In the EAR i did include it in application-j2ee-engine.xml. Seem like still having the same problem.

Just a quick question. Wondering how come the JCO.Structure is working but it only have problem with the JCO.Table.

Thanks for your help.

-


I think after i restart the server, it seem working. Will continue to test it as previously i tested few times is working, then later is not working again. Hope this time it works.

Thanks.

Edited by: Adrian Chan on May 12, 2009 5:44 AM

-


I had tested my program. Now is working fine.

Thanks for your help.

Edited by: Adrian Chan on May 12, 2009 12:00 PM

Answers (0)