5

I have a Java desktop app that uses JAX-WS to call some web services using the default Metro JAX-WS implementation in Java SE -- it's an SWT app that's launched via Java Web Start (.jnlp). The web services haven't had any problems until recently, when several instances started having errors when the web service calls are initialized:

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")

Which ultimately leads to:

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

All of the clients experiencing this issue are on Windows using the JRE 1.8.31-45, both x86 and x86_64. I've been scouring this site and google, but haven't been able to find any information about this issue.

Thanks for any insight to this problem!

assylias
  • 321,522
  • 82
  • 660
  • 783
idlegravity
  • 116
  • 1
  • 5
  • You should try to spot the version which introduced the problem, i.e. what is the most recent Java version without the problem and what’s the oldest version with the problem… – Holger Apr 30 '15 at 08:01
  • The problem first appeared with 8u45, so I thought that was the problem... but yesterday it happened with 8u31, so I don't know what to think. – idlegravity Apr 30 '15 at 21:44
  • Look at http://stackoverflow.com/questions/23011547/webservice-client-generation-error-with-jdk8 – heelha Jan 04 '17 at 10:09

2 Answers2

1

after upgrading from jre 1.7_80 to 1.8.0_51 we received the "MASM0003" error when we tried to start our webservices. setting the ContextClassLoader before publish solved the problem:

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

oli_b
  • 41
  • 1
  • 4
0

I think you meet the same issue 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)});
}

that's code in JDK MetroConfigLoader, it will load the resource with specific privilege, and that's the root cause, so you can use jaxws-rt which is a third part lib to implement it,

Or you can load your resource in your class loader with AccessController.doPrivileged, so that's you can access your resource.

chaoluo
  • 2,596
  • 1
  • 17
  • 29