Metro configuration not available in Java SE 8

I have a Java desktop application that uses JAX-WS to call some web services using the standard Metro JAX-WS implementation in Java SE - this is a SWT application launched through Java Web Start (.jnlp). Web services did not have any problems until recently, when several instances started to have errors when initializing web service calls:

WARNING: MASM0010: Unable to unmarshall metro config file from location [ jar:file:/C:/Program%20Files%20(x86)/Java/jre1.8.0_31/lib/resources.jar!/com/sun/xml/internal/ws/assembler/jaxws-tubes-default.xml ] java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers") 

This ultimately leads to:

 SEVERE: MASM0003: Default [ jaxws-tubes-default.xml ] configuration file was not loaded. 

All clients experiencing this problem are on Windows using JRE 1.8.31-45, both x86 and x86_64. I browsed this site and Google, but could not find information about this problem.

Thanks for understanding this problem!

+5
source share
2 answers

after upgrading from jre 1.7_80 to 1.8.0_51, we got the error "MASM0003" when we tried to start our web services. setting ContextClassLoader before publishing fixes the problem:

Thread.currentThread () setContextClassLoader (GetClass () getClassLoader ().). endpoint = Endpoint.publish (wsdlUrl, engine);

+1
source

I think that you are facing the same question as me.

 private static JAXBContext createJAXBContext() throws Exception { return isJDKInternal()?(JAXBContext)AccessController.doPrivileged(new PrivilegedExceptionAction<JAXBContext>() { public JAXBContext run() throws Exception { return JAXBContext.newInstance(MetroConfig.class.getPackage().getName()); } }, createSecurityContext()):JAXBContext.newInstance(MetroConfig.class.getPackage().getName()); } private static AccessControlContext createSecurityContext() { PermissionCollection perms = new Permissions(); perms.add(new RuntimePermission("accessClassInPackage.com.sun.xml.internal.ws.runtime.config")); perms.add(new ReflectPermission("suppressAccessChecks")); return new AccessControlContext(new ProtectionDomain[]{new ProtectionDomain((CodeSource)null, perms)}); } 

this code is in the MetroConfigLoader JDK, it will load the resource with a certain privilege, and this is the main reason, so you can use jaxws-rt , which is the third part of lib to implement it,

Or you can load your resource in your classloader using AccessController.doPrivileged so that you can access your resource.

0
source

All Articles