eclipse-ee4j / jersey

Eclipse Jersey Project - Read our Wiki:
https://github.com/eclipse-ee4j/jersey/wiki
Other
690 stars 352 forks source link

Package Scanning delimiter is inconsistent with spec. #3017

Closed jerseyrobot closed 8 years ago

jerseyrobot commented 9 years ago

Here is the scenario: We have the following packages that contain JAX-RS classes com.bipt.tiva.rs com.bipt.tiva.jaxrs com.policyport.rs.open

However, see below how it's the only way we where able to have the scanning work in Webpshere 8.5 as described in web.xml

<init-param>
            <param-name>jersey.config.server.provider.packages</param-name>
            <param-value>
com.bipt.tiva.rs/,com.bipt.tiva.jaxrs/,com.policyport.rs.open/
            </param-value>
        </init-param>

Notice the forward slash before "comma" as the delimiter. That's the only way. We tried ";" "empty space","\n" as per spec but nothing else worked.

Fortunately, the "foward slash" still worked on tomcat, so for now we adopted the solution.

I am sure though that this is not intentional and is in fact a bug. Unless you guys can shed some light on this.

Environment

Ubuntu 14.04 Tomcat on Oracle 1.7 JVM Websphere 8.5.5.3 on 1.7 IBM JVM

Affected Versions

[2.9, 2.14]

jerseyrobot commented 6 years ago
jerseyrobot commented 9 years ago

@glassfishrobot Commented Reported by martin.jamszolik

jerseyrobot commented 9 years ago

@glassfishrobot Commented martin.jamszolik said: The full servlet configuration looks like this

<servlet> 
       <servlet-name>isf_rest_api_jersey2</servlet-name>
       <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>         
       <init-param>
            <param-name>jersey.config.server.provider.packages</param-name>
            <param-value>
com.bipt.tiva.rs/,com.bipt.tiva.jaxrs/,com.policyport.rs.open/
            </param-value>
        </init-param>
        <init-param>
            <param-name>jersey.config.server.provider.scanning.recursive</param-name>
            <param-value>true</param-value>
        </init-param>
        <init-param>
            <param-name>javax.ws.rs.Application</param-name>
            <param-value>com.bipt.tiva.lib.JerseyISFApplication</param-value>
        </init-param>     
        <load-on-startup>2</load-on-startup>  
</servlet>
jerseyrobot commented 9 years ago

@glassfishrobot Commented brad103 said: I'm not sure if it's inconsistent with the spec, but it is inconsistent with IBM's interpretation of it.

From what I've seen, there's a classloader difference between Oracle Java and IBM Java which manifests in com.ibm.ws.classloader.CompoundClassLoader. In short,

There is some discussion that setting the JVM parameter com.ibm.ws.classloader.strict changes this behaviour to not need the trailing slash, but we haven't had any joy with that.

Our workaround is to use the same package descriptions as Martin described. Note we are using package scanning defined in a ResourceConfig class rather than web.xml, but the result is the same.

Refs: http://code.google.com/p/reflections/issues/detail?id=158#c3 http://www-01.ibm.com/support/knowledgecenter/SSAW57_7.0.0/com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/xrun_jvm.html?cp=SSAW57_7.0.0%2F3-16-5-448 https://blogs.oracle.com/bhaktimehta/entry/ibm_jdk_and_classloader_getresources (possibly related)

We're on WAS 8.5.0.1 and Java 7

jerseyrobot commented 8 years ago

@glassfishrobot Commented @mpotociar said: This seems to be IBM issue, not Jersey. Closing as invalid.

jerseyrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JERSEY-2745

jerseyrobot commented 8 years ago

@glassfishrobot Commented Marked as invalid on Monday, December 21st 2015, 5:45:10 am