java - Google reflections on Websphere - Could not open url connection -
i'm having project in i'm using google reflections , deploying project on websphere liberty profile.
my project has following code, transformer.class location in dependency jar
private void bindtransformers(simpleregistry initialcontext) throws exception { reflections reflections = new reflections("no.mypackage.ntrouter"); final set<class<?>> transformerclasses = reflections.gettypesannotatedwith(transformer.class); (class<?> aclass : transformerclasses) { initialcontext.put(aclass.getsimplename(), aclass.newinstance()); } }
but reflections not work, getting following error:
2015-04-23 09:34:29,817 [ecutor-thread-5] warn reflections - not create vfs.dir url. ignoring exception , continuing org.reflections.reflectionsexception: not open url connection @ org.reflections.vfs.jarinputdir$1$1.<init>(jarinputdir.java:36) @ org.reflections.vfs.jarinputdir$1.iterator(jarinputdir.java:32) @ org.reflections.reflections.scan(reflections.java:231) @ org.reflections.reflections.scan(reflections.java:204) @ org.reflections.reflections.<init>(reflections.java:129) @ org.reflections.reflections.<init>(reflections.java:170) @ org.reflections.reflections.<init>(reflections.java:143) @ no.norsktipping.ntrouter.chain.myservletcontextlistener.bindtransformers(myservletcontextlistener.java:56) @ no.norsktipping.ntrouter.chain.myservletcontextlistener.contextinitialized(myservletcontextlistener.java:29) @ com.ibm.ws.webcontainer.webapp.webapp.notifyservletcontextcreated(webapp.java:2388) @ com.ibm.ws.webcontainer.webapp.webapp.initialize(webapp.java:1048) @ com.ibm.ws.webcontainer.webapp.webapp.initialize(webapp.java:6404) @ com.ibm.ws.webcontainer.osgi.dynamicvirtualhost.startwebapp(dynamicvirtualhost.java:446) @ com.ibm.ws.webcontainer.osgi.dynamicvirtualhost.createrunnablehandler(dynamicvirtualhost.java:248) @ com.ibm.ws.webcontainer.osgi.dynamicvirtualhost.createrunnablehandler(dynamicvirtualhost.java:313) @ com.ibm.ws.http.internal.virtualhostimpl.discriminate(virtualhostimpl.java:241) @ com.ibm.ws.http.dispatcher.internal.channel.httpdispatcherlink.ready(httpdispatcherlink.java:306) @ com.ibm.ws.http.channel.internal.inbound.httpinboundlink.handlediscrimination(httpinboundlink.java:449) @ com.ibm.ws.http.channel.internal.inbound.httpinboundlink.handlenewrequest(httpinboundlink.java:383) @ com.ibm.ws.http.channel.internal.inbound.httpinboundlink.processrequest(httpinboundlink.java:283) @ com.ibm.ws.http.channel.internal.inbound.httpinboundlink.ready(httpinboundlink.java:254) @ com.ibm.ws.tcpchannel.internal.newconnectioninitialreadcallback.sendtodiscriminators(newconnectioninitialreadcallback.java:174) @ com.ibm.ws.tcpchannel.internal.newconnectioninitialreadcallback.complete(newconnectioninitialreadcallback.java:83) @ com.ibm.ws.tcpchannel.internal.workqueuemanager.requestcomplete(workqueuemanager.java:504) @ com.ibm.ws.tcpchannel.internal.workqueuemanager.attemptio(workqueuemanager.java:574) @ com.ibm.ws.tcpchannel.internal.workqueuemanager.workerrun(workqueuemanager.java:929) @ com.ibm.ws.tcpchannel.internal.workqueuemanager$worker.run(workqueuemanager.java:1018) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1110) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:603) @ java.lang.thread.run(thread.java:722) caused by: java.io.filenotfoundexception: jar entry not found in <address>/usr/servers/chainrouter/workarea/org.eclipse.osgi/56/data/cache/com.ibm.ws.app.manager_7/.cache/web-inf/lib/routerutils-1.0-snapshot.jar @ com.ibm.ws.artifact.url.internal.wsjarurlstreamhandler$wsjarurlconnectionimpl.getinputstreaminternal(wsjarurlstreamhandler.java:283) @ com.ibm.ws.artifact.url.internal.wsjarurlstreamhandler$wsjarurlconnectionimpl.getinputstream(wsjarurlstreamhandler.java:264) @ org.reflections.vfs.jarinputdir$1$1.<init>(jarinputdir.java:35) ... 29 more 2015-04-23 09:34:29,826 [ecutor-thread-5] warn reflections - not create vfs.dir url. ignoring exception , continuing org.reflections.reflectionsexception: not create vfs.dir url, no matching urltype found [wsjar:file:<address2>/chainrouter/target/chainrouter-1.0-snapshot.war!/web-inf/classes/] either use fromurl(final url url, final list<urltype> urltypes) or use static setdefaulturltypes(final list<urltype> urltypes) or adddefaulturltypes(urltype urltype) specialized urltype. @ org.reflections.vfs.vfs.fromurl(vfs.java:109) @ org.reflections.vfs.vfs.fromurl(vfs.java:91) @ org.reflections.reflections.scan(reflections.java:231) @ org.reflections.reflections.scan(reflections.java:204)
could not create vfs.dir url, no matching urltype found [wsjar:file:
it looks reflections added support wsjar: url's hasn't had release since 2013.
https://code.google.com/p/reflections/issues/detail?id=158 https://code.google.com/p/reflections/downloads/list
you'll need patch.