This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive)
Works fine with init-params (...property.resourceConfigclass and ...property.packages)
But, when I remove these servlet-params (as tomcat) get the current stack-trace:
<Jan 21, 2008 3:47:52 PM GMT+01:00> <Error> <HTTP> <BEA-101216> <Servlet: "Resources" failed to preload on startup in Web application: "rest.war".'
java.lang.IllegalArgumentException : com.sun.ws.rest.config.property.classpath contains no paths
at com.sun.ws.rest.api.core.ClasspathResourceConfig.getPaths(ClasspathResourceConfig.java:124)
at com.sun.ws.rest.api.core.ClasspathResourceConfig .<init>(ClasspathResourceConfig.java:81)
at com.sun.ws.rest.spi.container.servlet.ServletContainer.createResourceConfig(ServletContainer.java:153)
at com.sun.ws.rest.spi.container.servlet.ServletContainer.init (ServletContainer.java:104)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:282)
Truncated. see log file for complete stacktrace
>
<Jan 21, 2008 3:47:52 PM GMT+01:00> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1200926871922' for task '0'. Error is: ' weblogic.application.ModuleException: [HTTP:101216]Servlet: "Resources" failed to preload on startup in Web application: "rest.war".
java.lang.IllegalArgumentException: com.sun.ws.rest.config.property.classpath contains no paths
at com.sun.ws.rest.api.core.ClasspathResourceConfig.getPaths(ClasspathResourceConfig.java:124)
at com.sun.ws.rest.api.core.ClasspathResourceConfig.<init>(ClasspathResourceConfig.java :81)
at com.sun.ws.rest.spi.container.servlet.ServletContainer.createResourceConfig(ServletContainer.java:153)
at com.sun.ws.rest.spi.container.servlet.ServletContainer.init(ServletContainer.java:104)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:282)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:63)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance (StubLifecycleHelper.java:58)
at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java :504)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1830)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java :1807)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1727)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2890)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:948)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:353)
at weblogic.application.internal.flow.ModuleStateDriver$3.next (ModuleStateDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java :60)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.ModuleStateDriver.start (ModuleStateDriver.java:60)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:26)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
at weblogic.application.internal.DeploymentStateChecker.activate (DeploymentStateChecker.java:154)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate (AbstractOperation.java:566)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:136)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit (ActivateOperation.java:104)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:320)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit (DeploymentManager.java:816)
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1223)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit (DeploymentManager.java:434)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:161)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback (DeploymentReceiverCallbackDeliverer.java:181)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:12)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run (DeploymentReceiverCallbackDeliverer.java:67)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:464)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java :200)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
Any idea?
On Jan 21, 2008 1:40 PM, Jose Antonio Illescas del Olmo < jose.illescas@gmail.com> wrote:
private void index(URL u, String filePackageName) {
String protocol = u.getProtocol();
if (protocol.equals("file")) {
indexDir(new File(u.getPath()), false);
} else if ( protocol.equals("jar") || protocol.equals("zip")) {
URI jarUri = URI.create(u.getPath());
String jarFile = jarUri.getPath();
jarFile = jarFile.substring(0, jarFile.indexOf('!'));
indexJar(new File(jarFile), filePackageName);
} else {
LOGGER.warning("URL, " +
u +
", is ignored, it not a file or a jar file");
}
}
Paul Sandoz wrote:Hi Jose,
I just added some tests for the class scanner and package scanner for zip files that are jar files.
I modified ResourceClassScanner code to check for a zip file when class scanning:
private void index(File file) {
if (file.isDirectory()) {
indexDir(file, true);
} else if (file.getName().endsWith(".jar") ||
file.getName().endsWith(".zip")) {
indexJar(file);
} else {
So by default files ending in .zip that are jar files will also be scanned.
But I did not have to modify the source code related to package scanning you pointed to as things just worked for me.
In any case i committed the check for the zip protocol [*] (although i cannot test it!) Thanks!
Paul, why not add weblogic support in jersey-0.6?
you can download an evaluation version of weblogic to resolve this.
Tis an issue with time/resources as i just don't have a lot of it to go test and verify anything beyond GF and Tomcat.
But i am definitely interested in rooting out these interop issues because it will affect what we specify as the default behvaiour for JAX-RS. So your feedback has been of great help.
Paul.
[*] I notice that the Struts code Richard pointed to only checks for the "file" protocol and if not then checks for a '!' character in the URL to determine if it is a jar file.
Jose Antonio Illescas del Olmo wrote:
The problem in Weblogic are the URLs, with "zip" protocol (instead of jar), you can fixed ResourceClassScanner to allows ZIP protocol (also you can change URL protocol from "zip" to "jar")
private void index(URL u, String filePackageName) {
String protocol = u.getProtocol();
if (protocol.equals("file")) {
indexDir(new File(u.getPath()), false);
} else if ( protocol.equals("jar") *|| protocol.equals("zip")*) {
URI jarUri = URI.create(u.getPath());
String jarFile = jarUri.getPath();
jarFile = jarFile.substring(0, jarFile.indexOf('!')); indexJar(new File(jarFile), filePackageName);
} else {
LOGGER.warning("URL, " +
u +
", is ignored, it not a file or a jar file"); }
}
I asume that same error force the search of resource classes across PackagesResourceConfig...
*Paul, why not add weblogic support in jersey-0.6?*
you can download an evaluation version of weblogic to resolve this.
Thank you
Paul Sandoz wrote:
Hi Arturo,
It appears that WebLogic is behaving differently to Tomcat, Glassfish and Jetty (see end of email for an issue with Jetty and a possibly solution to your problem).
Has any one tried WebSphere or the JBoss application server?
By default the servlet (see JavaDoc of com.sun.ws.rest.spi.container.servlet.ServletContainer) searches the following paths returned from calling:
context.getRealPath("/WEB-INF/lib"),
context.getRealPath("/WEB-INF/classes")
I am assuming, from the error, that WebLogic is returning null. We may well be relying on non-standard behaviour in web containers :-( grr very frustrating...
In my blog [1] i describe another way to configure a servlet by specifying the package names to search for root resource classes. This was developed in response an issue Richard was having when deploying using Jetty in a mode that does not assemble a war file (maybe WebLogic is doing the same?).
Hope this helps,
Paul.
[1] http://blogs.sun.com/sandoz/entry/jersey_0_5_is_released
Arturo wrote:
Hi:
I am trying to deploy a Jersey example in WebLogic 10. But it seems that
I need new properties with version 0.5.
Now I get the following error:
<18-ene-2008 17H33' CET> <Error> <Deployer> <BEA-149265> <Failure
occurred in the execution of deployment request with ID '1200674019181'
for task '0'. Error is: 'weblogic.application.ModuleException:
[HTTP:101216]Servlet: "RESTServlet" failed to preload on startup in Web
application: "rest.war".
java.lang.IllegalArgumentException:
com.sun.ws.rest.config.property.classpath contains no paths
at
com.sun.ws.rest.api.core.ClasspathResourceConfig.getPaths(ClasspathResourceConfig.java:124)
at
com.sun.ws.rest.api.core.ClasspathResourceConfig.<init>(ClasspathResourceConfig.java:81)
at
com.sun.ws.rest.spi.container.servlet.ServletContainer.createResourceConfig(ServletContainer.java:153)
at
com.sun.ws.rest.spi.container.servlet.ServletContainer.init(ServletContainer.java:104)
at weblogic.servlet.internal.StubSecurityHelper
$ServletInitAction.run(StubSecurityHelper.java:282)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at
weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(Unknown Source)
at
weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:63)
at
weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
at
weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
at
weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:504)
at
weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1830)
at
weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1807)
at
weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1727)
at
weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2890)
at
weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:948)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:353)
at weblogic.application.internal.flow.ModuleStateDriver
$3.next(ModuleStateDriver.java:204)
at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at
weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
at
weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at
weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
at weblogic.application.internal.flow.ModuleStateDriver
$3.next(ModuleStateDriver.java:204)
at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at
weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
at
weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:26)
at weblogic.application.internal.BaseDeployment
$2.next(BaseDeployment.java:635)
at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at
weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
at
weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:154)
at
weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
at
weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:566)
My web.xml is as follows:
<servlet>
<servlet-name>RESTServlet</servlet-name>
<servlet-class>com.sun.ws.rest.impl.container.servlet.ServletAdaptor</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
In Tomcat 6, it works perfectly.
I have tried with previous versions in WebLogic and I have always got a
"NullPointerException" error deploying Jersey.
weblogic.application.ModuleException: [HTTP:101216]Servlet:
"RESTServlet" failed to preload on startup in Web application:
"rest.war".
java.lang.NullPointerException
at
com.sun.ws.rest.api.core.DynamicResourceConfig.getPaths(DynamicResourceConfig.java:116)
at
com.sun.ws.rest.api.core.DynamicResourceConfig.getPaths(DynamicResourceConfig.java:107)
at
com.sun.ws.rest.api.core.DynamicResourceConfig.getPaths(DynamicResourceConfig.java:97)
at
com.sun.ws.rest.api.core.DynamicResourceConfig.<init>(DynamicResourceConfig.java:63)
at
com.sun.ws.rest.spi.container.servlet.ServletContainer.createResourceConfig(ServletContainer.java:163)
at
com.sun.ws.rest.spi.container.servlet.ServletContainer.init(ServletContainer.java:99)
at weblogic.servlet.internal.StubSecurityHelper
$ServletInitAction.run(StubSecurityHelper.java:282)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at
weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(Unknown Source)
at
weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:63)
at
weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
at
weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
at
weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:504)
at
weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1830)
at
weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1807)
at
weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1727)
at
weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2890)
at
weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:948)
at
weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:353)
at weblogic.application.internal.flow.ModuleStateDriver
$3.next(ModuleStateDriver.java:204)
at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at
weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
at
weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at
weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
at weblogic.application.internal.flow.ModuleStateDriver
$3.next(ModuleStateDriver.java:204)
at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at
weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
at
weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:26)
at weblogic.application.internal.BaseDeployment
$2.next(BaseDeployment.java:635)
at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at
weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
at
weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:154)
at
weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:950)
at
weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:353)
at weblogic.application.internal.flow.ModuleStateDriver
$3.next(ModuleStateDriver.java:204)
at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at
weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
Truncated. see log file for complete stacktrace
In Tomcat 6 it works.
I would appreciate any help.....
Thanks in advance.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@jersey.dev.java.net
For additional commands, e-mail: users-help@jersey.dev.java.net
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@jersey.dev.java.net For additional commands, e-mail: users-help@jersey.dev.java.net
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@jersey.dev.java.net For additional commands, e-mail: users-help@jersey.dev.java.net