OpenLiberty / open-liberty

Open Liberty is a highly composable, fast to start, dynamic application server runtime environment
https://openliberty.io
Eclipse Public License 2.0
1.16k stars 599 forks source link

JAX-RS web services are failing after Jakarta EE9 transformation #18210

Closed jagraj closed 3 years ago

jagraj commented 3 years ago

Describe the bug I transformed one of EE8 application to Jakarta EE9 runtime and my JAX-RS transactions are failing with the following failure.

[INFO    ] RESTEASY002225: Deploying jakarta.ws.rs.core.Application: class com.ibm.websphere.svt.gs.tax.session.ProductTaxShipSessionApplication$Proxy$_$$_WeldClientProxy
[INFO    ] RESTEASY002200: Adding class resource com.ibm.websphere.svt.gs.tax.session.ProductTaxShipSessionBeanLocal from Application class com.ibm.websphere.svt.gs.tax.session.ProductTaxShipSessionApplication$Proxy$_$$_WeldClientProxy
[ERROR   ] SRVE0271E: Uncaught init() exception created by servlet [com.ibm.websphere.svt.gs.tax.session.ProductTaxShipSessionApplication] in application [GarageSaleLibertyEAR8-LooseConfig]: java.lang.RuntimeException: RESTEASY003190: Could not find constructor for class: com.ibm.websphere.svt.gs.tax.session.ProductTaxShipSessionBeanLocal
    at org.jboss.resteasy.spi.metadata.ResourceBuilder.getConstructor(ResourceBuilder.java:852)
    at [internal classes]

If there is a stack trace, please include the FULL stack trace (without any [internal classes] lines in it). To find the full stack trace, you may need to check in $WLP_OUTPUT_DIR/messages.log

Steps to Reproduce

  1. Transform EE8 application to Jakarta EE9 runtime application.
  2. After starting application and I am getting above failure.

Expected behavior JAX-RS transactions should work after Jakarta EE9 transformation.

Diagnostic information:

Additional context Add any other context about the problem here.

andymc12 commented 3 years ago

Suggested fix: change the ProductTaxShipSessionApplication's getClasses method to return the bean class instead of the local interface class.

Change this line in ProductTaxShipSessionApplication.java from:

classes.add(ProductTaxShipSessionBeanLocal.class);

to:

classes.add(ProductTaxShipSessionBean.class);
jagraj commented 3 years ago

After making above change, the application was able to start successfully. I got into an issue where we can not access any jax-rs endpoints and we are getting 404s. I did more debugging with Andy with the trace and here is the stack trace from the failure.

Here is the stack trace from the failure...

