KIE-Server Container Stuck at CREATING Status - drools

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

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.

Failure to deploy from workbench to kie-server

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>

Problems Deploying application to Weblogic through the Admin Console

I'm using Weblogic 10.3.5. When I deploy my Struts2 application locally in eclipse, it runs fine. When I try to deploy my application through the Admin console, I get a Struts 2 error, name not found for action.
When I look at the .war file, it has all the libraries and classes. I followed these directions for deploying through the Admin Console. I can successfully deploy through the Admin Console, but when I try and use the test links for the application, I get the same error. If I try to access the application through the url:
http://localhost:7001/app-name
I get the same error.
Here is the stack trace:
[[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default
(self-tuning)'] WARN org.apache.struts2.dispatcher.Dispatcher - Could
not find action or result: /eServices/login.action There is no Action
mapped for namespace [/] and action name [login] associated with
context path [/eServices]. - [unknown location] at
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
at
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
at
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:37)
at
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
at
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:552)
at
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
at
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at
oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
at java.security.AccessController.doPrivileged(Native Method) at
oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at
oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
at
oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
at
oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at
oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
at
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at
weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at
weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at
weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209) at
weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
What am I doing wrong? Why can I access the application when I deploy it through eclipse, but I can't access the application when I deploy it through the Admin Console.
Thanks for your help!
Sounds like your struts.xml file in WEB-INF/classes is somehow wrong when you're trying a manual deploy. Crack open your .ear/.war file and see what's in your struts.xml (if it even exists). Eclipse might be automatically putting it into a folder for you that doesn't get deployed when you do it manually. Below is a working example for reference:
<struts>
<constant name="struts.devMode" value="true" />
<package name="default" namespace="/" extends="struts-default">
<action name="myAction"
class="com.something.myAction" >
<result name="success">pages/myPage.jsp</result>
</action>
</package>
</struts>
If the project root context is “app-name“, you can access the above action via a URL like –
http://domain:8080/app-name/myAction.action

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.