javaee / metro-jax-ws

https://javaee.github.io/metro-jax-ws/
Other
132 stars 68 forks source link

Reflection failure with private nested classess in MetroConfigLoader.loadFromServletContext #1175

Open glassfishrobot opened 9 years ago

glassfishrobot commented 9 years ago

loadFromServletContext(String) wants to access a method through the runtime object class instead of the interface:

final Method method = context.getClass().getMethod("getResource", String.class);

This results in errors, when the class is a private nested class, which is true in case of Tomcat:

Caused by: java.lang.IllegalAccessException: Class com.sun.xml.ws.assembler.MetroConfigLoader$MetroConfigUrlLoader can not access a member of class org.apache.catalina.core.StandardContext$NoPluggabilityServletContext with modifiers "public"
    at java.lang.reflect.Method.invoke(Method.java:490)
    at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:102)
    at com.sun.xml.ws.assembler.MetroConfigLoader$MetroConfigUrlLoader.loadFromServletContext(MetroConfigLoader.java:331)

This should work:

final Method method = ServletContext.class.getMethod("getResource", String.class);
glassfishrobot commented 9 years ago

Reported by pgliznie

glassfishrobot commented 9 years ago

mandarchatufale said: I am also facing this issue. The solution provided above cannot be implemented by me as this code is present in the jars. If this issue is not solved then, i may come to conclusion that we cannot implement jax-ws webserice [SUN RI implementation] using Spring Boot and embedded tomcat.

glassfishrobot commented 9 years ago

torstenwerner said: A simple patch for this problem is available here: https://github.com/torstenwerner/jaxws-ri/commit/e3314d314cf23cbceeefca819eea9887d9ea2b72 . Could you please provide a fixed official version? Thank you!

glassfishrobot commented 7 years ago

casperreduct said: Looks like noone want fix it Also have same issue when Autowired: StandardServlet$NoPluggabilityServletContext

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA JAX_WS-1175