error when deploying Java WS in Jboss 6.3.0 EAP - web-services

I am migrating an application with Java WS from Jboss 5.1.0 to Jboss 6.3.0 EAP. It works fine with Jboss 5.1.0 but I am getting error while deploying the same in Jboss 6.3.0 EAP.
14:42:10,887 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deploy
ment.unit."my-app.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."dtm-banking.
war".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment "dtm-banking.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [jboss-a
s-server-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980) [jboss-ms
c-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1913) [jboss-msc-1.1.5.F
inal-redhat-1.jar:1.1.5.Final-redhat-1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_60]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_60]
Caused by: javax.xml.ws.WebServiceException: java.lang.reflect.UndeclaredThrowableException
at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:371)
at org.jboss.wsf.stack.cxf.deployment.EndpointImpl.doPublish(EndpointImpl.java:66)
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:251)
at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:539)
at org.jboss.wsf.stack.cxf.configuration.NonSpringBusHolder.configure(NonSpringBusHolder.java:118)
at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.startDeploymentBus(BusDeploymentAspect.java:137
)
at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.start(BusDeploymentAspect.java:69)
at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.deploy(AspectDeploymentProcessor.java:74)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [jboss-a
s-server-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
... 5 more
Caused by: java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy371.visitLabel(Unknown Source)
at org.apache.cxf.jaxws.WrapperClassGenerator.createWrapperClass(WrapperClassGenerator.java:213)
at org.apache.cxf.jaxws.WrapperClassGenerator.generate(WrapperClassGenerator.java:122)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.generatedWrapperBeanClass(JaxWsServiceFactoryBean.java:6
83)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.getExtraClass(JaxWsServiceFactoryBean.java:653)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBea
n.java:484)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:704)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBe
an.java:550)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:265)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:215)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java
:102)
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:159)
at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:456)
at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:334)
... 13 more
Caused by: java.lang.NoSuchMethodException: org.objectweb.asm.MethodWriter.visitLabel(org.objectweb.asm.Label)
at java.lang.Class.getMethod(Class.java:1665) [rt.jar:1.7.0_60]
at org.apache.cxf.common.util.ReflectionInvokationHandler.invoke(ReflectionInvokationHandler.java:85)
... 28 more
I understand Jboss 6.3.0 EAP uses CXF implementation for webservice, but I am looking for simple Java WS to use the standard Java EE environment.
tried the following in jboss-deployment-structure.xml
<exclude-subsystems>
<subsystem name="webservices" />
</exclude-subsystems>
this got rid of the exception at deployment time but I get a Classcast exception when invoking the wsdl for the service
http://localhost:8080/myapp/myservice?wsdl
JBWEB000235: Allocate exception for servlet MyWebService: java.lang.ClassCastException: com.example.webservice.endpoint.DataService cannot be cast to javax.servlet.Servlet
any idea?

The problem is bundling asm.jar in your deployment.
Try remove it and add this to your jboss-deployment-structure.xml:
<jboss-deployment-structure>
<deployment>
<dependencies>
...
<module name="asm.asm" />
...
</dependencies>
</deployment>
</jboss-deployment-structure>
See more: https://developer.jboss.org/message/823745

The answer that fixed things for me was:
I had the same problem. Adding jboss-deployment-structure.xml only
work for WAR files. If I depolyed the WAR inside an EAR I got the
error back. So I added
<global-modules>
<module name="asm.asm" slot="main"/>
</global-modules>
to the current jboss configuration, ie standalone-full.xml The it
work fine for me.
So if anyone stumbles upon this question, give it a try.

Rifer this page too.
https://access.redhat.com/solutions/690353
The above Error is thrown when for given class particular method not
found. Hence user is packaging asm jar in their application and class
"org.objectweb.asm.MethodWriter" which contains in a jar does not have
method "public void visitLabel(org.objectweb.asm.Label);" hence
getting "java.lang.NoSuchMethodException".

Related

Keycloak jetty adapter cannot be installed in Apache Karaf

