• Post Reply Bookmark Topic Watch Topic
  • New Topic

Class name clash  RSS feed

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i have 2 class files with the same name in 2 diff jar files.
Also the hierrachy is the same for both class files.
ie com/package/hello.class in jar1
and com/package/hello.clas in jar2

Now i have placed these 2 jar files in the lib dir of websphere.

Not sure at runtime, which class files will get instantiated.

Please let me know if you come across such a issue.

Thanks in advance.
 
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no way to tell which will be loaded first; it most likely depends on which jar file is opened first.

The whole point of using hierarchical package names is to help you avoid collisions; why has the same package name been used for two different projects?
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can either open your websphere admin console and seek for the path of your library jars
or you can manually modify from the below files
IBM\WebSphere\AppServers\profiles\AppSrv01\config\cells\DARONNode01Cell\nodes\DARONNode01\servers\server1\libraries.xml

again, it is impossible to load 2 same classes with the same package at the same time
so if you want to load jar1's hello.class, make sure the jar1 is set on the top of jar2 inside the xml file
 
Raja Sathci
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Daron,
In our environment the websphere's "libraries.xml" had only the IBM's jar file, couldnt find my application jar files listed.
Could you please let me know more about this "libraries.xml" file.

Regards,
Raja
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!