Wildfly 8.2 fails to load jbossws-cxf-client module - jboss

I am working on a web application that contains a Soap client and that needs to have access to the cxf Client implmentation, because we have to use different certificates for different calls to the remote endpoint.
Wildfly comes with a module jbossws-cxf-client which has dependencies to all the different cxf modules required. There is a maven version of this module as well.
In the maven module pom file we have a dependency like so:
<dependency>
<groupId>org.jboss.ws.cxf</groupId>
<artifactId>jbossws-cxf-client</artifactId>
<version>4.3.2.Final</version>
<scope>provided</scope>
</dependency>
Note that the version has been matched with the version that is mentioned in the wildfly 8.2 release notes:http://wildfly.org/news/2014/11/20/WildFly82-Final-Released/
When deploying our application we get the following message from the log:
14:22:12,492 INFO [org.jboss.weld.Bootstrap] (weld-worker-1) WELD-000119: Not generating any bean definitions from nl.topicuszorg.lsp.service.MultipleCertificatePingStubServiceImpl because of underlying class loading error: Type org.apache.cxf.transport.Conduit from [Module "deployment.kdplus-lsphub-server-1.1-SNAPSHOT.war:main" from Service Module Loader] not found. If this is unexpected, enable DEBUG logging to see the full error.
14:22:12,689 INFO [org.apache.deltaspike.core.util.ProjectStageProducer] (MSC service thread 1-2) Computed the following DeltaSpike ProjectStage: Production
14:22:13,628 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."kdplus-lsphub-server-1.1-SNAPSHOT.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."kdplus-lsphub-server-1.1-SNAPSHOT.war".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_25]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_25]
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type PingStubService with qualifiers #Default
at injection point [BackedAnnotatedField] #Inject nl.topicuszorg.lsp.service.PingPongServiceImpl.pingStubService
at nl.topicuszorg.lsp.service.PingPongServiceImpl.pingStubService(PingPongServiceImpl.java:0)
The real problem is logged as INFO, strangely enough. org.apache.cxf.transport.Conduit can not be loaded. This is part of the org.apache.cxf module, and should be loaded transitively by loading the jbossws-cxf-client module.
It should not be necessary, but we also implicitely declare the module dependencies in the jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<excludes>
</excludes>
<dependencies>
<module name="org.slf4j"/>
<module name="org.apache.cxf"/>
<module name="jbossws-cxf-client"/>
<module name="org.apache.cxf.impl"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
It seems the module is not loaded, I don't know why. I can not find a way to check which modules have been loaded.
What is going wrong here?

As it turned out I had to move my jboss-deployment-structure.xml from the META-INF to the WEB-INF directory.
Bummer...

Related

Errors when deploying kjar to jBPM/KieServer

I've been evaluating jBPM workbench and KieServer for automatically building and deploying rules, and I'm stuck on what I'm doing wrong. My goal is to have jars built and deployed to KieServer with minimal human intervention, and I've done the following:
Started a Docker container from https://hub.docker.com/r/jboss/jbpm-server-full. I'm able to create and deploy projects from within Workbench - but our workflow will also contain rules built outside of Workbench. If everything looks useful I'll just deploy the Kie Server, but I'm just in the evaluation stage.
Created a simple rules project, with a single Data object and rule (copied directly from a successful deployment using Workbench with modified package name to prevent possible conflict) and with my settings.xml with the correct credentials and the following pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>rules</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>kjar</packaging>
<properties>
<kie.version>7.50.0.Final</kie.version>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
<distributionManagement>
<repository>
<id>guvnor-m2-repo</id>
<name>JBPM Workbench Repo</name>
<url>http://localhost:8080/business-central/maven2/</url>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-model-compiler</artifactId>
<version>${kie.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${kie.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<version>${kie.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
Built the project using mvn clean package deploy -
The project gets built without error and apparently accepted by the service successfully. I can see the jar in the Docker instance, under /opt/jboss/wildfly/bin/repositories/kie/global/com/example/rules/1.0.0-SNAPSHOT
Tried to create the container using the http://localhost:8080/kie-server/services/rest/server/containers/test PUT API (with correct credentials) but got the following error
{
"type": "FAILURE",
"msg": "Failed to create container test with module com.example:rules:1.0.0-SNAPSHOT: java.lang.RuntimeException: Cannot find KieModule: com.example:rules:1.0.0-SNAPSHOT",
"result": null
}
Tried to create a deployment unit in Workbench. I can see the package in the list and can select it, but the first time I do, I get the following error (it's barely visible in a single line text box - I've formatted it for clarity. This is a selection of a few lines out about 600)
{"ToSubject":"org.kie.workbench.common.screens.server.management.service.DeploymentDescriptorService:RPC","CommandType":"getProcessConfig:java.lang.String:","Qualifiers":{"^EncodedType":"java.util.ArrayList","^ObjectID":"1","^Value":[]},"ReplyTo":"org.kie.workbench.common.screens.server.management.service.DeploymentDescriptorService:RPC.getProcessConfig:java.lang.String::41:RespondTo:RPC","ErrorTo":"org.kie.workbench.common.screens.server.management.service.DeploymentDescriptorService:RPC.getProcessConfig:java.lang.String::41:Errors:RPC","AdditionalDetails":"<tt>
org.jboss.errai.bus.client.api.base.MessageDeliveryFailure: error invoking RPC endpoint public abstract org.kie.workbench.common.screens.server.management.model.ProcessConfigModule org.kie.workbench.common.screens.server.management.service.DeploymentDescriptorService.getProcessConfig(java.lang.String) throws java.io.IOException
at deployment.business-central.war/org.jboss.errai.bus.server.io.AbstractRPCMethodCallback.invokeMethodFromMessage(AbstractRPCMethodCallback.java:75)
at deployment.business-central.war/org.jboss.errai.bus.server.io.ValueReplyRPCEndpointCallback.callback(ValueReplyRPCEndpointCallback.java:40)
at deployment.business-central.war/org.jboss.errai.bus.server.io.RemoteServiceCallback.callback(RemoteServiceCallback.java:54)
at deployment.business-central.war/org.jboss.errai.cdi.server.CDIExtensionPoints$2.callback(CDIExtensionPoints.java:448)
at deployment.business-central.war/org.jboss.errai.bus.server.DeliveryPlan.deliver(DeliveryPlan.java:47)
at deployment.business-central.war/org.jboss.errai.bus.server.ServerMessageBusImpl.sendGlobal(ServerMessageBusImpl.java:297)
...
Caused by: java.lang.NullPointerException: <No Message>
at deployment.business-central.war/org.apache.commons.io.IOUtils.toInputStream(IOUtils.java:1647)
at deployment.business-central.war/org.kie.workbench.common.screens.server.management.backend.service.DeploymentDescriptorServiceCDI.getProcessConfig(DeploymentDescriptorServiceCDI.java:56)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.jboss.weld.core#3.1.3.Final/org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:38)
at org.jboss.weld.core#3.1.3.Final/org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:106)
at deployment.business-central.war/org.kie.workbench.common.screens.server.management.service.DeploymentDescriptorService$1790586371$Proxy$_$$_WeldClientProxy.getProcessConfig(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
On selecting and trying to finish the deployment subsequently, I no longer get the above error but this time get the message GAV 'com.example:rules:1.0.0-SNAPSHOT' not found in the Maven repository. Are you sure you want to deploy it? with the following stack trace in the logs
17:54:30,873 WARN [org.appformer.maven.integration.MavenRepository] (default task-16) Unable to resolve artifact: com.example:rules:pom:1.0.0-SNAPSHOT
17:54:31,177 WARN [org.appformer.maven.integration.MavenRepository] (default task-16) Unable to resolve artifact: com.example:rules:1.0.0-SNAPSHOT
17:54:31,358 WARN [org.appformer.maven.integration.MavenRepository] (default task-16) Unable to resolve artifact: com.example:rules:pom:1.0.0-SNAPSHOT
17:54:31,360 ERROR [org.kie.server.services.impl.KieServerImpl] (default task-16) Error creating container 'baz' for module 'com.example:rules:1.0.0-SNAPSHOT': java.lang.RuntimeException: Cannot find KieModule: com.example:rules:1.0.0-SNAPSHOT
at deployment.kie-server.war//org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:190)
at deployment.kie-server.war//org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:180)
at deployment.kie-server.war//org.kie.server.services.impl.KieServerImpl.createInternalKieContainer(KieServerImpl.java:373)
at deployment.kie-server.war//org.kie.server.services.impl.KieServerImpl.createContainer(KieServerImpl.java:286)
at deployment.kie-server.war//org.kie.server.remote.rest.common.resource.KieServerRestImpl.createContainer(KieServerRestImpl.java:155)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
So it looks like I've followed all the steps (that I know about) correctly - the jar is built, it's deployed to the /opt/jboss/wildfly/bin/repositories/kie/global/ directory, it's visible in Workbench. But it's not deployable as a container in KieServer. Does anyone have any hints on what I've done wrong?
I found an error in my project. I accidentally copied maven/pom.properties from another project into my META-INF directory, that had a different groupId and artifactId from the jar I was building. This caused the server to deploy the jar into the wrong /opt/jboss/.m2/repository location, so getting GAV 'com.example:rules:1.0.0-SNAPSHOT' not found in the Maven repository. Are you sure you want to deploy it?

I don't want to refer server side jars for my project, My primefaces+spring project has to use the jars that i added to lib folder

I'm working on Primefaces + Spring project.Recently we migrated the project from JSF 1.2 to 2.2 Version.Previously our project was using jsf Implementation and API jars from Project's lib folder but now it's using the jars located in,
**\wildfly-10.0.0.Final\modules\system\layers\base\com\sun\jsf-impl\main**
**\wildfly-10.0.0.Final\modules\system\layers\base\javax\faces\api\main**
and it is throwing Services which failed to start error while deploying on wildfly 10.x,
JBAS014777: Services which failed to start: service jboss.deployment.unit."abc.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."abc.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "abc.war"
How can configure my project to use lib jars.Which will helps in deployment.
Some dependencies are added implicitly by Wildfly 10. You can find a list of them here.
For the web subsystem these are:
javaee.api
com.sun.jsf-impl
org.hibernate.validator
org.jboss.as.web
org.jboss.logging
If you don't want one of them, like in your case com.sun.jsf-impl, you can exclude them using a jboss-deployment-structure.xml file as explained here.
In your case it might look like this:
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="com.sun.jsf-impl" />
</exclusions>
</deployment>
</jboss-deployment-structure>
Probably you may need more exclusions, but the principle should be clear.

Error in Referencing a Dependency Jar File from JBoss 7.1

I reference a jar file from JBoss 7.1 module according to the instructions provided in a stackoverflow question here. I have used this jar in JBoss 5.x, 6.x without any issue. However, when I try to deploy a war file in JBoss 7.1 which references the above jar, it gives me the following error:
15:59:19,220 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host]. [/Max_client]] (MSC service thread 1-2) StandardWrapper.Throwable: java.lang
NoClassDefFoundError: org/xml/sax/SAXException
at com.systinet.wasp.webservice.ServiceClientImpl.lookup(ServiceClientImpl.java:556) [wasp.jar:]
at com.systinet.wasp.webservice.ServiceClientImpl.createProxy(ServiceClientImpl.java:437) [wasp.jar:]
at org.systinet.wasp.webservice.Registry.lookup(Registry.java:168) [wasp.jar:]
at MyServlet.init(MyServlet.java:103) at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Fi
al]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_35]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_35]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_35]
Caused by: java.lang.ClassNotFoundException: org.xml.sax.SAXException from [Module "commons.wasp:main" from local module loader #2adb1d4 (roots: c:\jboss-as-7.1.1
Final\modules)]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
... 15 more
I'm very new to this new module concept in JBoss 7. Any idea what is the issue here?
Thank you!
Details on what I tried to do:
I want to be able to make this dependency jar available globally. So what I did was created a folder structure modules/common_libs/test/main and placed the required jar in it. Then created the module descriptor module.xml:
<module xmlns="urn:jboss:module:1.1" name="common_libs.test">
<resources>
<resource-root path="test.jar"/>
</resources>
</module>
Then in the application from which I need to access this jar, I added in the MANIFEST.MF:
Dependencies: common_libs.test
The application is a war file and I deployed it under the deployment folder, and created a .war.dodeploy file. I get this exception when I start the JBoss server.
Any idea, anyone?
Thanks!
You need to look at the dependencies your module requires. With the current error message it looks like it needs a dependency on SAX. You should probably add a dependency for javax.api (this is the module SAX is in) to your module.xml.
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="common_libs.test">
<resources>
<resource-root path="test.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
You'll need to add dependencies for any dependencies your shared library needs.
In your module.xml add a dependency on javax.api and it should work.
As you mentioned you are new to this module concept. So little explanation for what are we doing.
with JBoss AS7x archietecture, we use modules to provide jars/ classes to our application. One +ve of this is that it lightens the war.
We create modules for our jars, module.xml is a descriptor that acts as an ID/bio of the module , tells the server about what is in it <resources> tag
and what this module is dependent on
<dependencies> tag
For mostly all our module we add a dependency on javax.api so the module couldcompile. Why? Cant remember look out for it. And add as comment when you know it.
Hope this helps:-)