I use Apache Karaf 4.2.8. I installed keycloak osgi features. I could configure authentication for karaf shell with keycloak using keycloak-jaas feature.
Now I want to configure authentication for my services under /cxf context.
I configured pax-web context so login-method is KEYCLOAK.
But I have to install keycloak-jetty-adapter as well, so it could be integrated. But when I try to install that feature I receive an error.
trun()> feature:install keycloak-jetty9-adapter
org.apache.felix.resolver.reason.ReasonException: Unable to resolve
root: missing requirement [root] osgi.identity;
osgi.identity=keycloak-jetty9-adapter; type=karaf.feature;
version="[8.0.1,8.0.1]";
filter:="(&(osgi.identity=keycloak-jetty9-adapter)(type=karaf.feature)(version>=8.0.1)(version<=8.0.1))" [caused by: Unable to resolve keycloak-jetty9-adapter/8.0.1: missing
requirement [keycloak-jetty9-adapter/8.0.1] osgi.identity;
osgi.identity=jetty; type=karaf.feature; version="[9.2.0,9.3.0)"] at
org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
at
org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:392)
at
org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:378)
at
org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:332)
at
org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:257)
at
org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:388)
at
org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1058)
at
org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:994)
at java.util.concurrent.FutureTask.run(FutureTask.java:266) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748) Caused by:
org.apache.felix.resolver.reason.ReasonException: Unable to resolve
keycloak-jetty9-adapter/8.0.1: missing requirement
[keycloak-jetty9-adapter/8.0.1] osgi.identity; osgi.identity=jetty;
type=karaf.feature; version="[9.2.0,9.3.0)" at
org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343)
... 12 more Error executing command: Unable to resolve root: missing
requirement [root] osgi.identity;
osgi.identity=keycloak-jetty9-adapter; type=karaf.feature;
version="[8.0.1,8.0.1]";
filter:="(&(osgi.identity=keycloak-jetty9-adapter)(type=karaf.feature)(version>=8.0.1)(version<=8.0.1))" [caused by: Unable to resolve keycloak-jetty9-adapter/8.0.1: missing
requirement [keycloak-jetty9-adapter/8.0.1] osgi.identity;
osgi.identity=jetty; type=karaf.feature; version="[9.2.0,9.3.0)"]
If not to install that adapter, then I cannot reach my service (I receive 403 Forbidden) as it is protected via pax-web but authentication is impossible.
It seems that jetty within karaf is embedded and does not contain all features, which does not allow me to install jetty adapter.
According to the release notes for Apache Karaf 4.2.8, Karaf is using Jetty 9.4.22, which seems to be outside of your range in the error message version="[9.2.0,9.3.0)"
You'll either need to upgrade Keycloak to one that support Jetty 9.4.x
or downgrade Karaf to one that supports the same version of Jetty that Keycloak uses.

Problems running wso2ei sample 904 - kafka inbound endpoint

I trying out sample 904 for WSO2 EI and following the sample guidelines.
Still I'm getting the following error when starting up the runtime:
[2018-05-12 19:54:45,960] [] INFO - KAFKAMessageListener Creating Kafka Consumer Connector...
[2018-05-12 19:54:45,977] [] INFO - MediationStatisticsComponent Global Message-Flow Statistic Reporting is Disabled
Exception in thread "Thread-18" java.lang.NoClassDefFoundError: com/typesafe/scalalogging/Logger$
at kafka.utils.Log4jControllerRegistration$.<init>(Logging.scala:25)
at kafka.utils.Log4jControllerRegistration$.<clinit>(Logging.scala)
at kafka.utils.Logging.$init$(Logging.scala:47)
at kafka.utils.VerifiableProperties.<init>(VerifiableProperties.scala:27)
at kafka.consumer.ConsumerConfig.<init>(ConsumerConfig.scala:110)
at org.wso2.carbon.inbound.endpoint.protocol.kafka.KAFKAMessageListener.createKafkaConsumerConnector(KAFKAMessageListener.java:56)
at org.wso2.carbon.inbound.endpoint.protocol.kafka.KAFKAPollingConsumer.poll(KAFKAPollingConsumer.java:145)
at org.wso2.carbon.inbound.endpoint.protocol.kafka.KAFKAPollingConsumer.execute(KAFKAPollingConsumer.java:116)
at org.wso2.carbon.inbound.endpoint.protocol.kafka.KAFKATask.taskExecute(KAFKATask.java:48)
at org.wso2.carbon.inbound.endpoint.common.InboundRunner.run(InboundRunner.java:108)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.typesafe.scalalogging.Logger$ cannot be found by kafka_2.12_1.1.0_1.0.0
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 11 more
Don't know my options and I ran out of ideas. Any help would be appreciated.
Versions:
jre 1.8.0_161
wso2ei 6.2.0
kafka 2.12-1.1.0
zookeeper 3.4.12
Looks like it cannot find the "Logger" class. Are you sure you copied all of the required libs to /lib (also the one mentioned in the notes section of wso2 documentation if needed)?
What you could try is to start EI with osgi console enabled and check if the class is there. The following link might help.
OSGI
What you could also do is to open/extract the imported jar's and see if there's the class inside.

