Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] OSGi and javax.jws.WebService with Java 11

Hello,

after changing the JAXB implementation (thanks Mark) I rab into the next issue, It looks to me that the jax-ws implementation is not ready to run in Equinox, see https://github.com/eclipse-ee4j/metro-jax-ws/issues/128 for details.

I was able to start a webservice by modifying the classloader see https://github.com/vogellacompany/eclipsercp-javaws-java11/blob/main/com.example.rcpclient/src/com/example/rcpclient/parts/SamplePart.java
This enables the client to start webservices in his RCP app (which are used to communicate to an AS/400 backend). Once #128 is resolved or a better solution is found we hope to update this "hack".

You find a demo for this approach in https://github.com/vogellacompany/eclipsercp-javaws-java11

Thanks again everyone for your help, Lars






Virenfrei. www.avast.com

On Fri, May 7, 2021 at 1:25 PM Mark Hoffmann <m.hoffmann@xxxxxxxxxxxxxxxxxx> wrote:
Hi Lars,

obviously the implementations want to have different Jaxb implementations. com.sun.xml vs the glassfish one. Maybe choosing just the obe from the Jax-Ws stuff is your candidate.

This is why we use EMF for that 😉

Mark Hoffmann 
M.A. Dipl.-Betriebswirt (FH) 
CEO/CTO 

Phone: +49 3641 384 910


Data In Motion Consulting GmbH 
Kahlaische Strasse 4 
07745 Jena 
Germany 

Geschäftsführer/CEO 
Mark Hoffmann 
Jürgen Albert 

Jena HRB 513025 
Steuernummer 162/107/05779 
USt-Id DE310002614


-------- Ursprüngliche Nachricht --------
Von: Lars Vogel <lars.vogel@xxxxxxxxxxx>
Datum: 07.05.21 12:44 (GMT+01:00)
An: Equinox development mailing list <equinox-dev@xxxxxxxxxxx>
Betreff: Re: [equinox-dev] OSGi and javax.jws.WebService with Java 11

Hi Mark,

thanks. The additional fragment was indeed necessary. I added it and
now it complains about the JaxB configuration.

Caused by: jakarta.xml.bind.JAXBException: return is not a valid
property on class
com.example.rcpclient.handlers.jaxws.SayHelloResponse at
org.glassfish.jaxb.runtime.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(JAXBContextImpl.java:908)
at com.sun.xml.ws.db.glassfish.JAXBRIContextWrapper.getElementPropertyAccessor(JAXBRIContextWrapper.java:91)
at com.sun.xml.ws.server.sei.EndpointResponseMessageBuilder$DocLit.<init>(EndpointResponseMessageBuilder.java:228)
… 54 more

I didn't know that Java Webservices uses JaxB under the hood. :-O

I will try to configure this and update this message thread with the results:

For reference, here is an example with the current state:

https://github.com/vogellacompany/eclipsercp-javaws-java11

Thanks also to Gunnar for the tip and Christoph for the amazing m2E /
PDE integration which makes using libraries super easy.

Best regards, Lars