ClassNotFoundException while dynamic class loading in JBoss 7.1.1 from OSGi-bundle

I deployed a simple OSGi test-bundle into JBoss 7.1.1 and try to dynamically instantiate the Jacorb ORB by doing
Class clazz = Class.forName("org.jacorb.orb.ORB");
All I got is
java.lang.ClassNotFoundException: org.jacorb.orb.ORB from [Module "deployment.test:1.0.0" from Service Module Loader]
What I already did:
in the JBoss configuration standalone.xml I added for the osgi-subsystem the capability <capability name="org.jacorb" startlevel="1"/>, so that the org.jacorb module is loaded. That already solved the problem, that the installation of my test bundle fails.
I declared the Dependencies-Descriptor on org.jacorb in my MANIFEST.MF (also tried with and without the export option): Dependencies: org.jacorb export
I added the jboss-deployment-structure.xml to my META-INF with the following content
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.jacorb" />
</dependencies>
</deployment>
</jboss-deployment-structure>
Also I did experiments with the ClassLoaders and realized, that the ContextClassLoader is null. But in the end, I cannot effect this as the non-test-code, because the Class.forName() cannot be changed to use a specific classloader.
So why do I get this ClassNotFoundException?
Thanks in advance
Alex
After hours of digging I did the puzzle ;-)
In standalone.xml/domain.xml JBoss configuration I added <capability name="org.jacorb" startlevel="1"/> in the <subsystem xmlns="urn:jboss:domain:osgi:1.2" activation="lazy"> section under <capabilities>
In the META-INF/MANIFEST.MF I added DynamicImport-Package: org.jacorb.orb to allow the classloader to dynamically extend the classpath during runtime
Set the context classloader by Thread.currentThread().setContextClassLoader(getClass().getClassLoader() that has been null before
If you have a normal OSGi bundle and it should see the org.jacorb.orb.ORB class,
then you should have:
1. ALL org.jacorb packages and subpackages have to be exported in the osgi framework.
2. Your bundle has to import ALL of the packages you use - e.g. with
"Import-Package:org.jacorb.orb"
Check that the versions are compatible.
Check that you import all packages and subpackages. Import of org.jacorb doesn't imply org.jacorb.orb.
If both conditions are satisfied, then the Bundle Classloader of your bundle should be able to see org.jacorb.orb.ORB.

Error listenerStart - JaxWS - JBoss as 7

I'm trying to migrate a Jax-WS based web service to JBoss as 7 but the application (deployed as a war) failes to start the listener on start-up.
ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-14) Error listenerStart
ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-14) Context [/abc] startup failed due to previous errors
ERROR [org.jboss.msc.service.fail] (MSC service thread 1-14) MSC000001: Failed to start service jboss.web.deployment.default-host (...)
The error message references to failed due to previous errors however no errors are printed in the log. The application in question bundles jax-ws-rt like this:
<dependency>
<groupId>sun-jaxws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.1.7</version>
</dependency>
If I change the scope of the jax-ws-rt to be provided this causes a nice ClassNotFound as expected.
WARN [org.jboss.as.ee] (MSC service thread 1-13) JBAS011006: Not installing optional component com.sun.xml.ws.transport.http.servlet.WSServletContextListener due to exception: java.lang.ClassNotFoundException: com.sun.xml.ws.transport.http.servlet.WSServletContextListener (…)
The servlet is defined like this in the web.xml.
<listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>
<servlet>
<description>JAX-WS endpoint for data service</description>
<display-name>abc</display-name>
<servlet-name>abc</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>abc</servlet-name>
<url-pattern>/services/abc</url-pattern>
</servlet-mapping>
I cant understand whats wrong. How do I solve this and get the application deployed?
Thoughts:
Am I missing a dependency?
Can I reconfigure the war to use Jboss internal JaxWS without major refactoring?
If I cant use a jboss internal JaxWS version can I force Jboss to use a version of Jaxws that I bundle in the war? (If so, what dependencies do I need for JaxWs?)
with JBoss AS7 (Java EE6) you actually shouldn't need to put the WSServlet in the web.xml as the servlet-class. But instead you would have there the class name of the class annotated with #Webservice
All you want to do is make sure that in you JBoss configuration (e.g. standalone.xml) you have extension for webservices enabled:
<extensions>
[...]
<extension module="org.jboss.as.webservices"/>
</extensions>