[8/20/21 16:42:19:176 EDT] 00000022 id=00000000 wink.common.internal.registry.ProvidersRegistry$MediaTypeMap 3 put EntrySet is application/octet-stream=[Priority: 0.500000, ObjectFactory: SingletonOF: org.apache.wink.common.internal.providers.entity.InputStreamProvider]
[8/20/21 16:42:19:177 EDT] 00000022 id=00000000 wink.common.internal.registry.ProvidersRegistry$MediaTypeMap 3 put Cleared the providers cache
[8/20/21 16:42:19:432 EDT] 00000022 id=00000000 org.apache.wink.client.internal.ResourceImpl                 3 createClientRequest The client issued a request with GET  HTTP method to the URI at http://jagdev-1.fyre.ibm.com:9080/GSjsf20LibertyWeb/rest/productTaxShipService/getAllStatesTaxInfo with the null entity class and [Accept] headers.
[8/20/21 16:42:19:458 EDT] 00000022 id=00000000 org.apache.wink.client.internal.log.Requests                 1 handle The sent request headers:
Accept                        application/xml
User-Agent                    Wink Client v1.1.1
[8/20/21 16:42:19:905 EDT] 00000022 id=00000000 org.apache.wink.client.internal.log.Requests                 1 handle A request entity was not written to the server.
[8/20/21 16:42:19:909 EDT] 00000022 id=00000000 org.apache.wink.client.internal.log.Responses                1 handle The received response headers:
Connection                    Close
Content-Language              en-US
Content-Length                153
Content-Type                  text/html;charset=UTF-8
Date                          Fri, 20 Aug 2021 20:42:19 GMT
[8/20/21 16:42:19:909 EDT] 00000022 id=00000000 org.apache.wink.client.internal.ResourceImpl                 3 invoke The client response returned the following error code: 404
[8/20/21 16:42:19:915 EDT] 00000022 id=00000000 om.ibm.websphere.svt.gs.gsjsfweb.utils.GSJSFExceptionHandler E handle Severe Error is jakarta.el.ELException: org.apache.wink.client.ClientWebException
[8/20/21 16:42:19:920 EDT] 00000022 id=00000000 SystemErr                                                    R org.apache.myfaces.view.facelets.el.ContextAwareELException: jakarta.el.ELException: org.apache.wink.client.ClientWebException
[8/20/21 16:42:19:925 EDT] 00000022 id=00000000 SystemErr                                                    R  at org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpression.invoke(ContextAwareTagMethodExpression.java:108)
[8/20/21 16:42:19:988 EDT] 00000022 id=00000000 SystemErr                                                    R  at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
[8/20/21 16:42:19:988 EDT] 00000022 id=00000000 SystemErr                                                    R  at jakarta.faces.component.UICommand.broadcast(UICommand.java:122)
[8/20/21 16:42:19:989 EDT] 00000022 id=00000000 SystemErr                                                    R  at jakarta.faces.component.UIViewRoot._broadcastAll(UIViewRoot.java:1255)
[8/20/21 16:42:19:990 EDT] 00000022 id=00000000 SystemErr                                                    R  at jakarta.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:420)
[8/20/21 16:42:19:990 EDT] 00000022 id=00000000 SystemErr                                                    R  at jakarta.faces.component.UIViewRoot._process(UIViewRoot.java:1741)
[8/20/21 16:42:19:991 EDT] 00000022 id=00000000 SystemErr                                                    R  at jakarta.faces.component.UIViewRoot.processApplication(UIViewRoot.java:935)
[8/20/21 16:42:19:991 EDT] 00000022 id=00000000 SystemErr                                                    R  at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:42)
[8/20/21 16:42:19:992 EDT] 00000022 id=00000000 SystemErr                                                    R  at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:195)
[8/20/21 16:42:19:993 EDT] 00000022 id=00000000 SystemErr                                                    R  at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:142)
[8/20/21 16:42:19:993 EDT] 00000022 id=00000000 SystemErr                                                    R  at jakarta.faces.webapp.FacesServlet.service(FacesServlet.java:204)
[8/20/21 16:42:19:994 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1258)
[8/20/21 16:42:19:994 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:746)
[8/20/21 16:42:19:995 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)
[8/20/21 16:42:19:995 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:183)
[8/20/21 16:42:19:996 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:94)
[8/20/21 16:42:19:996 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.security.jaspi.JaspiServletFilter.doFilter(JaspiServletFilter.java:56)
[8/20/21 16:42:19:996 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:201)
[8/20/21 16:42:19:999 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
[8/20/21 16:42:20:003 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:1002)
[8/20/21 16:42:20:004 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1140)
[8/20/21 16:42:20:005 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:5049)
[8/20/21 16:42:20:005 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:314)
[8/20/21 16:42:20:005 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1007)
[8/20/21 16:42:20:007 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:279)
[8/20/21 16:42:20:008 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:1159)
[8/20/21 16:42:20:008 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.wrapHandlerAndExecute(HttpDispatcherLink.java:428)
[8/20/21 16:42:20:009 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:387)
[8/20/21 16:42:20:010 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:566)
[8/20/21 16:42:20:010 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:500)
[8/20/21 16:42:20:010 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:360)
[8/20/21 16:42:20:011 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.http.channel.internal.inbound.HttpICLReadCallback.complete(HttpICLReadCallback.java:70)
[8/20/21 16:42:20:011 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504)
[8/20/21 16:42:20:011 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574)
[8/20/21 16:42:20:012 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:958)
[8/20/21 16:42:20:012 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1047)
[8/20/21 16:42:20:013 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.ws.threading.internal.ExecutorServiceImpl$RunnableWrapper.run(ExecutorServiceImpl.java:238)
[8/20/21 16:42:20:013 EDT] 00000022 id=00000000 SystemErr                                                    R  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[8/20/21 16:42:20:013 EDT] 00000022 id=00000000 SystemErr                                                    R  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[8/20/21 16:42:20:014 EDT] 00000022 id=00000000 SystemErr                                                    R  at java.lang.Thread.run(Thread.java:748)
[8/20/21 16:42:20:015 EDT] 00000022 id=00000000 SystemErr                                                    R Caused by: jakarta.el.ELException: org.apache.wink.client.ClientWebException
[8/20/21 16:42:20:016 EDT] 00000022 id=00000000 SystemErr                                                    R  at org.apache.el.parser.AstValue.invoke(AstValue.java:258)
[8/20/21 16:42:20:016 EDT] 00000022 id=00000000 SystemErr                                                    R  at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:267)
[8/20/21 16:42:20:017 EDT] 00000022 id=00000000 SystemErr                                                    R  at org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpression.invoke(ContextAwareTagMethodExpression.java:96)
[8/20/21 16:42:20:017 EDT] 00000022 id=00000000 SystemErr                                                    R  ... 39 more
[8/20/21 16:42:20:018 EDT] 00000022 id=00000000 SystemErr                                                    R Caused by: org.apache.wink.client.ClientWebException
[8/20/21 16:42:20:018 EDT] 00000022 id=00000000 SystemErr                                                    R  at org.apache.wink.client.internal.ResourceImpl.invoke(ResourceImpl.java:232)
[8/20/21 16:42:20:019 EDT] 00000022 id=00000000 SystemErr                                                    R  at org.apache.wink.client.internal.ResourceImpl.invoke(ResourceImpl.java:201)
[8/20/21 16:42:20:019 EDT] 00000022 id=00000000 SystemErr                                                    R  at org.apache.wink.client.internal.ResourceImpl.get(ResourceImpl.java:306)
[8/20/21 16:42:20:021 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.websphere.svt.gs.gsjsfweb.utils.GarageSaleManagedBeanUtil.getAllStatesTaxInfo(GarageSaleManagedBeanUtil.java:296)
[8/20/21 16:42:20:023 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.websphere.svt.gs.gsjsfweb.utils.GarageSaleManagedBeanUtil.getTaxRate(GarageSaleManagedBeanUtil.java:347)
[8/20/21 16:42:20:024 EDT] 00000022 id=00000000 SystemErr                                                    R  at com.ibm.websphere.svt.gs.gsjsfweb.GarageSaleJSFActions.addToCart(GarageSaleJSFActions.java:357)
[8/20/21 16:42:20:024 EDT] 00000022 id=00000000 SystemErr                                                    R  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[8/20/21 16:42:20:032 EDT] 00000022 id=00000000 SystemErr                                                    R  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[8/20/21 16:42:20:035 EDT] 00000022 id=00000000 SystemErr                                                    R  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[8/20/21 16:42:20:038 EDT] 00000022 id=00000000 SystemErr                                                    R  at java.lang.reflect.Method.invoke(Method.java:498)
[8/20/21 16:42:20:038 EDT] 00000022 id=00000000 SystemErr                                                    R  at org.apache.el.parser.AstValue.invoke(AstValue.java:247)
[8/20/21 16:42:20:039 EDT] 00000022 id=00000000 SystemErr                                                    R  ... 41 more
jagraj commented 3 years ago

@jhanders34 @andymc12 I tried apache wink jars without transforming them to Jakarta EE9 runtime. Application failed to start with the following exception.

[INFO    ] WELD-000119: Not generating any bean definitions from org.apache.wink.common.internal.utils.UriHelper because of underlying class loading error: Type javax.ws.rs.core.MultivaluedMap not found.  If this is unexpected, enable DEBUG logging to see the full error.
[INFO    ] WELD-000119: Not generating any bean definitions from org.apache.wink.server.internal.handlers.PopulateResponseMediaTypeHandler because of underlying class loading error: Type javax.ws.rs.WebApplicationException not found.  If this is unexpected, enable DEBUG logging to see the full error.
[INFO    ] FFDC1015I: An FFDC Incident has been created: "java.lang.NoClassDefFoundError: javax/ws/rs/ext/MessageBodyReader com.ibm.ws.container.service.state.internal.ApplicationStateManager 54" at ffdc_21.09.02_10.20.52.0.log
[INFO    ] FFDC1015I: An FFDC Incident has been created: "com.ibm.ws.container.service.state.StateChangeException: java.lang.NoClassDefFoundError: javax/ws/rs/ext/MessageBodyReader com.ibm.ws.app.manager.module.internal.SimpleDeployedAppInfoBase 548" at ffdc_21.09.02_10.20.53.0.log
[INFO    ] unregistering MBean org.apache.cxf:bus.id=GSjsf20LibertyWeb-Server-Bus,type=Bus,instance.id=165362622
[INFO    ] unregistering MBean org.apache.cxf:bus.id=GSjsf20LibertyWeb-Server-Bus,WorkQueueManager=Bus.WorkQueueManager,type=WorkQueueManager,instance.id=2127695922
[INFO    ] unregistering MBean org.apache.cxf:bus.id=GSjsf20LibertyWeb-Client-Bus,type=Bus,instance.id=1216718769
[INFO    ] unregistering MBean org.apache.cxf:bus.id=GSjsf20LibertyWeb-Client-Bus,WorkQueueManager=Bus.WorkQueueManager,type=WorkQueueManager,instance.id=250320937
[INFO    ] unregistering MBean org.apache.cxf:bus.id=GarageSaleEJB-Server-Bus,WorkQueueManager=Bus.WorkQueueManager,type=WorkQueueManager,instance.id=1404251445
[INFO    ] unregistering MBean org.apache.cxf:bus.id=GarageSaleEJB-Server-Bus,type=Bus,instance.id=789618050
[INFO    ] unregistering MBean org.apache.cxf:bus.id=WSBankEJB-Server-Bus,WorkQueueManager=Bus.WorkQueueManager,type=WorkQueueManager,instance.id=1205280338
[INFO    ] unregistering MBean org.apache.cxf:bus.id=WSBankEJB-Server-Bus,type=Bus,instance.id=1986380755
[INFO    ] unregistering MBean org.apache.cxf:bus.id=CreditCardEJB-Server-Bus,type=Bus,instance.id=169498584
[INFO    ] unregistering MBean org.apache.cxf:bus.id=CreditCardEJB-Server-Bus,WorkQueueManager=Bus.WorkQueueManager,type=WorkQueueManager,instance.id=1213521655
[ERROR   ] CWWKZ0106E: Could not start web application GarageSaleLibertyEAR8-LooseConfig.
[ERROR   ] CWWKZ0002E: An exception occurred while starting the application GarageSaleLibertyEAR8-LooseConfig. The exception message was: com.ibm.ws.container.service.state.StateChangeException: java.lang.NoClassDefFoundError: javax/ws/rs/ext/MessageBodyReader
[INFO    ] SESN8502I: The session manager found a persistent storage location; it will use session persistence mode=DATABASE
[INFO    ] SRVE9103I: A configuration file for a web server plugin was automatically generated for this server at C:\MyData\MyWDTWorkspaces\GarageSale\GarageSaleEE7\garageSale-ee7\GarageSaleRuntimeUtil\target\wlp\usr\servers\garageSaleServer\logs\state\plugin-cfg.xml.
rumanaHaque commented 3 years ago

I have a similar issue when I am running my SVT application - ACME. I use the transformer tool to convert my ear file from ee8 to jakarta ee9. I am using JAX-RS third-party-lib in my application. If I don't transform my thirdparty lib - I get these exceptions when I start my server.

Stack Dump = java.lang.NoClassDefFoundError: javax.ws.rs.ext.MessageBodyReader
    at java.lang.ClassLoader.defineClassImpl(Native Method)
    at java.lang.ClassLoader.defineClassInternal(ClassLoader.java:398)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:359)
    at com.ibm.ws.classloading.internal.AppClassLoader.definePackageAndClass(AppClassLoader.java:370)
    at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:288)
    at com.ibm.ws.classloading.internal.AppClassLoader.findClassCommonLibraryClassLoaders(AppClassLoader.java:563)
    at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:305)
    at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:944)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:889)
    at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:547)
    at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:505)
    at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:933)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:889)
    at com.ibm.ws.classloading.internal.AppClassLoader.findOrDelegateLoadClass(AppClassLoader.java:547)
    at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:505)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:872)
    at java.lang.Class.getDeclaredMethodsImpl(Native Method)
    at java.lang.Class.getDeclaredMethods(Class.java:983)
    at org.jboss.resteasy.core.PropertyInjectorImpl.getDeclaredMethods(PropertyInjectorImpl.java:306)
    at org.jboss.resteasy.core.PropertyInjectorImpl.populateMap(PropertyInjectorImpl.java:83)
    at org.jboss.resteasy.core.PropertyInjectorImpl.<init>(PropertyInjectorImpl.java:61)
    at org.jboss.resteasy.core.InjectorFactoryImpl.createPropertyInjector(InjectorFactoryImpl.java:73)
    at org.jboss.resteasy.cdi.CdiInjectorFactory.createPropertyInjector(CdiInjectorFactory.java:123)
    at io.openliberty.org.jboss.resteasy.common.cdi.LibertyFallbackInjectorFactory.createPropertyInjector(LibertyFallbackInjectorFactory.java:72)
    at org.jboss.resteasy.core.ResteasyDeploymentImpl.createApplication(ResteasyDeploymentImpl.java:421)
    at org.jboss.resteasy.core.ResteasyDeploymentImpl.initializeObjects(ResteasyDeploymentImpl.java:265)
    at org.jboss.resteasy.core.ResteasyDeploymentImpl.startInternal(ResteasyDeploymentImpl.java:137)
    at org.jboss.resteasy.core.ResteasyDeploymentImpl.start(ResteasyDeploymentImpl.java:121)
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:138)
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:42)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:299)

