guilhem legal wrote:
> I execute your little piece of code and I obtain the following result :
>
> URI:
> file:/C:/Documents%20and%20Settings/legal/Mes%20documents/NetBeansProjects/geomatysWS/build/web/WEB-INF/classes/net/seagis/coverage/wms/
>
> file p: net/seagis/coverage/wms
> false
> URI:
> jar:file:/C:/Documents%20and%20Settings/legal/Mes%20documents/NetBeansProjects/geomatysWS/build/web/WEB-INF/lib/postgrid-1.0-SNAPSHOT.jar!/net/seagis/coverage/wms
>
> file p: net/seagis/coverage/wms
> false
>
> I suppose false is not a good answer but there are directory for sure.
>
Sigh... i am tired today, there was a bug in my code snippet, it should be:
public static void printPackageUrls(List<String> packages) throws
Exception {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
for (String p : packages) {
String fileP = p.replace('.', '/');
Enumeration<URL> urls = cl.getResources(fileP);
while (urls.hasMoreElements()) {
URL u = urls.nextElement();
System.out.println(" URI: " + u);
System.out.println("file p: " + fileP);
System.out.println(new File(u.getPath()).isDirectory());
System.out.println(new File(u.getPath()).listFiles());
}
}
}
It seems you are duplicating same package with jar file
'postgrid-1.0-SNAPSHOT.jar' and in the 'build/web/WEB-INF/classes/'
directory. But that should not cause any issues i presume.
> by the way i try some test, the WAR build by NetBeans is ggod and it
> work without the resource error. but its when i deploy with NB that the
> errors occur.
Ah, i see. NetBeans deploys using the "build/web/WEB-INF/" directory.
> for the RestFul plugin yes i have it but it is in 0.4 version so it
> doesn't match, maybe i should uninstall it.
>
It might be an issue... i would remove it just to be sure as it may
affect the configuration of Web application projects.
Paul.
> Guilhem legal
>
> Paul Sandoz a écrit :
>> guilhem legal wrote:
>>> hi again, it was not about the JDK5/6, i don't have the previous
>>> error now ony the resource problem.
>>
>> OK.
>>
>>
>>> it seems netBeans don't like too much jersey 0.5. When i build whith
>>> maven i have no problem, nut with netbeans...
>>> when i create an web project with existing classes, netbeans
>>> automaticly comment all my jersey reference in web.xml
>>> and add a librairy by force call restful Webservice with only
>>> jsr311-api.jar (when i remove it and uncomment the jersey part in
>>> web.xml, all comme back when i restart the IDE)
>>>
>>
>> Do you have the RESTful Web services plugin installed?
>>
>>
>>> for the piece of code you write i don't know where put this, who call
>>> the method printPackageUrls(String... packages)
>>>
>>
>> Create a new servlet in your web app and call
>> printPackageUrls(String... packages) from this init or service method.
>>
>> Paul.
>>
>>> Guilhem Legal
>>>
>>>
>>> guilhem legal a écrit :
>>>> I still continue to think this is a problem of JDK5/6.
>>>> in fact just before this exception I get an other exception :
>>>>
>>>> GRAVE: "Servlet.service()" pour la servlet ServletAdaptor a généré
>>>> une exception
>>>> java.lang.ClassFormatError: Illegal class modifiers in class
>>>> net/seagis/wcs/package-info: 0x1600
>>>> at java.lang.ClassLoader.defineClass1(Native Method)
>>>> at java.lang.ClassLoader.defineClass(Unknown Source)
>>>> at java.security.SecureClassLoader.defineClass(Unknown Source)
>>>> at
>>>> org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817)
>>>>
>>>> at
>>>> org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872)
>>>>
>>>> at
>>>> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325)
>>>>
>>>> at
>>>> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)
>>>>
>>>> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>>>> at java.lang.Class.forName0(Native Method)
>>>> at java.lang.Class.forName(Unknown Source)
>>>> at java.lang.Package.getPackageInfo(Unknown Source)
>>>> at java.lang.Package.getAnnotation(Unknown Source)
>>>> at
>>>> com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader.getPackageAnnotation(RuntimeInlineAnnotationReader.java:125)
>>>>
>>>>
>>>> which i know is throw when you use a 1.6 compiled app in an
>>>> environement 1.5
>>>>
>>>> i continue to investigate where this come from
>>>> Guilhem Legal
>>>>
>>>> Paul Sandoz a écrit :
>>>>> Hi Guilhem,
>>>>>
>>>>> I don't think it is a JER 5/6 version issue. An exception is being
>>>>> thrown because a URL with a 'file' protocol (scheme) is assumed to
>>>>> be a directory and it is not in this case. Jersey converts this
>>>>> file-based URL to a file then does File.listFiles() which returns
>>>>> null. Definitely a bug.
>>>>>
>>>>> I managed to reproduce the same exception but i am not sure if that
>>>>> is the same problem you are having. What i did was create a file,
>>>>> say called 'junk', in a package, say 'mypackage', then set the
>>>>> package name to search for in the web.xml as follows:
>>>>>
>>>>> <init-param>
>>>>> <param-name>com.sun.ws.rest.config.property.packages</param-name>
>>>>> <param-value>mypackage.junk</param-value>
>>>>> </init-param>
>>>>>
>>>>>
>>>>> For the the package name you used:
>>>>>
>>>>> net.seagis.coverage.wms
>>>>>
>>>>> is 'wms' a file in the package "net.seagis.coverage" ?
>>>> net.seagis.coverage.wms is a package containing two resources classes.
>>>>>
>>>>> If not i am not sure what is going on. Would it be possible to
>>>>> execute the following code somewhere in your web app by including
>>>>> an additional a basic servlet:
>>>>>
>>>>> public static void printPackageUrls(String... packages) throws
>>>>> Exception {
>>>>> ClassLoader cl =
>>>>> Thread.currentThread().getContextClassLoader();
>>>>> for (String p : packages) {
>>>>> String fileP = p.replace('.', '/');
>>>>> Enumeration<URL> urls = cl.getResources(fileP);
>>>>> while (urls.hasMoreElements()) {
>>>>> System.out.println(" URI: " + urls.nextElement());
>>>>> System.out.println("file p: " + fileP);
>>>>> System.out.println(new File(fileP).isDirectory());
>>>>> }
>>>>> }
>>>>> }
>>>>>
>>>>> where you pass the packages you configure in the web.xml ?
>>>>>
>>>>> Thanks,
>>>>> Paul.
>>>>>
>>>>> guilhem legal wrote:
>>>>>> hi!
>>>>>>
>>>>>> I have a little issue with the maven plugin of netbeans, when i
>>>>>> build my project with maven command line all work fine.
>>>>>> But when i build my jersey WS with the netbeans maven plugin and
>>>>>> try to deploy it with NB i get the folowing error :
>>>>>>
>>>>>> javax.servlet.ServletException:
>>>>>> java.lang.reflect.InvocationTargetException
>>>>>>
>>>>>> com.sun.ws.rest.spi.container.servlet.ServletContainer.createResourceConfig(ServletContainer.java:172)
>>>>>>
>>>>>>
>>>>>> com.sun.ws.rest.spi.container.servlet.ServletContainer.init(ServletContainer.java:104)
>>>>>>
>>>>>>
>>>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>>>>>
>>>>>>
>>>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
>>>>>>
>>>>>>
>>>>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
>>>>>>
>>>>>>
>>>>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
>>>>>>
>>>>>>
>>>>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>>>>>>
>>>>>> java.lang.Thread.run(Thread.java:595)
>>>>>>
>>>>>> java.lang.reflect.InvocationTargetException
>>>>>> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>>>>> Method)
>>>>>>
>>>>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>>>>>>
>>>>>>
>>>>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>>>>>>
>>>>>> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>>>>>>
>>>>>> com.sun.ws.rest.spi.container.servlet.ServletContainer.createResourceConfig(ServletContainer.java:168)
>>>>>>
>>>>>>
>>>>>> com.sun.ws.rest.spi.container.servlet.ServletContainer.init(ServletContainer.java:104)
>>>>>>
>>>>>>
>>>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>>>>>
>>>>>>
>>>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
>>>>>>
>>>>>>
>>>>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
>>>>>>
>>>>>>
>>>>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
>>>>>>
>>>>>>
>>>>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>>>>>>
>>>>>> java.lang.Thread.run(Thread.java:595)
>>>>>>
>>>>>> java.lang.NullPointerException
>>>>>>
>>>>>> com.sun.ws.rest.impl.container.config.ResourceClassScanner.indexDir(ResourceClassScanner.java:149)
>>>>>>
>>>>>>
>>>>>> com.sun.ws.rest.impl.container.config.ResourceClassScanner.index(ResourceClassScanner.java:135)
>>>>>>
>>>>>>
>>>>>> com.sun.ws.rest.impl.container.config.ResourceClassScanner.scan(ResourceClassScanner.java:97)
>>>>>>
>>>>>>
>>>>>> com.sun.ws.rest.api.core.PackagesResourceConfig.init(PackagesResourceConfig.java:88)
>>>>>>
>>>>>>
>>>>>> com.sun.ws.rest.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:64)
>>>>>>
>>>>>>
>>>>>> com.sun.ws.rest.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:72)
>>>>>>
>>>>>> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>>>>> Method)
>>>>>>
>>>>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>>>>>>
>>>>>>
>>>>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>>>>>>
>>>>>> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>>>>>>
>>>>>> com.sun.ws.rest.spi.container.servlet.ServletContainer.createResourceConfig(ServletContainer.java:168)
>>>>>>
>>>>>>
>>>>>> com.sun.ws.rest.spi.container.servlet.ServletContainer.init(ServletContainer.java:104)
>>>>>>
>>>>>>
>>>>>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>>>>>
>>>>>>
>>>>>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
>>>>>>
>>>>>>
>>>>>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
>>>>>>
>>>>>>
>>>>>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
>>>>>>
>>>>>>
>>>>>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>>>>>>
>>>>>> java.lang.Thread.run(Thread.java:595)
>>>>>>
>>>>>> I see in the log the scan starting :
>>>>>>
>>>>>> INFO: Scanning for root resource classes in the packages:
>>>>>> net.seagis.coverage.wms
>>>>>>
>>>>>> but it never find the resources.
>>>>>>
>>>>>> any idea what this happen? (i'm using tomcat 6 with JDK5, I have
>>>>>> maybe a problem with JDK6/5 compilation)
>>>>>>
>>>>>> Guilhem Legal
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>>>
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109