question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JAVA 9 compatiblity

See original GitHub issue

It would be nice if wiremock would be java 9 compatible. I ran jdeps on our project https://github.com/JabRef/jabref/issues/2594#issuecomment-331638433 and got and it complained/showed the following: From what I found, this api is now encapsulated in java 9 (https://docs.oracle.com/javase/9/docs/api/java.xml-summary.html)

wiremock-2.8.0.jar -> java.xml
   com.github.tomakehurst.wiremock.matching.EqualToXmlPattern$SkipResolvingEntitiesDocumentBuilderFactory -> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl JDK internal API (java.xml)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
darkedgescommented, Nov 27, 2017

For those using the standalone JAR with Java 9 you need to add --add-modules java.xml.bind to make it run. ie.

java --add-modules java.xml.bind -jar wiremock-standalone-2.11.0.jar

Otherwise you will get the following

2017-11-28 05:48:14.869 Outgoing bytes: <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /sivservice/api/users. Reason:
<pre>    Server Error</pre></p><h3>Caused by:</h3><pre>java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
        at com.github.tomakehurst.wiremock.common.Encoding.encodeBase64(Encoding.java:29)
        at com.github.tomakehurst.wiremock.servlet.WireMockHttpServletRequestAdapter.getBodyAsBase64(WireMockHttpServletRequestAdapter.java:134)
        at com.github.tomakehurst.wiremock.verification.LoggedRequest.createFrom(LoggedRequest.java:58)
        at com.github.tomakehurst.wiremock.stubbing.InMemoryStubMappings.serveFor(InMemoryStubMappings.java:74)
        at com.github.tomakehurst.wiremock.core.WireMockApp.serveStubFor(WireMockApp.java:159)
        at com.github.tomakehurst.wiremock.http.StubRequestHandler.handleRequest(StubRequestHandler.java:50)
        at com.github.tomakehurst.wiremock.http.AbstractRequestHandler.handle(AbstractRequestHandler.java:44)
        at com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet.service(WireMockHandlerDispatchingServlet.java:102)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at wiremock.org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
        at wiremock.org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
        at wiremock.org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:83)
        at wiremock.org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:365)
        at wiremock.org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
        at wiremock.org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
        at wiremock.org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
        at wiremock.org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
        at wiremock.org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
        at wiremock.org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at wiremock.org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
        at wiremock.org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
        at wiremock.org.eclipse.jetty.server.Server.handle(Server.java:499)
        at wiremock.org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
        at wiremock.org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:258)
        at wiremock.org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
        at wiremock.org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
        at wiremock.org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
        at java.base/java.lang.Thread.run(Unknown Source)
</pre>
<hr><i><small>Powered by Jetty://</small></i><hr/>

</body>
</html>
1reaction
tomakehurstcommented, Mar 17, 2019

I’ve been meaning to refactor this code in pretty much exactly the way you’ve suggested, so I’d be very happy to merge a PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java Platform, Standard Edition Oracle JDK 9 Migration Guide
You may encounter some source compatibility issues when recompiling. The JDK 9 Release Notes contains details of changes to the javac compiler and...
Read more >
6 Compatibility challenges when moving to Java 9
In this chapter and in chapter 7, I discuss the compatibility challenges when migrating an existing code base to Java 9 and beyond....
Read more >
Java 9: New Features and Compatibility of JDK 9 - Azul Systems
Java 9 brings many new features, but also pitfalls in compatibility that can cause issues. Read through the updates to JDK 9 and...
Read more >
Java 9+ modularity: The difficulties and pitfalls of migrating ...
By looking at compatibility, migration issues, and techniques, explore the new APIs and tools, changes, deletions, and deprecations in Java ...
Read more >
Java 9 Migration Issues and Resolutions - Baeldung
Normally, Java versions guarantee backward compatibility, but the JPMS changes some of this. 3. Execution in Java 9.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found