If I do transform my thirdparty lib using the transformer tool - then I don't have the exception shown above at server startup. But in either case (whether I transform 3rd party lib or not) - when I run my jax-rs test - I get this exception and my test fails.

[9/2/21 10:29:27:385 PDT] 00000059 SystemOut                                                    O <BR>Servlet Web Execution FAILED.  Unexpected error was reported in the AnnuityWebServlet.java. Error: java.lang.Error: Unresolved compilation problems: 
    The method queryParams(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String>) in the type Resource is not applicable for the arguments (jakarta.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String>)
    The method queryParams(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String>) in the type Resource is not applicable for the arguments (jakarta.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String>)

[9/2/21 10:29:27:385 PDT] 00000059 SystemErr                                                    R java.lang.Error: Unresolved compilation problems: 
    The method queryParams(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String>) in the type Resource is not applicable for the arguments (jakarta.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String>)
    The method queryParams(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String>) in the type Resource is not applicable for the arguments (jakarta.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String>)

[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.wssvt.acme.annuity.common.servicelookup.jaxrs.AnnuityJAXRSServicePorxy.execute(AnnuityJAXRSServicePorxy.java:674)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.wssvt.acme.annuity.common.servicelookup.jaxrs.AnnuityJAXRSServicePorxy.executeAndVerify(AnnuityJAXRSServicePorxy.java:566)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.wssvt.acme.annuity.common.servicelookup.jaxrs.AnnuityJAXRSServicePorxy.createContact(AnnuityJAXRSServicePorxy.java:348)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.wssvt.acme.annuity.common.client.adapter.AbstractAnnuityServerAdapter.createContact(AbstractAnnuityServerAdapter.java:105)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.wssvt.acme.annuity.common.client.executionunit.specialunit.quickreturn.CRUDContactQuickReturnSEU.execute(CRUDContactQuickReturnSEU.java:33)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.wssvt.acme.common.client.ExecutionUnitRunner.runTheEU(ExecutionUnitRunner.java:249)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.wssvt.acme.common.client.ExecutionUnitRunner.executeRun(ExecutionUnitRunner.java:157)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.wssvt.acme.common.client.AcmeJavaClient.executeClient(AcmeJavaClient.java:87)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.wssvt.acme.annuity.web.AnnuityWebServlet.doPost(AnnuityWebServlet.java:135)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.wssvt.acme.annuity.web.AnnuityWebServlet.doGet(AnnuityWebServlet.java:84)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:500)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1258)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:746)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:183)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:94)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.security.jaspi.JaspiServletFilter.doFilter(JaspiServletFilter.java:56)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:201)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:1002)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1140)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:5049)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:314)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1007)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:279)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:1159)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.wrapHandlerAndExecute(HttpDispatcherLink.java:428)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:387)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:566)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:500)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:360)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.http.channel.internal.inbound.HttpICLReadCallback.complete(HttpICLReadCallback.java:70)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:958)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1047)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at com.ibm.ws.threading.internal.ExecutorServiceImpl$RunnableWrapper.run(ExecutorServiceImpl.java:238)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1160)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[9/2/21 10:29:27:401 PDT] 00000059 SystemErr                                                    R   at java.lang.Thread.run(Thread.java:822)
andymc12 commented 3 years ago

