users@jersey.java.net

[Jersey] Re: Problems with Oracle OC4J 10.1.3.5

From: Ricardo Borillo <borillo_at_si.uji.es>
Date: Thu, 6 Jan 2011 22:36:40 +0100

Hi Paul,

Thanks for your help. It seems that now the services are loaded
properly when we declare them as a spring beans.

:)

Best regards,
====================================
Ricardo Borillo Domenech
http://xml-utils.com / http://twitter.com/borillo



On Thu, Jan 6, 2011 at 10:46, Paul Sandoz <Paul.Sandoz_at_oracle.com> wrote:
> Hi,
>
> I see you are using Spring, which in that case means the behavior is
> slightly different when scanning. If you don't specify any scanning behavior
> then Jersey will require that root resource and provider classes are
> registered as spring beans.
>
> See here:
>
> http://jersey.java.net/nonav/apidocs/latest/contribs/jersey-spring/com/sun/jersey/spi/spring/container/servlet/package-summary.html
>
> Are you getting any error on deployment such as "No root resources"?
>
> If not then Jersey deployed something and i suspect that you have not got
> URI paths in sync.
>
>
> If so try adding the following settings:
>
>     <init-param>
>
> <param-name>com.sun.jersey.config.property.resourceConfigClass</param-name>
>     <param-value>com.sun.jersey.api.core.WebAppResourceConfig</param-value>
>   </init-param>
>
> Or make your root resource and provider classes spring managed.
>
> Paul.
>
> On Jan 5, 2011, at 7:14 PM, Ricardo Borillo wrote:
>
>> Hi Paul,
>>
>> I have removed the package scanning section from my web.xml with no
>> success. Now, my web.xml file looks like:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5"
>>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
>>
>>  <display-name>xxxxxxxxx</display-name>
>>
>>  <context-param>
>>   <param-name>contextConfigLocation</param-name>
>>   <param-value>classpath:applicationContext-db.xml
>> classpath:applicationContext.xml</param-value>
>>  </context-param>
>>
>>  <context-param>
>>   <param-name>log4jConfigLocation</param-name>
>>   <param-value>/WEB-INF/log4j.properties</param-value>
>>  </context-param>
>>
>>  <context-param>
>>   <param-name>webAppRootKey</param-name>
>>   <param-value>xxxxxxxxxxx.root</param-value>
>>  </context-param>
>>
>>  <listener>
>>
>> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>>  </listener>
>>
>>  <listener>
>>
>> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
>>  </listener>
>>
>>  <listener>
>>
>> <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
>>  </listener>
>>
>>  <servlet>
>>   <servlet-name>rest-api</servlet-name>
>>
>> <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
>>   <init-param>
>>
>> <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
>>
>> <param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>
>>   </init-param>
>>   <init-param>
>>
>> <param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>
>>
>> <param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>
>>   </init-param>
>>   <init-param>
>>
>> <param-name>com.sun.jersey.config.feature.logging.DisableEntitylogging</param-name>
>>     <param-value>true</param-value>
>>   </init-param>
>>   <load-on-startup>1</load-on-startup>
>>  </servlet>
>>
>>  <servlet-mapping>
>>   <servlet-name>rest-api</servlet-name>
>>   <url-pattern>/rest/*</url-pattern>
>>  </servlet-mapping>
>> </web-app>
>>
>> And when the app starts, only this message is logged:
>>
>> INFO: Initiating Jersey application, version 'Jersey: 1.1.5.1
>> 03/10/2010 02:33 PM'
>>
>> Then, no REST service is available.
>>
>> Thanks for your help.
>>
>> ---
>> Salut,
>> ====================================
>> Ricardo Borillo Domenech
>> http://xml-utils.com / http://twitter.com/borillo
>>
>>
>>
>> On Thu, Dec 30, 2010 at 13:26, Paul Sandoz <Paul.Sandoz_at_oracle.com> wrote:
>>>
>>> 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
>>>
>>>
>>>
>
>
>