Failure to deploy from workbench to kie-server - drools

I attempted to create a new project in kie-workbench (6.2.0.Final) and deploy it to the remote kie-server (6.2.0.Final). I create the container via the workbench then hit the "start" button for the container. When I hit start, a red error icon appears next to the server and the container.
When I go to the URL specified in the Container Info side panel, (http://192.168.1.11:8080/kie-server-6.2.0.Final-webc/services/rest/server/containers/test
) I get the following response XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="Info for container test">
<kie-container container-id="test" status="FAILED">
<scanner status="DISPOSED"/>
</kie-container>
</response>
Is there a log file I can go to get more information? I am running kie-server and kie-workbench on Tomcat 7.

Maybe 'TOMCAT_HOME\logs\catalina.log' is what you're looking for? If you also want to see the log in terminal, you can modify 'TOMCAT_HOME\logs\startup.sh'. That is, changing
exec "$PRGDIR"/"$EXECUTABLE" start "$#"
into
exec "$PRGDIR"/"$EXECUTABLE" run "$#"
Though I can make some containers start up correctly, I'm still facing some problems, see this.
For your reference, I can see the following response on the link you provide when container started up correctly:
<response type="SUCCESS" msg="List of created containers">
<kie-containers>
<kie-container container-id="droolsTest" status="STARTED">
<release-id>
<artifact-id>droolsTestProj</artifact-id>
<group-id>demo</group-id>
<version>2.0</version>
</release-id>
<resolved-release-id>
<artifact-id>droolsTestProj</artifact-id>
<group-id>demo</group-id>
<version>2.0</version>
</resolved-release-id>
<scanner status="DISPOSED"/>
</kie-container>
</kie-containers>
</response>

Related

Unable to register Kie Server with Kie Workbench

"I'm setting up Kie Workbench 7.5 and Kie Server 7.5 both into tomcat 8.
But "Remote Servers" is showing blank list.
For installation reference I used http://blog.athico.com/2015/10/installing-kie-server-and-workbench-on.html this blog.
Once I hit http://localhost:8080/kie-server/services/rest/server this URL I am getting expected output as below:
<response type="SUCCESS" msg="Kie Server info">
<kie-server-info>
<capabilities>KieServer</capabilities>
<capabilities>BRM</capabilities>
<capabilities>BPM</capabilities>
<capabilities>CaseMgmt</capabilities>
<capabilities>BPM-UI</capabilities>
<capabilities>BRP</capabilities>
<capabilities>DMN</capabilities>
<capabilities>Swagger</capabilities>
<location>
http://localhost:8080/kie-server/services/rest/server
</location>
<name>tomcat-kieserver</name>
<id>tomcat-kieserver</id>
<version>7.5.0.Final</version>
</kie-server-info>
</response>
Configuration which I proviced
1. setenv.bat
set CATALINA_OPTS=-Xmx512M -Djbpm.tsr.jndi.lookup=java:comp/env/TransactionSynchronizationRegistry -Dorg.kie.server.persistence.ds=java:comp/env/jdbc/jbpm -Djbpm.tm.jndi.lookup=java:comp/env/TransactionManager -Dorg.kie.server.persistence.tm=JBossTS -Dhibernate.connection.release_mode=after_transaction -Dorg.kie.server.id=tomcat-kieserver -Djava.security.auth.login.config=C:/softwares/apache-tomcat-8.5.43/webapps/kie-drools-wb/WEB-INF/classes/login.config -Dorg.kie.server.location=http://localhost:8080/kie-server/services/rest/server -Dorg.kie.server.controller=http://localhost:8080/kie-drools-wb/rest/controller -Dcom.arjuna.ats.jta.recovery.XAResourceRecovery1=com.arjuna.ats.internal.jdbc.recovery.BasicXARecovery;abs://C:/softwares/apache-tomcat-8.5.43/conf/xa-recovery-properties.xml
2. server.xml
<Valve className="org.kie.integration.tomcat.JACCValve" />
3. context.xml
<Resource name="sharedDataSource"
auth="Container"
type="org.h2.jdbcx.JdbcDataSource"
user="sa"
password="sa"
url="jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;MVCC=TRUE"
description="H2 Data Source"
loginTimeout="0"
testOnBorrow="false"
factory="org.h2.jdbcx.JdbcDataSourceFactory"/>
4. xa-recovery-properties.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<entry key="DB_1_DatabaseUser">sa</entry>
<entry key="DB_1_DatabasePassword">sa</entry>
<entry key="DB_1_DatabaseDynamicClass"></entry>
<entry key="DB_1_DatabaseURL">java:comp/env/h2DataSource</entry>
</properties>
On Tomcat console I am getting below warning:
WARNING [KieServer-ControllerConnect] org.kie.server.services.impl.controller.DefaultRestControllerImpl.connectToSingleController Exception encountered while syncing with controller at http://localhost:8080/kie-drools-wb/rest/controller/server/tomcat-kieserver error Error while sending PUT request to http://localhost:8080/kie-drools-wb/rest/controller/server/tomcat-kieserver response code 401
Workbench 7.0+ is not support Tomcat any more. If you want to use Workbench (it is already renamed to Business Central and has latest version 7.24) it should run on Wildfly 14.
You can try this quick start (just unzip file and it is ready to try or copy configurations): https://www.jbpm.org/learn/gettingStarted.html
If you need to start Workbench on Tomcat, you should use 6.x (which is not supported any more).