Hi @rumanaHaque - this looks like a different problem. This seems like you have two modules (or possibly more). The shared library module contains EE8 (javax.ws.rs.*) code that needs to be transformed to EE9 (jakarta.ws.rs.*). The NoClassDefFoundError makes sense before transforming because there are no APIs for javax.ws.rs.* in EE9. So transforming that JAR is correct.

I'm not sure, but it kinda seems like the initial module might've been compiled against the transformed shared module - and it failed because it expected javax.* but the transformed module had jakarta.* - so it "built" the module with an UnresolvedCompilationError. You may want to consult with @tbitonti about how to transform modules with dependencies on other modules that may also need to be transformed. He knows the transformer tool way better than I do. You may need to build them both using EE8 and then transform them at the same time (if that is possible)... HTH.

jagraj commented 3 years ago

@andymc12 After debugging further with @jhanders34 on this problem we found out that the user does not have to add actual session bean implementation class in Application class and we should support adding actual local or remote interface classes. In cxf we just have to add interface class but not actual implementation class. We also found this documentation about this requirement.

https://www.ibm.com/docs/en/was-nd/9.0.5?topic=rs-implementing-restful-views-ejb-local-interfaces

jagraj commented 3 years ago

@jim-krueger

I tried with a local EJB interface rather implementation class and I am getting into this failure. Looks like we need to add actual implementation classes for RESTEASY runtime but this is not the case for cxf runtime.