Startup Errors for Version 5.2 of WSO2 Identity Server

I have downloaded the latest version of wso2 identity server (5.2). However during the startup process I am getting the following errors.
[2016-10-26 09:50:27,563] INFO {org.wso2.carbon.webapp.mgt.TomcatGenericWebappsDeployer} - Deployed webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/wso2].File[D:\wso2is-5.2.0\bin\..\repository\deployment\server\webapps\wso2.war]
java.io.IOException: DerInputStream.getLength(): lengthTag=109, too big.
java.security.KeyStoreException: failed to extract any certificates or private keys - maybe bad password?
[2016-10-26 09:50:29,074] ERROR {org.jaggeryjs.scriptengine.engine.RhinoEngine} -
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
Caused by: java.lang.ExceptionInInitializerError
at org.apache.commons.ssl.SSL.<init>(SSL.java:154)
at org.apache.commons.ssl.SSLClient.<init>(SSLClient.java:60)
at org.apache.commons.ssl.HttpSecureProtocol.<init>(HttpSecureProtocol.java:55)
at org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory.<init>(EasySSLProtocolSocketFactory.java:94)
at org.jaggeryjs.hostobjects.xhr.XMLHttpRequestHostObject.<init>(XMLHttpRequestHostObject.java:84)
... 113 more
Caused by: java.lang.NullPointerException
at org.apache.commons.ssl.TrustMaterial.<init>(TrustMaterial.java:127)
at org.apache.commons.ssl.TrustMaterial.<init>(TrustMaterial.java:118)
at org.apache.commons.ssl.TrustMaterial.<clinit>(TrustMaterial.java:108)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.commons.ssl.KeyMaterial
at org.apache.commons.ssl.SSL.<init>(SSL.java:154)
at org.apache.commons.ssl.SSLClient.<init>(SSLClient.java:60)
It is a vanilla version of the server and I haven't made any kind of configuration changes. I am running on JDK 1.8. Can someone tell me what the resolution will be. I tried including "not-yet-commons-ssl-0.3.10.jar" and that didnt help.
Regards
Ranjith Madhavan
I recently got this exception, it was due to the fact that i donot have /lib/security/cacerts and /lib/security/jssecacerts in my jre.

Jetty deployment: Unable to compile class for JSP

