|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Linkage Error because same class name |
« View previous topic :: View next topic » |
Author |
Message
|
Frik |
Posted: Tue Jul 21, 2020 1:10 am Post subject: Linkage Error because same class name |
|
|
Acolyte
Joined: 25 Nov 2009 Posts: 69
|
Hey there!
I'm trying to deploy java project and Library that have procedure that calls a method.
Everything worked fine and the project could be deployed fine.
Yesteday I added some code to the java function, and now the Bar is created well like before but the project can't be deployed because of Linkage error.
The error problem was messy so I tried couple of things and got to a conclusion that it happens because I use the same class name on different lines:
one is the Document from "org.w3c.dom.Document" and one is Document from "org.bson.Document".
when the second one is deleted - the project can be deployed as usual.
I tried to export the java project to jar - and it is also works fine, so it seems like a broker problem.
Did you have something alike? Can you please assist? |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jul 21, 2020 6:21 am Post subject: Re: Linkage Error because same class name |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Frik wrote: |
Hey there!
I'm trying to deploy java project and Library that have procedure that calls a method.
Everything worked fine and the project could be deployed fine.
Yesteday I added some code to the java function, and now the Bar is created well like before but the project can't be deployed because of Linkage error.
The error problem was messy so I tried couple of things and got to a conclusion that it happens because I use the same class name on different lines:
one is the Document from "org.w3c.dom.Document" and one is Document from "org.bson.Document".
when the second one is deleted - the project can be deployed as usual.
I tried to export the java project to jar - and it is also works fine, so it seems like a broker problem.
Did you have something alike? Can you please assist? |
This is standard Java.
In the same file you cannot use the same short reference for classes out of 2 different packages.
You can use one short name and any fully qualified name ( including the package).
So if you define
Code: |
import org.w3c.dom.Document
....
Document mydoc = new Document(); // or something
org.bson.Document another doc = new org.bson.Document(); // notice the use of the full class name... |
you'd be good.
Also please notice there is no importing the org.bson.Document. If you do that you'd have to use the full classname for both declarations...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Frik |
Posted: Wed Jul 22, 2020 1:44 am Post subject: Re: Linkage Error because same class name |
|
|
Acolyte
Joined: 25 Nov 2009 Posts: 69
|
This is exactly how my code looks like, with the full class name for them both. and the problem persists and cannot be compiled.
It's working fine on my computer outside the broker. Only compiling on integration server creates linkage error.
I get
Quote: |
BIP3202E: (esb.infra.getServiceDB, 1.1) : An error occurred when trying to resolve the Java class or method 'il.co.fibi.esb.ServiceCatalogMongo.getService' which is referred to by the routine 'getServiceDB'.
Further messages are generated that explain the error in more detail.
Correct the syntax of your Java expression in node 'esb.infra.getServiceDB', around line and column '1.1', then redeploy the message flow.
BIP3248E: The Java Method 'il.co.fibi.esb.ServiceCatalogMongo.getService' could not be loaded due to a linkage error. It depends on the class '' which could not be found in the deployed bar file or in the 'workpath/shared-classes/' directory.
|
all files are in the /var/mqsi/shared-classes,
and the workpath defined correctly as "/var/mqsi".
So weird. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jul 22, 2020 7:19 am Post subject: Re: Linkage Error because same class name |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Frik wrote: |
This is exactly how my code looks like, with the full class name for them both. and the problem persists and cannot be compiled.
It's working fine on my computer outside the broker. Only compiling on integration server creates linkage error.
I get
Quote: |
BIP3202E: (esb.infra.getServiceDB, 1.1) : An error occurred when trying to resolve the Java class or method 'il.co.fibi.esb.ServiceCatalogMongo.getService' which is referred to by the routine 'getServiceDB'.
Further messages are generated that explain the error in more detail.
Correct the syntax of your Java expression in node 'esb.infra.getServiceDB', around line and column '1.1', then redeploy the message flow.
BIP3248E: The Java Method 'il.co.fibi.esb.ServiceCatalogMongo.getService' could not be loaded due to a linkage error. It depends on the class '' which could not be found in the deployed bar file or in the 'workpath/shared-classes/' directory.
|
all files are in the /var/mqsi/shared-classes,
and the workpath defined correctly as "/var/mqsi".
So weird. |
Looks like this is more of class not found due to a class loader problem. Check how you are deploying all those jar files and what is in scope for the class loader.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Frik |
Posted: Wed Jul 22, 2020 8:23 am Post subject: Re: Linkage Error because same class name |
|
|
Acolyte
Joined: 25 Nov 2009 Posts: 69
|
Quote: |
Looks like this is more of class not found due to a class loader problem. Check how you are deploying all those jar files and what is in scope for the class loader.  |
The jars I'm using are in the shared-classes folder.
They are included correctly like the other jars.
What can be the problem?
[/quote] |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|