[INFO    ] RESTEASY002200: Adding class resource com.ibm.websphere.svt.gs.tax.session.ProductTaxShipSessionBeanLocal from Application class com.ibm.websphere.svt.gs.tax.session.ProductTaxShipSessionApplication$Proxy$_$$_WeldClientProxy
[INFO    ] FFDC1015I: An FFDC Incident has been created: "java.lang.RuntimeException: RESTEASY003190: Could not find constructor for class: com.ibm.websphere.svt.gs.tax.session.ProductTaxShipSessionBeanLocal com.ibm.ws.webcontainer.servlet.ServletWrapper.init 181" at ffdc_21.09.14_17.20.56.0.log
[ERROR   ] SRVE0271E: Uncaught init() exception created by servlet [com.ibm.websphere.svt.gs.tax.session.ProductTaxShipSessionApplication] in application [GarageSaleLibertyEAR8-LooseConfig]: java.lang.RuntimeException: RESTEASY003190: Could not find constructor for class: com.ibm.websphere.svt.gs.tax.session.ProductTaxShipSessionBeanLocal
    at org.jboss.resteasy.spi.metadata.ResourceBuilder.getConstructor(ResourceBuilder.java:852)
    at [internal classes]

[ERROR   ] SRVE0276E: Error while initializing Servlet [com.ibm.websphere.svt.gs.tax.session.ProductTaxShipSessionApplication]: jakarta.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:368)
    at [internal classes]
