<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Liferay 7.2 and Java 11 upgrade problems (SOAP Client, jsonws)</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=120426691" />
  <subtitle>Liferay 7.2 and Java 11 upgrade problems (SOAP Client, jsonws)</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=120426691</id>
  <updated>2026-04-05T03:30:42Z</updated>
  <dc:date>2026-04-05T03:30:42Z</dc:date>
  <entry>
    <title>RE: RE: Liferay 7.2 and Java 11 upgrade problems (SOAP Client, jsonws)</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120459182" />
    <author>
      <name>Bernd S</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120459182</id>
    <updated>2020-11-18T12:42:09Z</updated>
    <published>2020-11-18T12:42:09Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;Thank you for your answer, Christoph.&lt;/p&gt;
&lt;p&gt;I finally manged to get it working. Here is what I did:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Created one CXF Endpoint in Control Panel &amp;gt; Configuration &amp;gt;
    System Settings &amp;gt; Web-API &amp;gt; CXF Endpoints&lt;/li&gt;
  &lt;li&gt;Created a matching JAX-WS API in Control Panel &amp;gt; Configuration
    &amp;gt; System Settings &amp;gt; Web-API &amp;gt; JAX-WS API, referencing my
    CXF Endpoint&lt;/li&gt;
  &lt;li&gt;Used the classloader from Liferay for creating my service:&lt;/li&gt;&lt;/ol&gt;
&lt;pre&gt;&lt;code class="language-java"&gt;Bundle bundle = FrameworkUtil.getBundle(this.getClass()).getBundleContext().getBundle(0);
ClassLoader classLoader = bundle.adapt(BundleWiring.class).getClassLoader();
Thread thread = Thread.currentThread();
ClassLoader contextClassLoader = thread.getContextClassLoader();
thread.setContextClassLoader(classLoader);

try {
    // create service
    return service;
} finally {
    thread.setContextClassLoader(contextClassLoader);
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The first line (retrieving the bungle) was actually the crucial one.
  At first I tried to get it only via&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-java"&gt;FrameworkUtil.getBundle(this.getClass())&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This returned "com.my.bundle_1.0.0" which is my own bundle,
  which is the service builder generated project. But actually I had to
  get the Liferay bundle via:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-java"&gt;FrameworkUtil.getBundle(this.getClass()).getBundleContext().getBundle(0);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Additionally I should mention that my call isn't in an OSGi
  component, therefore I had to use this methode. If youre are actually
  in an OSGi component (@Component) then you can simply get the
  BundleContext in the activation method:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-java"&gt;@Activate 
@Modified 
protected void activate(BundleContext bundleContext, Map&amp;amp;lt;String, Object&amp;amp;gt; properties) { this.bundleContext = bundleContext; }&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;JODD:&lt;/p&gt;
&lt;p&gt;I worked around it by setting the target version in my pom.xml
  (Maven) to 1.8. Not a perfect solution but since I am not using any
  newer features I can live with it for now (and probably have to).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Bernd S</dc:creator>
    <dc:date>2020-11-18T12:42:09Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay 7.2 and Java 11 upgrade problems (SOAP Client, jsonws)</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120446193" />
    <author>
      <name>Christoph Rabel</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120446193</id>
    <updated>2020-11-12T21:41:37Z</updated>
    <published>2020-11-12T21:41:37Z</published>
    <summary type="html">&lt;p&gt;Actually, the solution in the referenced issue should work for the
  missing ProviderImpl. The thing is, Liferay has implemented the
  Provider class itself and instead of
  com.sun.xml.internal.ws.spi.ProviderImpl the Liferay class &lt;span
    class="pl-smi"&gt;com.liferay.jaxws.osgi.bridge.Provider should be used.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The problem is that it is really tricky to get it working. You need
  to follow all the steps in the ticket (and maybe check the referenced,
  older ticket, too). It simply should not look for the ProviderImpl
  class and work with a correct configuration.&lt;/p&gt;
&lt;p&gt;Jodd:&lt;/p&gt;
&lt;p&gt;Yeah, that one bugged me too. The unfortunate thing is that Liferay
  used the Jodd library and it simply didn't support Java 11 fully, at
  least not at the time of the 7.2 release. I don't remember details,
  but I could work around the Jodd issues.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</summary>
    <dc:creator>Christoph Rabel</dc:creator>
    <dc:date>2020-11-12T21:41:37Z</dc:date>
  </entry>
  <entry>
    <title>Liferay 7.2 and Java 11 upgrade problems (SOAP Client, jsonws)</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120426690" />
    <author>
      <name>Bernd S</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=120426690</id>
    <updated>2020-11-12T07:48:38Z</updated>
    <published>2020-11-12T07:48:38Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;Hello,&lt;br&gt;I am currently upgrading a project, consisting of
  multiple portlets and a central service-builder generated
  backend.&lt;br&gt;While I managed the upgrade from Lifery DXP 7.0 to
  Liferay DXP 7.2 without any bigger problems, the trouble started when
  upgrading Java as well:&lt;/p&gt;
&lt;p&gt;
  &lt;strong&gt;SOAP Client&lt;/strong&gt;
  &lt;br&gt;My service-builder backend contains several SOAP clients for
  internal usage. With Java 11 they all throw this exception:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-java"&gt;java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is understandable since, jax ws was removed from the JDK.
  Therefore I tried to add the necessary dependencies to my pom.xml but
  they had no effect.&lt;br&gt;Finally I stumbled over &lt;a href="https://issues.liferay.com/browse/LPS-98339"&gt;this &lt;/a&gt;reported
  issue, which tackles my problem.&lt;br&gt;Unfortunately the provided
  "solution" doesn't work for me, since it simply adds another
  layer to the exception:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-java"&gt;Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl cannot be found by com.my.bundle_1.0.0&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  &lt;strong&gt;Jsonws&lt;/strong&gt;
  &lt;br&gt;Liferay is still using &lt;a href="https://jodd.org"&gt;https://jodd.org&lt;/a&gt; which doesn't support
  anything above Java 11.&lt;br&gt;As a quick fix, I set the target version
  to 1.8 in my maven-compiler-plugin but this is only a temporary
  solution.&lt;br&gt;Is there any other way to get it working with Java 11.&lt;/p&gt;
&lt;p&gt;To sum it up, I feel like Liferay is not really supporting Java 11
  although it is metntioned in the compatibility matrix.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;br&gt;Bernd&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Bernd S</dc:creator>
    <dc:date>2020-11-12T07:48:38Z</dc:date>
  </entry>
</feed>
