2

I have a problem deploying an EAR application on Weblogic 10.3.5 using Reflections 0.9.9-RC1 jar.

With default classloader (weblogic.utils.classloaders.ChangeAwareClassLoader@396e8d0 finder: weblogic.utils.classloaders.CodeGenClassFinder@5bcfadd) I get this error:

ExecuteThread: 2 for queue: weblogic.kernel.Default (self-tuning)] - could not create Dir using jarFile from url file:/D:/Servers/Oracle10.3.5/patch_wls1035/profiles/default/sys_manifest_classpath/weblogic_patch.jar. skipping.
   java.lang.NullPointerException: null
   at java.util.zip.ZipFile.<init>(ZipFile.java:108) ~[na:1.6.0_24]
   at java.util.jar.JarFile.<init>(JarFile.java:135) ~[na:1.6.0_24]
   at java.util.jar.JarFile.<init>(JarFile.java:99) ~[na:1.6.0_24]
   at org.reflections.vfs.Vfs$DefaultUrlTypes$1.createDir(Vfs.java:207) ~[reflections-0.9.9-RC1.jar:na]
   at org.reflections.vfs.Vfs.fromURL(Vfs.java:99) [reflections-0.9.9-RC1.jar:na]
   at org.reflections.vfs.Vfs.fromURL(Vfs.java:91) [reflections-0.9.9-RC1.jar:na]
   at org.reflections.Reflections.scan(Reflections.java:231) [reflections-0.9.9-RC1.jar:na]
   at org.reflections.Reflections.scan(Reflections.java:204) [reflections-0.9.9-RC1.jar:na]
   at org.reflections.Reflections.<init>(Reflections.java:129) [reflections-0.9.9-RC1.jar:na]

ExecuteThread: 2 for queue: weblogic.kernel.Default (self-tuning)] - could not create Vfs.Dir from url. ignoring the exception and continuing
   org.reflections.ReflectionsException: Could not open url connection
   at org.reflections.vfs.JarInputDir$1$1.<init>(JarInputDir.java:36) ~[reflections-0.9.9-RC1.jar:na]
   at org.reflections.vfs.JarInputDir$1.iterator(JarInputDir.java:32) ~[reflections-0.9.9-RC1.jar:na]
   at org.reflections.Reflections.scan(Reflections.java:231) ~[reflections-0.9.9-RC1.jar:na]
   at org.reflections.Reflections.scan(Reflections.java:204) ~[reflections-0.9.9-RC1.jar:na]
   at org.reflections.Reflections.<init>(Reflections.java:129) ~[reflections-0.9.9-RC1.jar:na]

And this is the code part:

List<ClassLoader> classLoadersList = new LinkedList<ClassLoader>();
classLoadersList.add(Thread.currentThread().getContextClassLoader());

Reflections ref = new Reflections(new ConfigurationBuilder()
                .setScanners(new SubTypesScanner(false /* don't exclude Object.class */), new ResourcesScanner())
                .setUrls(ClasspathHelper.forClassLoader(classLoadersList.toArray(new ClassLoader[0])))
                .filterInputsBy(new FilterBuilder().include(FilterBuilder.prefix(p))));

I have also tried to get the classloader from this:

//classLoadersList.add(ClasspathHelper.contextClassLoader());
//classLoadersList.add(this.getClass().getClassLoader());
//classLoadersList.add(ClasspathHelper.staticClassLoader());

But it returns the same classloader in all of them.

In localhost if I put the jar in the specified directory, it works obviously, but I don't have that option in the server in which it will be deployed.

Any suggestions?

JSP749
  • 127
  • 1
  • 3
  • 12

2 Answers2

0

Make sure you get correct urls from one of the ClasspathHelper.forXXX methods, and that those urls exists and accessible.

You probably didn't want to scan weblogic_patch.jar but your application's jars.

zapp
  • 1,533
  • 1
  • 14
  • 18
0

Your code is ok, i have the same issue. This issue is related with the treatment of one internal exception that never is thrown...

I have submitted to Reflections one possible corrective:

https://groups.google.com/forum/#!topic/google-code-reflections/EtwuzC_Eesc

Azimuts
  • 1,212
  • 4
  • 16
  • 35