Caused by: java.lang.RuntimeException: RESTEASY003190: Could not find constructor for class: com.ibm.websphere.svt.gs.tax.session.ProductTaxShipSessionBeanLocal
    at org.jboss.resteasy.spi.metadata.ResourceBuilder.getConstructor(ResourceBuilder.java:852)
    ... 1 more
jim-krueger commented 3 years ago

The ultimate problem here is that the application's getClasses() method contained the interface class, not the implementation resource class. CXF appears to tolerate this, but RestEasy does not. This was confusing because CXF's behavior gave the impression that it was actually using this interface class. However that was not the case. CXF was simply ignoring the interface class in the getClasses() and finding the implementation class as it would if there were no classes listed in getClasses(). The javadoc for Application.getClasses() says the following:

Implementations should warn about and ignore classes that do not conform to the requirements of root resource or provider/feature classes.

So both CXF and RESTEasy are incomplete in this respect since CXF ignores, but doesn't warn about the interface class (but it does ignore it). RESTEasy on the other hand errors (rather than warning) and does not ignore.

As for this SVT testcase. Unless the intent is to look for the warning message and ensure that the interface class is ignored, then the interface class should be removed from the getClasses() method.

jim-krueger commented 3 years ago

One correction to the above. Note that it says "should warn about and ignore", therefore this is not a specification requirement.