I tried to deploy to and run Jetty from an Ant-script, but get the following error:
[jetty.run] 2016-06-25 09:16:54.333: Starting web application null
[jetty.run] [main] WARN org.eclipse.jetty.annotations.ServletContainerInitializersStarter -
[jetty.run] javax.servlet.ServletException: Not running on Jetty, WebSocket+CDI support unavailable
[jetty.run] at org.eclipse.jetty.cdi.websocket.WebSocketCdiInitializer.onStartup(WebSocketCdiInitializer.java:49)
[jetty.run] at org.eclipse.jetty.plus.annotation.ContainerInitializer.callStartup(ContainerInitializer.java:140)
[jetty.run] at org.eclipse.jetty.annotations.ServletContainerInitializersStarter.doStart(ServletContainerInitializersStarter.java:63)
[jetty.run] at
...
It work without deployment, but with the war-file this happens. What is corrupt?
UPDATE:
Added
<listener>
<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
</listener>
<resource-env-ref>
<description>Object factory for the CDI Bean Manager</description>
<resource-env-ref-name>BeanManager</resource-env-ref-name>
<resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
</resource-env-ref>
to web.xml andweld jars to lib. Now I get this:
java.lang.reflect.InvocationTargetException
[jetty.run] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[jetty.run] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[jetty.run] at ...
[jetty.run] Caused by: java.lang.IllegalStateException: Nothing to bind for name BeanManager
UPDATE 2:
Ok, I didn't need the extra things in my web.xml. Instead I had forgot to add
<typedef name="webApp" classname="org.eclipse.jetty.ant.AntWebAppContext" classpathref="classpath" loaderref="jetty.loader"/>
to build.xml. I can now deploy and run jetty, but can't process JSP files:
[jetty.run] [qtp1387380406-14] WARN org.eclipse.jetty.servlet.ServletHandler -
[jetty.run] org.apache.jasper.JasperException: Unable to compile class for JSP
[jetty.run] at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:600) ...
Why is this so?
Remove the various jetty cdi jar files from your project.
Those are designed specifically for jetty-distribution use, and are inappropriate for embedded-jetty.
Use the weld jars directly in your war file, along with the various recommended configurations that the weld project documentation tell you about.

NoClassDefFoundError: com.ibm.ws.wstx.handler.WSATGenerator

I'm using the web client for web service. Client stub is generated with Axis 2. Everything is deployed on WebSphere 7.0.
When deployed on my developer machine (websphere instance run inside IBM RAD Eclipse) I'm connected with remote web service. However, on test machine, the error is thrown:
java.lang.NoClassDefFoundError: com.ibm.ws.wstx.handler.WSATGenerator (initialization failure)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:140)
at com.ibm.ws.wstx.WSTXClientTCMImpl.handleInbound(WSTXClientTCMImpl.java:100)
at com.ibm.ws.wstx.WSTXClientTCMImpl.cleanupContext(WSTXClientTCMImpl.java:81)
at org.apache.axis2.util.ThreadContextMigratorUtil.performContextCleanup(ThreadContextMigratorUtil.java:192)
at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.postExecute(AxisInvocationController.java:657)
at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.execute(AxisInvocationController.java:589)
at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.doInvoke(AxisInvocationController.java:130)
at org.apache.axis2.jaxws.core.controller.impl.InvocationControllerImpl.invoke(InvocationControllerImpl.java:93)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invokeSEIMethod(JAXWSProxyHandler.java:364)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invoke(JAXWSProxyHandler.java:185)
at $Proxy94.getList(Unknown Source)
The ear that is deployed there is made by me on my development machine, so it's exactly the same code. So I suppose that it's some configuration issue. However, I have no idea, what part of configuration can be responsible for that.
So, I have the question, what is this WSATGenerator, and in which jar it should be available? Is it a standard library on WebSphere, or must it be manually configured? What configuration differences could cause that error thrown on test server and no by me?
I'm running Windows 7, the test machine is on Unix. Both machines are 64bit.
--edit--
Before NoClassDefFoundError, there is throws ExceptionInInitializerError:
java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.initialize(J9VMInternals.java:222)
at com.ibm.ws.wstx.handler.WSATGenerator.<clinit>(WSATGenerator.java:127)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at com.ibm.ws.wstx.WSTXClientTCMImpl.migrateThreadToContext(WSTXClientTCMImpl.java:61)
at org.apache.axis2.util.ThreadContextMigratorUtil.performMigrationToContext(ThreadContextMigratorUtil.java:163)
at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.preExecute(AxisInvocationController.java:608)
at org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController.execute(AxisInvocationController.java:570)
... 82 more
Caused by:
java.lang.ClassCastException: com.systinet.jaxrpc.rpc.ServiceFactoryImpl incompatible with com.ibm.wsspi.webservices.rpc.ServiceFactory
at com.ibm.ws.Transaction.wstx.WSATServices$1.run(WSATServices.java:83)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:63)
at com.ibm.ws.Transaction.wstx.WSATServices.<clinit>(WSATServices.java:74)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
... 89 more