Errors when deploying kjar to jBPM/KieServer - jboss

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?

Related

No Jar found in /WEB-INF/lib after deploying maven project from eclipse to wildlfy9

I am seeing a very strange behavior of wildfly9.x. Build process goes successful. after clicking on RUN AS -> Run on Server(WildFly9.x). It shows exception like NO class def found.
I have already added dependency in POM.xml and its scope is compile.
POM.xml file:
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.6</version>
<scope>compile</scope>
</dependency>
Exception:
Caused by: java.lang.ClassNotFoundException: org.apache.commons.codec.binary.Base64 from [Module "deployment.worldportfolio.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)
Thanks in advance.
I solved it by myself. If you want to run wildfly server from eclipse IDE so you should follow this a very simple method create lib folder in WEB-INF and place all the required Jars in the lib folder. You are done.

Wildfly 8.2 fails to load jbossws-cxf-client module

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...

JNA class not Found Error using FANNJ for Ubuntu in Eclipse

I'm trying to use FANNJ in Eclipse (on Ubuntu), trying to create a toy program but it keeps giving this error as shown below.
Code:
package myPackage;
import com.googlecode.fannj.Fann;
public class mainclass {
public static void man(String[] args) {
System.out.println("1");
Fann fann = new Fann("/home/sahil/Desktop/Intern/Java/eclipse/Workspace/UsingFANN/ANN_Net_Output1.net");
}
}
Error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jna/Platform
at com.googlecode.fannj.Fann.<clinit>(Fann.java:51)
at myPackage.mainclass.main(mainclass.java:9)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.Platform
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
Could someone who works with FANNJ on Ubuntu please explain why this error comes up?
Make sure you set the jna.library.path system property to the path to the FANN Library. This property is similar to java.library.path but only applies to libraries loaded by JNA.
You should also change the appropriate library access environment variable before launching the VM. (LD_LIBRARY_PATH on Linux)
From the command line:
LD_LIBRARY_PATH=/usr/local/lib
java -Djna.library.path=/usr/local/lib -cp fannj-0.6.jar:jna-3.2.2.jar YourClass
You have to download the missing library "jna". After get it you must point it in eclipse (Using the properties of your project > Java Build Path > Libraries, and adding the jar (you can browse it on "Add External JARs...").
A good way to get all dependancies for a project is by "maven". You can simply create a "pom.xml" file on root folder of your project. So write it down:
<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.something</groupId>
<artifactId>MyProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>MyProject</name>
<description>MyProject</description>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.googlecode.fannj/fannj -->
<dependency>
<groupId>com.googlecode.fannj</groupId>
<artifactId>fannj</artifactId>
<version>0.6</version>
</dependency>
</dependencies>
</project>
And finally, on commmand line type # mvn install, it will download the dependancies and by default put all libraries in your "homefolder/.m2". So, browse for JNA library, you gonna find it in some folder like this: "~/.m2/repository/net/java/dev/jna/jna/3.2.7". If your project uses other libraries besides fannj, you can add it in pom file to get everything together.

Performing substitutions in Eclipse product configuration file with tycho

I have a Eclipse RCP product which I build with Tycho. After some smaller issues, this is working pretty fine and I have both CI and releases as wanted.
The product in question is provided both as an installable stand-alone RCP application and as an update site so the functionality can be installed in a vanilla Eclipse installation. This works fine as well.
The product have a main feature - which is used on the update site - and I would very much like the feature and the product to have the same version number. As it is today, this version number is mentioned is many places and I would really like to reduce this to just one. I currently have the version number in
the feature.xml of the main feature
the pom.xml of the same feature
the .product file for the product configuration file
the pom.xml of the project with the .product file
the categories.xml file of the update site
the about.mappings file
I have tried to use maven resource filters and that works for the POM files and about.mappings, but not for the rest. This is my current pom.xml for the main feature:
<?xml version="1.0" encoding="UTF-8"?>
<project ...>
<modelVersion>4.0.0</modelVersion>
<artifactId>...main.feature</artifactId>
<version>${product.version}-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<parent>
<groupId>...</groupId>
<artifactId>...parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../...parent</relativePath>
</parent>
<build>
<!-- Substitutions: product.version -->
<resources>
<resource>
<directory>.</directory>
<includes>
<include>feature.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
When running this configuration, I get the following exception from Tycho (or an exception that looks very similar to it):
[ERROR] Internal error: java.lang.IllegalArgumentException -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.IllegalArgumentException
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:168)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
Caused by: java.lang.IllegalArgumentException
at org.eclipse.equinox.internal.p2.metadata.VersionParser.parse(VersionParser.java:93)
at org.eclipse.equinox.p2.metadata.Version.create(Version.java:79)
at org.eclipse.tycho.p2.impl.publisher.FeatureDependenciesAction.getVersion(FeatureDependenciesAction.java:126)
at org.eclipse.tycho.p2.impl.publisher.AbstractDependenciesAction.perform(AbstractDependenciesAction.java:79)
... 11 more
(I have cut some lines...)
Basically, the embedded maven process seems to not perform the resource filtering at all for this type of packaging. Or??
I have tried many different things, but I cannot get it to work. My best guess is that I have to configure the lifecycle, but how...
Can anybody help me with this?
this is a known bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=362252
You don't need to specify versions explicitly in the categories.xml. Just specify 0.0.0 as version, and Tycho will replace it by the actual version of the included feature.

javax/validation/Path GWT Java Maven converstion

I am using GWT in my project., recently I tried converting a manual compilation of GWT + Java + tomcat to a maven project., almost I am able successfully package it to a war., BUt when I deployed on tomcat I got followin error:
EVERE: Exception while dispatching incoming RPC call
java.lang.NoClassDefFoundError: javax/validation/Path
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2818)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.google.gwt.user.server.rpc.SerializationPolicyLoader.loadFromStream(SerializationPolicyLoader.java:196)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.loadSerializationPolicy(RemoteServiceServlet.java:90)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.doGetSerializationPolicy(RemoteServiceServlet.java:293)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.getSerializationPolicy(RemoteServiceServlet.java:157)
at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.prepareToRead(ServerSerializationStreamReader.java:455)
Here is what i added for my added in my pom.xml:
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
as dependencies.
Kindly help me.
What I need to add more to resolve the issue?
It is the dependency scope that is causing the problem. compile is actually the default scope so this could be omitted from the first dependency if you want.
The problem is in the second artifact which is declared as provided. This means that the application is expecting the web container to provide that library/classes. It looks like it is not providing the required classes, which results in the NoClassDefFoundError.
Removing the <scope>provided</scope>, will instruct Maven to package that library with the application and Tomcat should be able to get past that error.
There are no compile-time errors since the gwt-user is available at compile time. It is simply not available at run-time for Tomcat.