On Fri, May 7, 2021 at 8:38 AM Mark Hoffmann
<m.hoffmann@xxxxxxxxxxxxxxxxxx> wrote:
>
> Hi Lars,
>
> this might be possible, but its always worth to take a look into the API Code. In the area if Jaxb ans JaxWs there have been default providers defined  in the lookup process.
>
> This is what the fragments are for. Take a look into jakarta.xml.soap maybe you also need a fragment for this with Import Package com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl
>
> Mark Hoffmann
> M.A. Dipl.-Betriebswirt (FH)
> CEO/CTO
>
> Phone: +49 3641 384 910 0
> Mobile: +49 175 701 2201
> E-Mail: m.hoffmann@xxxxxxxxxxxxxxxxxx
>
> Web: www.datainmotion.de
>
> Data In Motion Consulting GmbH
> Kahlaische Strasse 4
> 07745 Jena
> Germany
>
> Geschäftsführer/CEO
> Mark Hoffmann
> Jürgen Albert
>
> Jena HRB 513025
> Steuernummer 162/107/05779
> USt-Id DE310002614
>
>
> -------- Ursprüngliche Nachricht --------
> Von: Lars Vogel <lars.vogel@xxxxxxxxxxx>
> Datum: 06.05.21 18:02 (GMT+01:00)
> An: Equinox development mailing list <equinox-dev@xxxxxxxxxxx>
> Betreff: Re: [equinox-dev] OSGi and javax.jws.WebService with Java 11
>
> Thanks, Mark for the answer. That fixed the reported error.
>
> I now get another error (see below) but I assume this is due to
> missing libraries. I have a look and see if I can fix these.
>
> java.lang.Error: jakarta.xml.soap.SOAPException: Unable to create SAAJ
> meta-factory: Provider
> com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not found
> Caused by: jakarta.xml.soap.SOAPException: Unable to create SAAJ
> meta-factory: Provider
> com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not
> found)
>
> On Thu, May 6, 2021 at 3:54 PM Mark Hoffmann
> <m.hoffmann@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > Hi Lars,
> >
> > this is simular related to Jaxb. I believe you will need a Frgament for the jakarta.xml.ws-api that declares an Import to ProviderImpl
> >
> > Regards,
> >
> > Mark Hoffmann
> > M.A. Dipl.-Betriebswirt (FH)
> > CEO/CTO
> >
> > Phone: +49 3641 384 910 0
> > Mobile: +49 175 701 2201
> > E-Mail: m.hoffmann@xxxxxxxxxxxxxxxxxx
> >
> > Web: www.datainmotion.de
> >
> > Data In Motion Consulting GmbH
> > Kahlaische Strasse 4
> > 07745 Jena
> > Germany
> >
> > Geschäftsführer/CEO
> > Mark Hoffmann
> > Jürgen Albert
> >
> > Jena HRB 513025
> > Steuernummer 162/107/05779
> > USt-Id DE310002614
> >
> >
> > -------- Ursprüngliche Nachricht --------
> > Von: Lars Vogel <lars.vogel@xxxxxxxxxxx>
> > Datum: 06.05.21 15:15 (GMT+01:00)
> > An: Equinox development mailing list <equinox-dev@xxxxxxxxxxx>
> > Betreff: [equinox-dev] OSGi and javax.jws.WebService with Java 11
> >
> > Hi,
> >
> > I'm trying to migrate an RCP client to Java 11. All good so far only
> > the webservice which was part of Java 8 refused to start with an
> > sun.xml.internal.ws.spi.ProviderImpl exception.
> >
> > Exception:
> > Caused by: javax.xml.ws.WebServiceException: Provider
> > com.sun.xml.internal.ws.spi.ProviderImpl not found
> > at javax.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:61)
> > at javax.xml.ws.spi.FactoryFinder$1.createException(FactoryFinder.java:58)
> > at javax.xml.ws.spi.ServiceLoaderUtil.newInstance(ServiceLoaderUtil.java:103)
> > at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:112)
> > at javax.xml.ws.spi.Provider.provider(Provider.java:96)
> > at javax.xml.ws.Endpoint.publish(Endpoint.java:254)
> > at eupen.rcp.core.handers.StartWebserviceHandler.execute(StartWebserviceHandler.java:15)
> > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method)
> > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
> > at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > at java.base/java.lang.reflect.Method.invoke(Method.java:564)
> > at org.eclipse.e4.c
> >
> > Example:
> >
> > import javax.jws.WebMethod;
> > import javax.jws.WebService;
> >
> > @WebService
> > public class WebServiceExample {
> >     private String message = new String("Hello, ");
> >
> >     public void Hello() {}
> >
> >     @WebMethod
> >     public String sayHello(String name) {
> >         return message + name + ".";
> >     }
> > }
> >
> > And I start it via:
> > ----
> > import org.eclipse.e4.core.di.annotations.Execute;
> >
> > import javax.xml.ws.Endpoint;
> >
> > public class StartWebserviceHandler {
> >
> > @Execute
> > public void execute() {
> >   String url = "" href="http://localhost:4434/miniwebservice" target="_blank">http://localhost:4434/miniwebservice";
> >       Endpoint.publish( url, new WebServiceExample() );
> > }
> > }
> >
> > ---------
> >
> >
> > I started to add libraries from Maven central via the new PDE / M2e
> > integration but it seems that this pull and endless list of
> > dependencies into the classpath.
> >
> > Is anyone aware of a working example using such a Webservice inside
> > OSGi with Java 11 or higher?
> >
> > Best regards, Lars
> >
> > --
> > Eclipse Platform project co-lead
> > CEO vogella GmbH
> >
> > Haindaalwisch 17a, 22395 Hamburg
> > Amtsgericht Hamburg: HRB 127058
> > Geschäftsführer: Lars Vogel, Jennifer Nerlich de Vogel
> > USt-IdNr.: DE284122352
> > Fax (040) 5247 6322, Email: lars.vogel@xxxxxxxxxxx, Web: http://www.vogella.com
> > _______________________________________________
> > equinox-dev mailing list
> > equinox-dev@xxxxxxxxxxx
> > To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/equinox-dev
> > _______________________________________________
> > equinox-dev mailing list
> > equinox-dev@xxxxxxxxxxx
> > To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/equinox-dev
>
>
>
> --
> Eclipse Platform project co-lead
> CEO vogella GmbH
>
> Haindaalwisch 17a, 22395 Hamburg
> Amtsgericht Hamburg: HRB 127058
> Geschäftsführer: Lars Vogel, Jennifer Nerlich de Vogel
> USt-IdNr.: DE284122352
> Fax (040) 5247 6322, Email: lars.vogel@xxxxxxxxxxx, Web: http://www.vogella.com
> _______________________________________________
> equinox-dev mailing list
> equinox-dev@xxxxxxxxxxx
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/equinox-dev
> _______________________________________________
> equinox-dev mailing list
> equinox-dev@xxxxxxxxxxx
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/equinox-dev



--
Eclipse Platform project co-lead
CEO vogella GmbH

Haindaalwisch 17a, 22395 Hamburg
Amtsgericht Hamburg: HRB 127058
Geschäftsführer: Lars Vogel, Jennifer Nerlich de Vogel
USt-IdNr.: DE284122352
Fax (040) 5247 6322, Email: lars.vogel@xxxxxxxxxxx, Web: http://www.vogella.com
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/equinox-dev
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/equinox-dev


--
Eclipse Platform project co-lead
CEO vogella GmbH

Haindaalwisch 17a, 22395 Hamburg
Amtsgericht Hamburg: HRB 127058
Geschäftsführer: Lars Vogel, Jennifer Nerlich de Vogel
USt-IdNr.: DE284122352
Fax (040) 5247 6322, Email: lars.vogel@xxxxxxxxxxx, Web: http://www.vogella.com

Virenfrei. www.avast.com

Back to the top