Closed GoogleCodeExporter closed 8 years ago
Any updates on this issue?
I am currently deploying a war in weblogic 10.3.5. and I assume I am having the
same problem.
Weblogic compiles all the classes from WEB-INF\classes\ into 1 single jar.
When you instantiate Reflections it detecs the URL for that jar but can't find
the classes in it.
Original comment by oliveira...@gmail.com
on 7 Sep 2012 at 3:25
I've done the following. First, I created a class VfsUtilExporter to export
the getFile from package private to public. I then added the following code
before constructing Reflections:
Vfs.addDefaultURLTypes(new Vfs.UrlType() {
public boolean matches(URL url) {
return "zip".equals(url.getProtocol());
}
public Dir createDir(final URL url) throws Exception {
return new ZipDir(new JarFile(VfsUtilExporter.getFile(url)));
}
});
Seems to work here so far...
Original comment by ja...@pollock.ca
on 15 Oct 2012 at 8:25
Jason,
would you mind explaining what VfsUtilExporter.getFile is doing? I'm not sure I
understood your comment 'export the getFile from package private to public'
I'm having the same issue with weblogic 10.3.5/6 and I'd like to try your
solution before I give up and rewrite my annotations discovery code.
Many Thanks
Original comment by justinma...@googlemail.com
on 30 Oct 2012 at 6:13
I added this to my jar. :) It wraps the getFile method, which is package
private and makes it visible.
package org.reflections.vfs;
import java.net.URL;
/**
* Export a single method from package private to public.
*/
public final class VfsUtilExporter {
/** Default constructor, private because this is a utility class. */
private VfsUtilExporter() { }
/**
* Call Vfs.getFile.
* @param url The url to convert to a file.
* @return The file represented by the URL.
*/
public static java.io.File getFile(final URL url) {
return Vfs.getFile(url);
}
}
Original comment by ja...@pollock.ca
on 30 Oct 2012 at 7:52
:) duh...obviously going soft in the head after trying to (finally) migrate
from OC4J to WebLogic
Thanks for quick response. I'll try what you've posted but I also found an
alternative solution through spring utils which is OK for my app as it's Spring
based.
http://www.docjar.com/html/api/org/springframework/util/ResourceUtils.java.html
It looks like it handles more edge cases than Vfs.getFile (weblogic, oc4j,
websphere) so could be useful to other people experiencing a similar issue with
those app servers where the Vfs solution won't necessarily work.
Thanks again, J
Original comment by justinma...@googlemail.com
on 31 Oct 2012 at 3:13
Just ran into the same problem, using the workaround documented here. I vote
for an update of the reflections library. Maybe the UrlType should not be added
to the defaultUrlTypes on behalf of the reflections library, but at least an
implementation of some class ZipJarUrlType implements UrlType should be added
to the reflections library so that it can easily be added to the
defaultUrlTypes by the programmer when needed.
Original comment by post.at....@googlemail.com
on 12 Dec 2012 at 1:05
fixed on trunk, comments are welcomed
Original comment by ronm...@gmail.com
on 20 Feb 2013 at 9:04
Hi
Using the reflections api (version 0.9.8) and ran into this issue when
deploying on weblogic (it works fine when running on tomcat). Used the solution
proivded by @pollock.ca and it works fine Thanks.
Could you let us know when a new version will be out since the issue has been
fixed now in the trunk?
Thanks
O.
Original comment by OFad...@gmail.com
on 25 Feb 2013 at 11:08
I am also having this issue with weblogic, and I am pleased to read that this
has been "fixed on trunk".
Do you have a nightliy snapshot build somewhere, or do I need to download the
source and compile it with my project?
Thanks for help
Stefan
Original comment by sniffert...@gmail.com
on 4 Mar 2013 at 1:01
Stefan,
for now only on the trunk. would you be kind and check if it works for you and
comment here?
svn checkout http://reflections.googlecode.com/svn/trunk/ reflections
cd reflections
mvn install
Original comment by r...@jfrog.com
on 4 Mar 2013 at 1:04
Worked fine.
But you should put a snapshot build to a public nexus instance somewhere...
Thanks
Original comment by sniffert...@gmail.com
on 7 Mar 2013 at 10:40
Any update about uber jar containing this fix?
Original comment by he...@platfora.com
on 22 Jul 2013 at 6:50
Have created a workaround / fix for OC4J.
Its on github: https://github.com/keesvandieren/reflections-oc4j
It depends on the Spring Framework to do some resource classloading for OC4J.
Original comment by keesvand...@gmail.com
on 29 Jul 2013 at 6:55
[deleted comment]
Handling the ZIP protocol worked for me.. thanks!
Original comment by dmanye...@gmail.com
on 27 Sep 2013 at 2:06
Original issue reported on code.google.com by
aquipor...@gmail.com
on 1 Aug 2012 at 3:58Attachments: