janithb / reflections

Automatically exported from code.google.com/p/reflections
Do What The F*ck You Want To Public License
0 stars 0 forks source link

Cannot find subtypes on WebSphere Application Server #158

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Create a Reflections object (new Reflections(packageName))
2.Call getSubTypesOf(Class T)

What is the expected output? What do you see instead?
It should return all the subtypes of the T class. I get an empty Set instead.

What version of the product are you using? On what operating system?
Version: 0.9.9-RC1
OS: Windows 7

Please provide any additional information below.

The same application works fine in Tomcat or JBoss. I tried to debug and it 
seems that the problem is in ClasspathHelper.forResource(). 
classLoader.getResources(resourceName) doesn't return anything(in JBoss it 
returns all the jars that contain the resourceName )

Original issue reported on code.google.com by razvan.d...@gmail.com on 12 Sep 2013 at 9:35

GoogleCodeExporter commented 8 years ago
use one of the different ClasspathHelper methods to find the corrent urls 
(which one works for your case?)
then pass the (correct) urls when creating the Reflections instance.

Original comment by ronm...@gmail.com on 12 Sep 2013 at 12:11

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I did some more research on this issue and these are my conclusions:
1. In order to find all the jars that contain a package in websphere AS, you 
must set the  com.ibm.ws.classloader.strict parameter (see 
http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/topic/com.ibm.websphere.nd
.multiplatform.doc/info/ae/ae/xrun_jvm.html)

2. The path in the URLs has this format file:/<path-to-jar>! and the protocol 
is wsjar. Because of this, the call to Vfs.getFile(url) does not return the 
File. 

I think that adding an if clause with the "wsjar:" prefix in the last try-catch 
block would solve this issue. It worked in my case, but I can't submit a patch 
suggestion.

Thank you.

Original comment by razvan.d...@gmail.com on 16 Sep 2013 at 9:51

GoogleCodeExporter commented 8 years ago
always hated WAS. 
thanks for the patch, darju. will be merged.
https://code.google.com/p/reflections/issues/detail?id=159

Original comment by ronm...@gmail.com on 17 Sep 2013 at 6:14

GoogleCodeExporter commented 8 years ago
running into this now, any ETA on RC2?

Original comment by lukewpat...@gmail.com on 2 Nov 2013 at 1:38

GoogleCodeExporter commented 8 years ago
Same issue, tried the patch, did some research (see below).

Problem:
Scanning doesn't find anything on WebSphere 7.

Solution?
https://groups.google.com/d/msg/datacleaner-notify/LZQFh08reHU/naOldORvzPAJ
(I looked at the code in Spring, and unlike Apache Camel, they don't have a 
specialized classloader or anything. They open the jar as zip-file and read it 
out, see their code, it's doable to understand it.).

Some things I tried:
WebSphere 7:
Add the patch and the "com.ibm.ws.classloader.strict" parameter.
-> This works!
Problem is that administrators don't like to customize parameters.

WebSphere Application Server V8.5.5 Liberty Profile:
On WAS Liberty Profile (WASLP) I could make it work without the patch or the 
parameter. The only thing I had to do for that is alter the result set of 
ClasspathHelper.forPackage("my.package.prefix"). If you just alter the URLs to 
start with "jar:" instead of "wsjar:" it already works (this is related to the 
patch of course).
-> This doesn't work on WebSphere 7 (tested it).

If needed, contact me for more info. I don't have it at hand now, but I have a 
trace of my research that I can share.

From what I saw it should be doable to read jars like Spring does it while not 
having to change anything to the reflections api.

Keep up the good work and yearly releases :-).

Original comment by bram.bog...@gmail.com on 21 Jan 2014 at 7:30

GoogleCodeExporter commented 8 years ago
Bram, would you be able to submit a pull request on that issue?
Thanks for the feedback.

Original comment by ronm...@gmail.com on 5 Jun 2014 at 7:12