I'm developing a sample application with Google App Engine over Java that uses Web Services.
Everything works well when I work in the local enviroment, the server service is deployed in my google account and the client is deployed in my local environment.
The problem comes when I deploy the application on Google App Engine and try to execute it. An exception occurs when the backing bean tries to create an instance of the server client:
This is the exception I get:
javax.el.ELException: /home.xhtml at line 20 and column 64 action="#{bergeData.obtenerListado}": java.lang.ExceptionInInitializerError
Caused by:
java.security.AccessControlException - access denied ("java.lang.RuntimePermission" "getClassLoader")
Caused by: java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:370)
at java.lang.Class.newInstance(Class.java:323)
at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:49)
at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:134)
at javax.xml.ws.spi.Provider.provider(Provider.java:127)
at javax.xml.ws.Service.<init>(Service.java:77)
at com.beeva.client.gen.AutomovilServerAPIService.<init>(AutomovilServerAPIService.java:46)
at com.beeva.controller.AutomovilServletClient.<init>(AutomovilServletClient.java:35)
at com.beeva.gae.BergeData.obtenerListado(BergeData.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:45)
at org.apache.el.parser.AstValue.invoke(AstValue.java:191)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at org.apache.myfaces.view.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:83)
at javax.faces.component._MethodExpressionToMethodBinding.invoke(_MethodExpressionToMethodBinding.java:88)
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:100)
at javax.faces.component.UICommand.broadcast(UICommand.java:120)
at javax.faces.component.UIViewRoot._broadcastAll(UIViewRoot.java:937)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:271)
at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1249)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:675)
at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:34)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:171)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:480)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:487)
at com.google.tracing.TraceContext.runInContext(TraceContext.java:774)
at com.google.tracing.TraceContext$DoInTraceContext.runInContext(TraceContext.java:751)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:342)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:334)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:484)
... 1 more
Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "getClassLoader")
at com.google.appengine.runtime.Request.process-98b41701563e1bbd(Request.java)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:375)
at java.security.AccessController.checkPermission(AccessController.java:564)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1479)
at com.sun.xml.bind.v2.model.nav.ReflectionNavigator.findClass(ReflectionNavigator.java:519)
at com.sun.xml.bind.v2.model.nav.ReflectionNavigator.findClass(ReflectionNavigator.java:58)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:249)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:100)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:81)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:209)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:95)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:81)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:315)
at com.sun.xml.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:92)
at com.sun.xml.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:69)
at com.sun.xml.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:58)
at com.sun.xml.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:51)
at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:74)
at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:77)
at java.util.AbstractList$Itr.next(AbstractList.java:358)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:255)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:100)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:81)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:209)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:95)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:81)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:315)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:330)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:466)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:302)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1140)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:154)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:121)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:253)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:240)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:440)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:637)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:584)
at com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:220)
at com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:218)
at java.security.AccessController.doPrivileged(AccessController.java:34)
at com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:217)
at com.sun.xml.ws.spi.ProviderImpl.<clinit>(ProviderImpl.java:88)
... 55 more
`
The trace of the exception starts in this line of code:
AutomovilServletClient clienteService = new AutomovilServletClient();
AutomovilServletClient has a constructor which initializes the API service:
public AutomovilServletClient() {
this.automovilAPI = new AutomovilServerAPIService().getAutomovilServerAPIPort();
}
First goes to the constructor of AutomovilServerAPIService:
#WebServiceClient(name = "AutomovilServerAPIService", targetNamespace = "http://server.beeva.com/", wsdlLocation = "http://1.XXXX.appspot.com/AutomovilServerAPIService.wsdl")
public class AutomovilServerAPIService
extends Service
{
private final static URL AUTOMOVILSERVERAPISERVICE_WSDL_LOCATION;
private final static Logger logger = Logger.getLogger(com.beeva.client.gen.AutomovilServerAPIService.class.getName());
static {
URL url = null;
try {
URL baseUrl;
baseUrl = com.beeva.client.gen.AutomovilServerAPIService.class.getResource(".");
url = new URL(baseUrl, "http://1.XXXX.appspot.com/AutomovilServerAPIService.wsdl");
} catch (MalformedURLException e) {
logger.warning("Failed to create URL for the wsdl Location: 'http://1.XXXX.appspot.com/AutomovilServerAPIService.wsdl', retrying as a local file");
logger.warning(e.getMessage());
}
AUTOMOVILSERVERAPISERVICE_WSDL_LOCATION = url;
}
public AutomovilServerAPIService() {
super(AUTOMOVILSERVERAPISERVICE_WSDL_LOCATION, new QName("http://server.beeva.com/", "AutomovilServerAPIService"));
}
}
In the method AutomovilServerAPIService() is where I lose track of the execution. I have checked the content of the constant AUTOMOVILSERVERAPISERVICE_WSDL_LOCATION and it's correct.
Anyone has an idea of why it happens when it is deployed up to Google App Engine?
Thanks in advance
UPDATE: Trying the SOAP example of Google Developers I have found that the problem comes with use of Java Server Faces Servlet. My project is a Google Web Application Project with JSF capabilities. So this line in the web.xml is what causes the problem:
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
However, I have no idea how to fix it :(
UPDATE 2:
SOLVED!! I have found that the problem is a incompatiblity of GAE with Apache MyFaces JSF-Core 2.0. When adding JSF Capabilities via properties/Project Facets, select JSF 2.0 (Mojarra 2.Z.X-FCS) instead of Apache MyFaces
I tried example at https://developers.google.com/appengine/articles/soap and it is working both locally and online.
The changes i made before online deployment were:
For Server application changed url in wsdl file
For client application changed url in SOAPService.java
I think second change you have already done.
Can you confirm whether you have updated WSDL file before deploying online?
<service name="TestSOAPService">
<port name="TestSOAPPort" binding="tns:TestSOAPPortBinding">
<soap:address location="**http://CHANGE_TO_ONLINEID.appspot.com**/testsoap"/>
</port>
</service>
Related
I followed the quick setup steps given in the documentation (https://apim.docs.wso2.com/en/3.1.0/learn/analytics/configuring-apim-analytics/) to configure WSO2 APIM Analytics 3.1.0.
The worker profile of the analytics server starts well.
The WSO2 APIM server starts well.
But when I start the dashboard profile of the analytics server, I am getting the below error and the dashboard portal doesn't open. But at the end it shows as analytics server started.
Need suggestions to fix this issue. I am using jdk-8.0.202.08.
ERROR {msf4j-core} - [SCR] Error while trying to bind reference Reference[name = microservice, interface =
org.wso2.msf4j.Microservice, policy = dynamic, cardinality = 0..n,
target = null, bind = addService, unbind = removeService]
Details:
Problematic reference = Reference[name = microservice, interface = org.wso2.msf4j.Microservice, policy = dynamic, cardinality
= 0..n, target = null, bind = addService, unbind = removeService]
of service component = org.wso2.msf4j.internal.MicroServicesServerSC
component implementation class = org.wso2.msf4j.internal.MicroservicesServerSC
located in bundle with symbolic name = msf4j-core
bundle location = reference:file:../lib/plugins/msf4j-core_2.7.7.jar
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.internal.ds.model.ComponentReference.bind(ComponentReference.java:376)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.bindReference(ServiceComponentProp.java:444)
at org.eclipse.equinox.internal.ds.InstanceProcess.dynamicBind(InstanceProcess.java:416)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:334)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:915)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225)
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:464)
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:482)
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:999)
at org.wso2.carbon.uiserver.internal.deployment.msf4j.MicroservicesRegistrar.register(MicroservicesRegistrar.java:154)
at org.wso2.carbon.uiserver.internal.deployment.msf4j.MicroservicesRegistrar.lambda$register$3(MicroservicesRegistrar.java:144)
at org.wso2.carbon.uiserver.internal.deployment.msf4j.MicroservicesRegistrar$$Lambda$282.00000000136A32F0.apply(Unknown
Source)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1556)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:496)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:486)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:241)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at org.wso2.carbon.uiserver.internal.deployment.msf4j.MicroservicesRegistrar.register(MicroservicesRegistrar.java:145)
at org.wso2.carbon.uiserver.internal.deployment.listener.AppTransportBinder.appDeploymentEvent(AppTransportBinder.java:76)
at org.wso2.carbon.uiserver.internal.io.deployment.ArtifactAppDeployer.publishAppDeploymentEvent(ArtifactAppDeployer.java:154)
at org.wso2.carbon.uiserver.internal.io.deployment.ArtifactAppDeployer.deploy(ArtifactAppDeployer.java:103)
at org.wso2.carbon.deployment.engine.internal.DeploymentEngine.lambda$deployArtifacts$0(DeploymentEngine.java:291)
at org.wso2.carbon.deployment.engine.internal.DeploymentEngine$$Lambda$237.0000000015CDC120.accept(Unknown
Source)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.wso2.carbon.deployment.engine.internal.DeploymentEngine.deployArtifacts(DeploymentEngine.java:282)
at org.wso2.carbon.deployment.engine.internal.RepositoryScanner.sweep(RepositoryScanner.java:112)
at org.wso2.carbon.deployment.engine.internal.RepositoryScanner.scan(RepositoryScanner.java:68)
at org.wso2.carbon.deployment.engine.internal.DeploymentEngine.start(DeploymentEngine.java:121)
at org.wso2.carbon.deployment.engine.internal.DeploymentEngineListenerComponent.onAllRequiredCapabilitiesAvailable(DeploymentEngineListenerComponent.java:216)
at org.wso2.carbon.kernel.internal.startupresolver.StartupComponentManager.lambda$notifySatisfiableComponents$7(StartupComponentManager.java:266)
at org.wso2.carbon.kernel.internal.startupresolver.StartupComponentManager$$Lambda$159.0000000013AD3830.accept(Unknown
Source)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.wso2.carbon.kernel.internal.startupresolver.StartupComponentManager.notifySatisfiableComponents(StartupComponentManager.java:252)
at org.wso2.carbon.kernel.internal.startupresolver.StartupOrderResolver$1.run(StartupOrderResolver.java:204)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Caused by: java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.ensureError(J9VMInternals.java:146)
at java.lang.J9VMInternals.recordInitializationFailure(J9VMInternals.java:135)
at org.wso2.msf4j.internal.MicroservicesServerSC.addMicroserviceToRegistry(MicroservicesServerSC.java:421)
at org.wso2.msf4j.internal.MicroservicesServerSC.addService(MicroservicesServerSC.java:108)
... 50 more
Caused by: java.lang.IllegalStateException: java.lang.ClassNotFoundException: java.lang.Class$Atomic
at org.wso2.msf4j.util.RuntimeAnnotations.(RuntimeAnnotations.java:110)
... 52 more
Caused by: java.lang.ClassNotFoundException: java.lang.Class$Atomic
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:332)
at org.wso2.msf4j.util.RuntimeAnnotations.(RuntimeAnnotations.java:58)
... 52 more
make sure all 3 components are under same directory
use open jdk java-1.8.0-openjdk-1.8.0.232-3
for me it's working fine
Looks like APIM analytics doesn't support Open JDK. Can you refer to this issue[1]? Also, do the same test with Oracle JDK and check this is reproduced in there as well.
[1] https://github.com/wso2/analytics-apim/issues/944
I was following one of the tutorials from WSO2's learning website and tried to setup the Analytics server 3.1.0 with APIM 3.1.0. I followed the below sequence of starting the servers.
APIM Analytics worker profile
APIM server
APIM Analytics dashboard profile
The APIM Analytics worker profile and the APIM server started without any issue.
But on starting the Analytics dashboard profile, I am getting the below error though i can see message at the last that APIM Analytics Server started.
**ERROR** {msf4j-core} - [SCR] Error while trying to bind reference Reference[name = microservice, interface = org.wso2.msf4j.Microservice, policy = dynamic, cardinality = 0..n, target = null, bind = addService, unbind = removeService]
Details:
Problematic reference = Reference[name = microservice, interface = org.wso2.msf4j.Microservice, policy = dynamic, cardinality = 0..n, target = null, bind = addService, unbind = removeService]
of service component = org.wso2.msf4j.internal.MicroServicesServerSC
component implementation class = org.wso2.msf4j.internal.MicroservicesServerSC
located in bundle with symbolic name = msf4j-core
bundle location = reference:file:../lib/plugins/msf4j-core_2.7.7.jar java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.internal.ds.model.ComponentReference.bind(ComponentReference.java:376)
at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.bindReference(ServiceComponentProp.java:444)
at org.eclipse.equinox.internal.ds.InstanceProcess.dynamicBind(InstanceProcess.java:416)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:334)
at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:915)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225)
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:464)
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:482)
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:999)
at org.wso2.carbon.uiserver.internal.deployment.msf4j.MicroservicesRegistrar.register(MicroservicesRegistrar.java:154)
at org.wso2.carbon.uiserver.internal.deployment.msf4j.MicroservicesRegistrar.lambda$register$3(MicroservicesRegistrar.java:144)
at org.wso2.carbon.uiserver.internal.deployment.msf4j.MicroservicesRegistrar$$Lambda$282.00000000160C0730.apply(Unknown Source)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1556)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:496)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:486)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:241)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at org.wso2.carbon.uiserver.internal.deployment.msf4j.MicroservicesRegistrar.register(MicroservicesRegistrar.java:145)
at org.wso2.carbon.uiserver.internal.deployment.listener.AppTransportBinder.appDeploymentEvent(AppTransportBinder.java:76)
at org.wso2.carbon.uiserver.internal.io.deployment.ArtifactAppDeployer.publishAppDeploymentEvent(ArtifactAppDeployer.java:154)
at org.wso2.carbon.uiserver.internal.io.deployment.ArtifactAppDeployer.deploy(ArtifactAppDeployer.java:103)
at org.wso2.carbon.deployment.engine.internal.DeploymentEngine.lambda$deployArtifacts$0(DeploymentEngine.java:291)
at org.wso2.carbon.deployment.engine.internal.DeploymentEngine$$Lambda$237.0000000015F30F90.accept(Unknown Source)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.wso2.carbon.deployment.engine.internal.DeploymentEngine.deployArtifacts(DeploymentEngine.java:282)
at org.wso2.carbon.deployment.engine.internal.RepositoryScanner.sweep(RepositoryScanner.java:112)
at org.wso2.carbon.deployment.engine.internal.RepositoryScanner.scan(RepositoryScanner.java:68)
at org.wso2.carbon.deployment.engine.internal.DeploymentEngine.start(DeploymentEngine.java:121)
at org.wso2.carbon.deployment.engine.internal.DeploymentEngineListenerComponent.onAllRequiredCapabilitiesAvailable(DeploymentEngineListenerComponent.java:216)
at org.wso2.carbon.kernel.internal.startupresolver.StartupComponentManager.lambda$notifySatisfiableComponents$7(StartupComponentManager.java:266)
at org.wso2.carbon.kernel.internal.startupresolver.StartupComponentManager$$Lambda$159.0000000013DAFD90.accept(Unknown Source)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.wso2.carbon.kernel.internal.startupresolver.StartupComponentManager.notifySatisfiableComponents(StartupComponentManager.java:252)
at org.wso2.carbon.kernel.internal.startupresolver.StartupOrderResolver$1.run(StartupOrderResolver.java:204)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Caused by: java.lang.NoClassDefFoundError: org.wso2.msf4j.util.RuntimeAnnotations (initialization failure)
at java.lang.J9VMInternals.initializationAlreadyFailed(J9VMInternals.java:96)
at org.wso2.msf4j.internal.MicroservicesServerSC.addMicroserviceToRegistry(MicroservicesServerSC.java:421)
at org.wso2.msf4j.internal.MicroservicesServerSC.addService(MicroservicesServerSC.java:108)
... 49 more
Caused by: java.lang.IllegalStateException: java.lang.ClassNotFoundException: java.lang.Class$Atomic
at org.wso2.msf4j.util.RuntimeAnnotations.<clinit>(RuntimeAnnotations.java:110)
at org.wso2.msf4j.internal.MicroservicesServerSC.addMicroserviceToRegistry(MicroservicesServerSC.java:421)
at org.wso2.msf4j.internal.MicroservicesServerSC.addService(MicroservicesServerSC.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
... 48 more
Caused by: java.lang.ClassNotFoundException: java.lang.Class$Atomic
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:332)
at org.wso2.msf4j.util.RuntimeAnnotations.<clinit>(RuntimeAnnotations.java:58)
... 52 more
[2020-07-22 21:36:30,653] INFO {org.wso2.carbon.uiserver.internal.deployment.listener.AppTransportBinder} - Web app 'policies' is available at 'https://10.184.69.117:9643/policies'.
[2020-07-22 21:36:30,662] INFO {org.wso2.carbon.kernel.internal.CarbonStartupHandler} - **WSO2 API Manager Analytics Server started in 10.285 sec**
And, when I try to open the link : https://localhost:9643/analytics-dashboard/ , it gives an error which says: "Problem accessing: /analytics-dashboard/. Reason: Not Found".
Need help with this issue.
What version of Java are you using?
According to the error, you are looking for a class that does not exist, it may be a standard class that only has one version, I recommend using Java 11 for this version.
Currently I have a standalone Jersey 2.x web app in my liferay tomcat container, set to run asynchronously. I also have my main portlet in Liferay built with Vaadin.
I want to move my REST service to my vaadin project, so that I can leverage hibernate and caching from my main app.
However, when I move all the code over, and the servlet entry in the web.xml file, it throws the exception below when I make a GET call to the service.
Has anybody accomplished this? I am thinking it has something to with the asynchronous functionality, or maybe spring? I am running Liferay 6.1.1 GA2.
`SEVERE: Servlet.service() for servlet [TEKControl RESTFul API] in context with path [/tekwave-portlet] threw exception [javax.ws.rs.ProcessingExceptio`
`n: Attempt to suspend a connection of an asynchronous request failed in the underlying container.] with root cause`
`javax.ws.rs.ProcessingException: Attempt to suspend a connection of an asynchronous request failed in the underlying container.`
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:331)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:106)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:259)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:318)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:236)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1010)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:373)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:382)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:345)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:220)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at sun.reflect.GeneratedMethodAccessor386.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:67)
at $Proxy526.doFilter(Unknown Source)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:167)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
at com.liferay.portal.kernel.servlet.PortalClassLoaderFilter.doFilter(PortalClassLoaderFilter.java:70)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1813)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
UPDATE
When I debug this, it reaches the class I'm calling with a GET request, but it throws the error after declaring some things and before going into the GET method. Below is my GET method declaration:
#GET
#Produces("application/xml")
public void AnswerPhoneCall(#Suspended final AsyncResponse asyncResponse, #Context UriInfo ui) {
final MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
new Thread(new Runnable() {
#Override
public void run() {
String ret = "Testing";
asyncResponse.resume(ret);
}
}).start();
}
----WORKING SOLUTION---
Since the liferay invoker filter was causing the issue, and I also don't think Liferay fully supports Servlet 3.0 yet, below is what we came up with to solve this problem.
Add a class that implements "org.glassfish.jersey.servlet.ServletContainer"
import org.apache.catalina.Globals;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;
public class ServletContainer extends org.glassfish.jersey.servlet.ServletContainer {
#Override
public void service(ServletRequest request, ServletResponse response)
throws ServletException, IOException {
request.setAttribute(Globals.ASYNC_SUPPORTED_ATTR, true);
super.service(request, response);
}
}
Change your servlet entry in the portlet web.xml to the above class:
<servlet>
<servlet-name>RESTFul API</servlet-name>
<servlet-class>com.myportlet.api.jersey.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.myportlet.api</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>RESTFul API</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
Add the following dependency in maven, if that is what you use
<dependency>
<groupId>org.apache.geronimo.ext.tomcat</groupId>
<artifactId>catalina</artifactId>
<version>7.0.39.1</version>
<scope>provided</scope>
</dependency>
can you please check connector property in server.xml
<Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="20000"
redirectPort="8443" />
AFAIU, it has Nothing to do with connector property. Basically what is happening is Liferay's filter is trying to intercept the request to the Jersey REST Webservice servlets. You may need to change Filter mappings of Liferay's filters in web.xml to exclude Jersey's servlets.
Another, possibly cleaner approach is that you may want to develop a "Web" plugin to host your REST services project. I haven't tried this, but you may want to explore possibilities in this direction.
I have a simple web service exposing Java resources through REST using Jersey2 and Jetty. It works fine on my laptop's localhost. However, when I deploy the same code onto a virtual machine on my company's network, I get an error. Without Jersey, Jetty runs successfully and the welcome page displays fine on the virtual machine.
I have searched for similar issues and found this promising one, however what worked for PrasanthNath doesn't seem to apply to my case. I have tried with version 2.6 of the libraries suggested on that link, too but it didn't make a difference.
I'd highly appreciate your thoughts. Thank you in advance!
Here's the error I get:
$ gradle jettyRunWar
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:war UP-TO-DATE
:jettyRunWar
failed Jersey REST Service: java.lang.NoSuchFieldError: INCLUDE_ALL
failed org.gradle.api.plugins.jetty.internal.JettyPluginWebAppContext#248d3e1b{/dgp_ky_140310,/home/unix /kyuksel/dgp_ky_140310/build/libs/dgp_ky_140310-0.1.war}: java.lang.NoSuchFieldError: INCLUDE_ALL
failed ContextHandlerCollection#7915b3e: java.lang.NoSuchFieldError: INCLUDE_ALL
failed HandlerCollection#57fd4753: java.lang.NoSuchFieldError: INCLUDE_ALL
Error starting handlers
java.lang.NoSuchFieldError: INCLUDE_ALL
at org.glassfish.jersey.server.ResourceConfig$State.<init>(ResourceConfig.java:110)
at org.glassfish.jersey.server.ResourceConfig.<init>(ResourceConfig.java:351)
at org.glassfish.jersey.servlet.WebComponent.createResourceConfig(WebComponent.java:427)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:294)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:167)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:349)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:440)
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:263)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1272)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:489)
at org.gradle.api.plugins.jetty.internal.JettyPluginWebAppContext.doStart(JettyPluginWebAppContext.java:112)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.gradle.api.plugins.jetty.internal.Jetty6PluginServer.start(Jetty6PluginServer.java:111)
at org.gradle.api.plugins.jetty.AbstractJettyRunTask.startJettyInternal(AbstractJettyRunTask.java:238)
at org.gradle.api.plugins.jetty.AbstractJettyRunTask.startJetty(AbstractJettyRunTask.java:191)
at org.gradle.api.plugins.jetty.AbstractJettyRunTask.start(AbstractJettyRunTask.java:162)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:533)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:516)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:289)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$1.run(DefaultTaskPlanExecutor.java:33)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:198)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:266)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:135)
at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:95)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:31)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:86)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:46)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.Main.main(Main.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
This is the snapshot of the org.glassfish.jersey.server.ResourceConfig code where the error (line 110) is coming from:
109 public More ...State() {
110 super(RuntimeType.SERVER, ComponentBag.INCLUDE_ALL);
111 this.classLoader = AccessController.doPrivileged(ReflectionHelper.getContextClassLoaderPA());
112
113 this.resourceFinders = Sets.newHashSet();
114
115 this.resources = Sets.newHashSet();
116 this.resourcesView = Collections.unmodifiableSet(this.resources);
117 }
Here's my build.gradle with the dependencies:
version = '0.1'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'checkstyle'
apply plugin: 'jetty'
apply plugin: 'war'
checkstyle {
configFile = new File(rootDir, "checkstyle/checkstyle.xml")
}
jar {
manifest {
attributes 'Main-Class': 'org.broadinstitute.genomestore.GenomeStore',
'Implementation-Title': 'GenomeStore',
'Implementation-Version': version
}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
repositories {
mavenCentral()
maven {
url "https://google-api-client-libraries.appspot.com/mavenrepo"
}
}
dependencies {
compile 'ch.qos.logback:logback-classic:1.0.13'
compile 'com.google.api-client:google-api-client:1.17.0-rc'
compile 'com.google.apis:google-api-services-storage:v1beta2-rev36-1.17.0-rc'
compile 'com.google.http-client:google-http-client-jackson2:1.17.0-rc'
compile 'com.google.apis:google-api-services-bigquery:v2-rev129-1.17.0-rc'
compile 'javax.json:javax.json-api:1.0'
compile 'javax.ws.rs:javax.ws.rs-api:2.0'
compile 'org.glassfish.jersey:jax-rs-ri:2.0-rc1'
compile 'org.glassfish.jersey.core:jersey-server:2.4'
compile 'org.glassfish.jersey.containers:jersey-container-servlet:2.4'
compile 'org.glassfish.jersey.media:jersey-media-json-processing:2.7'
compile 'org.slf4j:slf4j-api:1.7.5'
providedCompile 'javax.servlet:servlet-api:2.5'
runtime 'javax.servlet:jstl:1.1.2'
}
task(runGenomeStore, dependsOn: 'classes', type: JavaExec) {
main = 'org.broadinstitute.genomestore.GenomeStore'
classpath = sourceSets.main.runtimeClasspath
}
defaultTasks 'build'
Here's my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>ResultStoreServlet</servlet-name>
<servlet-class>org.broadinstitute.genomestore.rest.ResultStoreServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ResultStoreServlet</servlet-name>
<url-pattern>/Hello</url-pattern>
</servlet-mapping>
<display-name>dgp_ky_140310</display-name>
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>org.broadinstitute.genomestore.rest</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
And finally here's my sample class:
#Path("/server/")
public class Server {
#GET
#Produces("application/json")
public JsonObject getJson() {
JsonObject model = Json.createObjectBuilder()
.add("gene_info", Json.createObjectBuilder()
.add("DESCRIPTION", "The protein encoded by this gene ...")
.add("NAME", "XXX")
.add("SYMBOL", "YYY")
.add("VARIANT_SUMMARY", Json.createObjectBuilder()
.add("NEAR_GENE_NOMINAL", "99")
.add("OTHER_TRAIT_GENOMEWIDE", "99")
.add("TOTAL_VARIANTS", "289")))
.add("is_error", false)
.build();
return model;
}
}
I was able to solve the issue by removing javax.ws.rs:javax.ws.rs-api:2.0 changing org.glassfish.jersey.media:jersey-media-json-processing:2.7 to version 2.4. I had done some playing with libraries while developing the code and apparently let build.gradle and library folder get out of sync, which got exposed only when I deployed the code on the virtual machine, which lacked some of the essential libraries.
I have an Axis2 web service called DownloadServer that is invoking another Axis2 web service called Publisher. They are deployed on the same server. Here is the code for the two web services.
In class Publisher.java:
public String getFileServers(){
return "http://localhost:8080/axis2/services/FileServer1?wsdl http://localhost:8080/axis2/services/FileServer2?wsdl";
}
In class DownloadServer.java:
public synchronized String getBandwidth(String title) {
try {
// Call Publisher service to get addresses of File Servers
RPCServiceClient serviceClient = new RPCServiceClient();
Options options = serviceClient.getOptions();
EndpointReference targetEPR = new EndpointReference(
"http://localhost:8080/axis2/services/Publisher?wsdl");
options.setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION,
org.apache.axis2.Constants.VALUE_TRUE);
options.setTo(targetEPR);
QName methodName = new QName("http://ws.apache.org/axis2",
"getFileServers");
Class[] returnTypes = new Class[] { String.class };
Object[] args = new Object[] {};
// Exception occurs on the next line
Object[] response = serviceClient.invokeBlocking(methodName, args,
returnTypes);
serviceClient.cleanupTransport();
String fileServers = (String) response[0];
return fileServers
} catch (Exception e) {
e.printStackTrace(out);
return "0";
}
}
I am getting the following Axis2 fault:
org.apache.axis2.AxisFault: The server did not recognise the action which it received:
at org.apache.axis2.handlers.addressing.AddressingInFaultHandler.invoke(AddressingInFaultHandler.java:114)
at org.apache.axis2.engine.Phase.invoke(Phase.java:318)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:254)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:160)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:364)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:540)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:521)
at org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:102)
at DownloadServer.getBandwidth(DownloadServer.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:194)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:173)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:144)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
The interesting aspect is that when I run the DownloadServer class as a regular java application (not invoked as a web service), i do not get the same exception.
Does anyone have any idea what may be going wrong when the same code is executed as a web service?
OK, I found the answer eventually. Looks like explicitly setting the SOAP action solves the problem. It can be done like this:
options.setAction("urn:getFileServers");