jim-krueger commented 3 years ago

Unless there are additional problems I think the "bug" label can be removed from this.

jhanders34 commented 3 years ago

So @andymc12 and @jim-krueger does this just become an entry in the migration to restfulWS-3.0 documentation that you are working on, or is there a usability improvement that should be done so that it just warns and/or ignores and doesn't fail the application from working?

jim-krueger commented 3 years ago

@jhanders34 I've talked this over with @andymc12 and I don't think that this requires any migration documentation. Placing an interface class in the application classes getClasses() method is not valid and, outside of an EJB scenario, JAXRS 2.0, 2.1 and EE9 all throw exceptions that cause the application not to start.

In JAXRS 2.0 and 2.1 the Interface class is ultimately ignored, but because it is returned from the getClasses method, no introspection for resource class annotations is done and an exception is thrown indicated that no resource classes are found: org.apache.cxf.service.factory.ServiceConstructionException: No resource classes found

In EE9 the Interface class is also returned from getClasses and a different exception is produced indicating that the class is not valid: java.lang.RuntimeException: RESTEASY003190: Could not find constructor for class: com.ibm.ws.jaxrs.fat.helloworld.HelloWorldInterface

In the EJB scenario EE9 behaves the same (which I think is a valid result) whereas in JAXRS 2.0 and 2.1 the returned interface class is ignored (with no exception or warning) and the JAXRS annotation introspection is performed, resulting in the resource class being found. I believe that this behavior is actually in violation of the specification that says that introspection can only be performed if getClasses returns an empty-set or null.

So I don't think anything needs to be done right away for this. However, that being said, both Andy and I agree that a better error message, beyond "Could not find constructor for class..." is something that we should add (perhaps post EE9).

jim-krueger commented 3 years ago

19141 has been created to ensure a better error/warning message is generated.