WebLogic 12c not obeying "prefer-web-inf-classes" or "prefer-application-packages" during deployment

I am having a very strange problem with WebLogic 12.1.3.0.0. I have an application that causes a NullPointerException inside the AdminServer during deployment, yet the application runs fine after the error.
The NullPointerException during deployment happens because the deployment process is not respecting the following settings in my deployment descriptors:
AppName.war/WEB-INF/weblogic.xml:
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app>
<context-root>AppName</context-root>
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
And AppName.ear/META-INF/weblogic-application.xml:
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application>
<prefer-application-packages>
<package-name>javax.faces.*</package-name>
</prefer-application-packages>
</weblogic-application>
Since these settings are ignored, javax.faces.webapp.FacesServlet class is loaded by the System Classloader (sun.misc.Launcher$AppClassLoader), from $WL_HOME/wlserver/modules/glassfish.jsf_2.0.0.0_2-1-20.jar, not from the WAR classloader. This eventually leads to the NPE due to some poorly written code in weblogic.servlet.internal.WebAnnotationProcessor, which assumes that javax.faces.webapp.FacesServlet will be annotated with #MultipartConfig, which it is not in glassfish.jsf_2.0.0.0_2-1-20.jar. The correct version of this class is located in AppName.ear/AppName.war/WEB-INF/lib/jsf-api-2.2.16.jar.
I have verified all of this by remote debugging the AdminServer, and by turning on Classloader Logging, which shows this:
GCL[61ba0535][AppName.ear#AppName.war] GCL.loadClass(javax.faces.webapp.FacesServlet)>
FCL[10d372cb][] FCL.loadClass(javax.faces.webapp.FacesServlet)>
FCL[10d372cb][] FCL.findClass(javax.faces.webapp.FacesServlet)>
GCL[75bc8d74][DomainLib] GCL.loadClass(javax.faces.webapp.FacesServlet)>
This issue makes it impossible to open the AppName Deployment in the Admin Console, b/c it always throw the error (with the aforementioned NPE in the logs):
The configuration for AppName is still being loaded from your last request, please wait a moment and retry.
In contrast to this, when I run the EAR in the server where it was deployed, exactly the same EAR works just fine. To prove that classloading is working properly, here's the log:
CACL[6eb4b4ad][AppName#AppName] CACL.loadClass(javax.faces.webapp.FacesServlet)>
CACL[6eb4b4ad][AppName#AppName] GCL.loadClass(javax.faces.webapp.FacesServlet)>
FCL[37ee3b94][AppName#AppName] FCL.loadClass(javax.faces.webapp.FacesServlet)>
FCL[37ee3b94][AppName#AppName] FCL.findClass(javax.faces.webapp.FacesServlet)>
GCL[3cc63f62][AppName#] GCL.loadClass(javax.faces.webapp.FacesServlet)>
FCL[770e8d03][] FCL.loadClass(javax.faces.webapp.FacesServlet)>
FCL[770e8d03][] FCL.findClass(javax.faces.webapp.FacesServlet)>
FCL[770e8d03][] FCL.matchesClassFilterList(javax.faces.webapp.FacesServlet): javax.faces. index : 0 end : 12>
FCL[770e8d03][] FCL.findClass(javax.faces.webapp.FacesServlet): Found match>
GCL[3cc63f62][AppName#] GCL.findClass(javax.faces.webapp.FacesServlet)>
GCL[3cc63f62][AppName#] GCL.findLocalClass(javax.faces.webapp.FacesServlet): Classpath in use: <LIST OF ALL JARS IN MY EAR>
GCL[3cc63f62][AppName#] GCL.findLocalClass(javax.faces.webapp.FacesServlet): not found>
CACL[6eb4b4ad][AppName#AppName] CACL.findClass(javax.faces.webapp.FacesServlet)>
CACL[6eb4b4ad][AppName#AppName] CACL.findClass(javax.faces.webapp.FacesServlet): About to loadClass>
CACL[6eb4b4ad][AppName#AppName] GCL.findClass(javax.faces.webapp.FacesServlet)>
CACL[6eb4b4ad][AppName#AppName] GCL.findLocalClass(javax.faces.webapp.FacesServlet): Classpath in use: <LIST OF ALL JARS IN MY WAR>
CACL[6eb4b4ad][AppName#AppName] GCL.findLocalClass(javax.faces.webapp.FacesServlet): Found class>
CACL[6eb4b4ad][AppName#AppName] GCL.defineClass(javax.faces.webapp.FacesServlet)>
I don't know how to fix this... Why is the AdminServer completely ignoring the deployment descriptors in my EAR, while the server that runs the EAR sets everything up properly?
Any ideas would be appreciated.

KIE-Server Container Stuck at CREATING Status

I am running the kie-server-showcase docker image and attempting to run a very simple rule on it.
I start the container as so:
docker run -i -p 8080:8080 --name kie-server --mount type=bind,source=$HOME/.m2,target=/opt/jboss/.m2 jboss/kie-server-showcase:latest
I need to use a bind mount as I'm just using my local .m2 maven repository (for now) and this was the only way I could see to get the container to get a copy of it.
I have built a kjar in Eclipse via "maven clean" followed by "maven install".
Inside the kjar (.jar) I have:
META-INF which contains kmodule.xml and MANIFEST.MF, also a maven subfolder which has the group-id followed by artifact-id in subfolders, i.e. META-INF > maven > group > artifact. The artifact folder contains the pom and pom.properties (which then defines the GAV).
my drl and bpmn
To create the container on the kie-server I use a curl command:
curl -u 'admin:admin' -H "accept: application/xml" -H "content-type: application/xml" -d #myContainer.xml -X PUT http://localhost:8080/kie-server/services/rest/server/containers/MyContainer
It then begins running the command but the time spent continues to tick on and was still going after I had left it for 30 minutes.
I checked the kie-server containers and the one I have added is there but the status is CREATING:
<response type="SUCCESS" msg="List of created containers">
<kie-containers>
<kie-container container-id="MyContainer" status="CREATING">
<release-id>
<artifact-id>hummingbird.rules.syndicated-kjar</artifact-id>
<group-id>uk.co.cdl.hummingbird</group-id>
<version>0.0.1-SNAPSHOT</version>
</release-id>
<scanner status="DISPOSED"/>
</kie-container>
</kie-containers>
</response>
I'm not very experienced with docker or using the kie-server, and in the past have not used kjars but had a custom rules engine that has loaded the drl and bpmn individually.
I believe it may be down to my kjar not being correct in some way. The docker container seems to see the kjar in the local maven repo mount (as I was previously getting errors that it couldn't find it).
The drl in the kjar is very simple:
package somerules
import org.json.JSONObject
import java.util.Map
rule "somerules - do something" ruleflow-group "somerules"
dialect "java"
when
$root : Map()
then
insert(new JSONObject());
delete($root);
end
And the bpmn should not be an issue (it is the same one used previously with our custom rulesengine):
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="Definition"
targetNamespace="http://www.jboss.org/drools"
typeLanguage="http://www.java.com/javaTypes"
expressionLanguage="http://www.mvel.org/2.0"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
xmlns:g="http://www.jboss.org/drools/flow/gpd"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:tns="http://www.jboss.org/drools">
<process processType="Private" isExecutable="true" id="somerules" name="somerules" tns:packageName="somerules" >
<!-- nodes -->
<startEvent id="_1" isInterrupting="true"/>
<endEvent id="_jbpm-unique-0" name="End" >
<terminateEventDefinition />
</endEvent>
<businessRuleTask id="_jbpm-unique-2" name="somerules" g:ruleFlowGroup="somerules" >
<ioSpecification>
<inputSet>
</inputSet>
<outputSet>
</outputSet>
</ioSpecification>
</businessRuleTask>
<!-- connections -->
<sequenceFlow id="_jbpm-unique-2-_jbpm-unique-0" sourceRef="_jbpm-unique-2" targetRef="_jbpm-unique-0" />
<sequenceFlow id="_1-_jbpm-unique-2" sourceRef="_1" targetRef="_jbpm-unique-2" />
</process>
<bpmndi:BPMNDiagram>
...
</bpmndi:BPMNDiagram>
</definitions>
I am building the kjar with drools 7.23.0.Final. I previously tried 7.22 as well.
Any advice appreciated, thanks.
I found out what the issue was, mainly by following advice given and trying to run the kie-server without Docker.
I got a lot of error messages (which were not visible to me in Docker) regarding dependencies and errors along the lines of "class X and class Y disagree on Z attribute".
This was because my kjar pom had dependencies already provided in the kie-server and there seemed to be conflicts. It was all the drools dependencies. By setting the scope to "provided" in the kjar pom for these dependencies, the issue was resolved and I could create the container (both in Docker and non-Docker kie-servers).

JBoss EAP 6 configure single server for remote debugging in domain mode

I have Domain controller, one Host controller and one server running in the same machine.
I'm using IDEA to connect to the remote server for debugging but it's not stopping on break points even though it's running the code (i've verified with system outs).
I've enabled HOST_CONTROLLER_JAVA_OPTS and PROCESS_CONTROLLER_JAVA_OPTS for remote debugging in $JBOSS_HOME/bin/domain.conf:
# Sample JPDA settings for remote socket debuging.
PROCESS_CONTROLLER_JAVA_OPTS="$PROCESS_CONTROLLER_JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8788,server=y,suspend=n"
HOST_CONTROLLER_JAVA_OPTS="$HOST_CONTROLLER_JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
When i start JBoss server i can see from netstat that it's properly listening to ports 8787 and 8788. If i list the processes running in the system i can see one for Domain controller, one for Host controller and one for the server (server1). Domain and Host controllers have the debug options specified in their launch properties but they're missing for server1.
I've been looking at the various XML, .conf and .sh files for a while now but i can't figure out how i could specify server1 to use the remote debugging options. Is there a way to remotely debug a single server in domain mode?
JHollanti maybe you are missing some compiler flags (like "lines,vars,source") to allow remote debugging.
For example, is you are using Ant you need to add this lines to your javac:
<!-- Javac lines, vars, source compiler flags -->
<javac srcdir="..." destdir="..." classpathref="..." debug="true" debuglevel="lines,vars,source" />
Then in your execution script you jave to add:
<!-- debug configurations: modify the port you want-->
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4060"/>
On the other hand, if you are using Maven same flags can be added in the , like this:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<!-- Necessary in order for the debug levels to be considered-->
<debug>true</debug>
<debugLevel>lines,vars,source</debugLevel>
</configuration>
</plugin>
</plugins>
</build>
In case of using Jetty, same as before... you need to have the following variable:
export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n"
On the other hand, what you can check is setting the suspend flag in yes, it is "suspend=y". This won't start your app unless you connect a debugger.
Here you can check specific info about jboss:
http://webdev.apl.jhu.edu/~jcs/ejava-javaee/coursedocs/605-784-site/docs/content/html/devenv-jboss-setup.html#enable-jboss-debug
Hope to help
Hey I don't have a solution to this however I was able to set the port for server one along with host and process controllers as well.
How I did it : I added the "-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n" to the JVM arguments on the jboss admin console.
Steps:
1) Login to admin console of jboss => localhost:9990/console
2) go to servers => select server 1 in the table.
3) Then add the debug string into JVM arguments text box.
Once you restart your server you'll see now the server one is listening on this port.
However problem came when I tried to run my eclipse in debug mode. Though on the sever I could see the connection was established through netstat however eclipse is not able to communicate to server 1 and it times out.
Important thing to be noticed is I'm able to run eclipse in debug mode if I do what you did in domain.conf file and use those ports; however then the control never comes to my breakpoint in eclipse.
You can enable remote debugging by adding jvm-options in $JBOSS_HOME$\domain\configuration\hosts.xml
Add the following configuration under <servers> -> <server> -> <jvm>
<jvm-options>
<option value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"/>
</jvm-options>
your server configuration in hosts.xml should look something similar to this
<servers>
<server name="Server1" group="Group1" auto-start="true">
<jvm name="Server1_JVM" debug-enabled="false">
<heap size="2048m" max-size="4096m"/>
<jvm-options>
<option value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"/>
</jvm-options>
</jvm>
<socket-bindings socket-binding-group="full-ha-sockets" port-offset="100"/>
</server>
</servers>
Hope this helps!

java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory

I have actually figured this problem out, but it took me days, so I thought I would paste my solution here to aide others.
I am using Fedora 11, and in Eclipse I tried adding a Tomcat 6 server and starting it. I would get the following error:
'Starting Tomcat v6.0 Server at localhost' has encountered a problem.
Server Tomcat v6.0 Server at localhost failed to start.
Then in my console I got the following:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:54)
Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
... 1 more
Could not find the main class: org.apache.catalina.startup.Bootstrap. Program will exit.
I'll post the solution in an answer below.
I found the solution here: http://forums.opensuse.org/applications/391114-tomcat6-eclipse-not-working.html
In Eclipse, Open the "Server" tab.
Double click on the "Tomcat6" entry to see the configuration.
Then click on the "Open launch configuration" link in the "General information" block.
In the dialog, select the "Classpath" tab.
Click the "Add external jar" button.
Select the file "/usr/share/tomcat6/bin/tomcat-juli.jar"
Close the dialog.
Start tomcat 6 from Eclipse.
Hopefully posting it here will help some poor soul.
I copied the contents of the "C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf" directory to the "workspace\Servers\Tomcat v6.0 Server at localhost-config" directory for Eclipse. I refreshed the "Servers\Tomcat v6.0 Server at localhost-config" folder in the Eclipse Project Explorer and then everything was good.
install tomcat
# yum install tomcat6*
edit tomcat conf file
# vim /etc/tomcat6/tomcat-users.xml
something like:
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
<user username="TomcatAdmin" password="tomcat" roles="admin,manager"/>
</tomcat-users>
create root directory for your J2EE project, example:
$ mkdir -p ~/Project/java/
do symbolic link, /usr/share/tomcat6/webapps/ to ~/Project/java/
# ln -s /home//Project/java//dist/.war /usr/share/tomcat6/webapps/.war
Note: war archive file is created automatcaly when you use netbeans
0r you can do:
# ln -s /home/<login>/Project/java/<myProject>/webapps /usr/share/tomcat6/webapps/<myProject>
check /etc/hosts file, this file must contain the machine name, mine hosts file
jonathan 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
start httpd service
# service httpd start
check loclahost web page
start tomcat6
# service tomcat6 start
check localhost:8080 web page
check that tomcat show your project
if not:
check symbolic link and restart tomcat6 service
or add manualy with tomcat manager web page
a) Set project name
b) Se path to web.xml file
c) Valid
d) start your project (from web page)
for fedora 13 and under they are some problem, how fix it:
# chmod -R g+w /var/log/tomcat6 /etc/tomcat6/Catalina
# chmod -R g+w /usr/share/tomcat6/work/
check in log files located in /var/log/tomcat6/ if they are anymore "permission denied" message
aforementioned solutions did not help me, I could solve it by re-installing the Tomcat server which took few seconds.
On my PC I had to open the Tomcat6 entry again after the 7th step mentioned above and then change the default option under Server locations to Use tomcat installation.