users@jersey.java.net

[Jersey] Re: Problems with Oracle OC4J 10.1.3.5

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Thu, 30 Dec 2010 13:26:13 +0100

Hi,

I dunno anything about OC4J but it looks like the package scanning
techniques supported by Jersey are not portable to OC4J.

Specifically Jersey does not know how to decode the URI scheme "code-
source" so as to search for class files.

It might be best in this case to not use package scanning and instead
use explicit registration with Application or use scanning of classes
in WEB-INF/classes and WEB-INF/lib. You can do the latter by not
specifying any scanning information in the servlet init params i.e.
try removing:

> <init-param>
> <param-name>com.sun.jersey.config.property.packages</param-name>
> <param-value>package1;package2;package3</param-value>
> </init-param>


Later versions of Jersey have support for plugging in components to
resolve URI schemes.

Paul.

On Dec 24, 2010, at 2:19 PM, Ricardo Borillo wrote:

> Hi all,
>
> We are trying to deploy a webapp running Jersey 1.1.5.1 on Oracle OC4J
> 10.1.3.5. The problem comes when the webapp starts and tries to init
> Jersey resources:
>
> 10/12/24 13:55:54.869 xxxxxxxxxxxxxxxx: Error initializing servlet
> com.sun.jersey.core.spi.scanning.ScannerException: The URI scheme
> code-source of the URI
> code-source:/opt/oc4j-10.1.3.5/j2ee/home/applications/xxxxxxxxxxx is
> not supported. Package scanning deployment is not supported for such
> URIs.
> Try using a different deployment mechanism such as explicitly
> declaring root resource and provider classes using an extension of
> javax.ws.rs.core.Application
> at
> com
> .sun
> .jersey
> .core.spi.scanning.PackageNamesScanner.scan(PackageNamesScanner.java:
> 137)
> at
> com
> .sun
> .jersey
> .core.spi.scanning.PackageNamesScanner.scan(PackageNamesScanner.java:
> 121)
> at
> com
> .sun
> .jersey
> .api.core.ScanningResourceConfig.init(ScanningResourceConfig.java:69)
> at
> com
> .sun
> .jersey
> .api.core.PackagesResourceConfig.init(PackagesResourceConfig.java:110)
> at
> com
> .sun
> .jersey
> .api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:
> 76)
> at
> com
> .sun
> .jersey
> .api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:
> 87)
> at
> com
> .sun
> .jersey
> .spi
> .container
> .servlet.WebComponent.createResourceConfig(WebComponent.java:641)
> at
> com
> .sun
> .jersey
> .spi
> .container
> .servlet.WebComponent.createResourceConfig(WebComponent.java:619)
> at
> com
> .sun
> .jersey.spi.container.servlet.WebComponent.init(WebComponent.java:199)
> at
> com
> .sun
> .jersey
> .spi.container.servlet.ServletContainer.init(ServletContainer.java:
> 307)
> at
> com
> .sun
> .jersey
> .spi.container.servlet.ServletContainer.init(ServletContainer.java:
> 470)
> at javax.servlet.GenericServlet.init(GenericServlet.java:256)
> at
> com
> .evermind
> .server.http.HttpApplication.loadServlet(HttpApplication.java:2528)
> at
> com
> .evermind
> .server.http.HttpApplication.findServlet(HttpApplication.java:5006)
> at
> com
> .evermind
> .server.http.HttpApplication.findServlet(HttpApplication.java:4930)
> at
> com
> .evermind
> .server
> .http.HttpApplication.initPreloadServlets(HttpApplication.java:5118)
> at
> com
> .evermind
> .server.http.HttpApplication.initDynamic(HttpApplication.java:1283)
> at
> com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:
> 848)
> at
> com
> .evermind
> .server
> .ApplicationStateRunning
> .getHttpApplication(ApplicationStateRunning.java:435)
> at
> com.evermind.server.Application.getHttpApplication(Application.java:
> 592)
> at com.evermind.server.http.HttpSite
> $
> HttpApplicationRunTimeReference
> .createHttpApplicationFromReference(HttpSite.java:2280)
> at com.evermind.server.http.HttpSite
> $HttpApplicationRunTimeReference.<init>(HttpSite.java:2199)
> at com.evermind.server.http.HttpSite.initApplications(HttpSite.java:
> 701)
> at com.evermind.server.http.HttpSite.setConfig(HttpSite.java:308)
> at com.evermind.server.http.HttpServer.setSites(HttpServer.java:280)
> at com.evermind.server.http.HttpServer.setConfig(HttpServer.java:180)
> at
> com
> .evermind
> .server.ApplicationServer.initializeHttp(ApplicationServer.java:2541)
> at
> com
> .evermind.server.ApplicationServer.setConfig(ApplicationServer.java:
> 1058)
> at
> com
> .evermind
> .server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:
> 131)
> at java.lang.Thread.run(Thread.java:595)
> 10/12/24 13:55:54.870 webappsignstore: Error preloading servlet
> javax.servlet.ServletException: Error initializing servlet
> at
> com
> .evermind
> .server.http.HttpApplication.findServlet(HttpApplication.java:5033)
> at
> com
> .evermind
> .server.http.HttpApplication.findServlet(HttpApplication.java:4930)
> at
> com
> .evermind
> .server
> .http.HttpApplication.initPreloadServlets(HttpApplication.java:5118)
> at
> com
> .evermind
> .server.http.HttpApplication.initDynamic(HttpApplication.java:1283)
> at
> com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:
> 848)
> at
> com
> .evermind
> .server
> .ApplicationStateRunning
> .getHttpApplication(ApplicationStateRunning.java:435)
> at
> com.evermind.server.Application.getHttpApplication(Application.java:
> 592)
> at com.evermind.server.http.HttpSite
> $
> HttpApplicationRunTimeReference
> .createHttpApplicationFromReference(HttpSite.java:2280)
> at com.evermind.server.http.HttpSite
> $HttpApplicationRunTimeReference.<init>(HttpSite.java:2199)
> at com.evermind.server.http.HttpSite.initApplications(HttpSite.java:
> 701)
> at com.evermind.server.http.HttpSite.setConfig(HttpSite.java:308)
> at com.evermind.server.http.HttpServer.setSites(HttpServer.java:280)
> at com.evermind.server.http.HttpServer.setConfig(HttpServer.java:180)
> at
> com
> .evermind
> .server.ApplicationServer.initializeHttp(ApplicationServer.java:2541)
> at
> com
> .evermind.server.ApplicationServer.setConfig(ApplicationServer.java:
> 1058)
> at
> com
> .evermind
> .server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:
> 131)
> at java.lang.Thread.run(Thread.java:595)
>
> Our resources are defined in the web.xml file for package scanning
> as follows:
>
> <init-param>
> <param-name>com.sun.jersey.config.property.packages</param-name>
> <param-value>package1;package2;package3</param-value>
> </init-param>
>
> How can we init our resources to avoid this exception?
>
>
> Thanks in advance and merry Christmas :)
>
> ---
> Salut,
> ====================================
> Ricardo Borillo Domenech
> http://xml-utils.com
> twitter: @borillo