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

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.

Related

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

Spring Boot app with embedded init.d script not starting on reboot

Spring Boot has a handy feature that it will embed an init.d starup script into an executable jar if you configure the maven plugin to do so:
http://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html#deployment-install
So I am "installing" a Spring Boot app (executable fat jar) as a service in Centos 6.6 using the above method.
So far so good. I create a link to my jar and set the permissions:
sudo ln -s /path/to/myapp.jar /etc/init.d/my-service
sudo chmod 0755 /etc/init.d/my-service
And I can successfully start the application:
sudo service my-service start
However, I want the app to come up on startup, so I use the chkconfig utility:
sudo chkconfig --add my-service
sudo chkconfig my-service on
No errors with those commands, but when I reboot Centos the service does not auto-start.
running:
sudo service my-service status
shows:
Not running
running:
chkconfig --list my-service
shows:
my-service 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Everything looks good, but it's not starting. At this point I can manually start the service with "sudo service my-service start" and it comes back up, but it's not auto-starting on boot.
Any ideas?
Thanks
Problem solved. Turned out to be a path issue and my fault. The path where the application lived was a mounted directory that was not available at boot time.
I have the similar issue, I got the following error message when I run service myapp start
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/springframework/boot/loader/JarLauncher : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.springframework.boot.loader.JarLauncher. Program will exit.
However I could make it work via directly run /etc/init.d/app start.
Finally I found the problem is the default jdk is 1.6 although the java is 1.8 in the current user. Then I changed the symbolic and it worked.

java.io.IOException: Invalid argument at java.io.WinNTFileSystem.canonicalize0

I am using Eclipse Mars with Tomcat v8.0.30 ,jre 1.8.0_73. Yesterday I didnt have any problems but today my Tomcat server fail to start. A dialog pops up and it says: "Starting Tomcat v8.0 Server at localhost has encountered a problem. Server Tomcat v8.0 Server at localhost failed to start.
I have this error in the console:
org.apache.catalina.startup.Bootstrap initClassLoaders
SEVERE: Class loader creation threw exception
java.io.IOException: Invalid argument
at java.io.WinNTFileSystem.canonicalize0(Native Method)
at java.io.WinNTFileSystem.canonicalize(Unknown Source)
at java.io.File.getCanonicalPath(Unknown Source)
at java.io.File.getCanonicalFile(Unknown Source)
at org.apache.catalina.startup.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:168)
at org.apache.catalina.startup.Bootstrap.createClassLoader(Bootstrap.java:201)
at org.apache.catalina.startup.Bootstrap.initClassLoaders(Bootstrap.java:146)
at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:256)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
I have Tomcat EE v7.0 server which gives me the exact same problem.
I reinstalled Eclipse and Tomcat , I restarted my PC , I restored default options multiple times. I created new server couple of times and I even deleted "org.eclipse.core.resources" and the result is still the same.
Any suggestions?
I suspect your CATALINA_HOME is set wrong. Usually users writing path\bin; where it is only-path-to-tomcat without bin or any folder.
Remove backslash \ at the end of the CATALINA_HOME
You must check your tomcat log catalina.out to trace the route cause
Also check your TOMCAT_HOME/conf/catalina.properties file. There may be some unseen character that causesjava.io.IOException: Invalid argument

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>

Set system properties in standalone-full.xml in wildfly 8.2

I have added system-properties tag in standalone-full.xml, but its not working in standalone mode. However, if I add the same tag in domain.xml it's working for domain mode.
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns="urn:jboss:domain:2.2">
<extensions>
....
</extensions>
<system-properties>
<property name="java.util.Arrays.useLegacyMergeSort" value="true"/>
</system-properties>
</server>
According to this article on jBoss General configuration concepts
System property values can be set in a number of places in domain.xml, host.xml and standalone.xml.
Then what about standalone-full.xml?
I don't want to set it through command line and not even in java code.
In standalone it's probably too late to set it in the configuration files. You'll need to add it to the standalone.conf or standalone.conf.bat in the JAVA_OPTS environment variable. A global property like that needs to be set before anything else attempts to use java.util.Arrays.
If you have started the Wildfly server with standalone-full.xml instead of standalone.xml(the default) than this should be reflected in the start of the server:
standalone.sh -b <hostIP> -c standalone-full.xml -Dorg...
Then this will have effect on first start.
If you change something in this config file, you will need to reload Wildfly(configuration) from jboss cli:
[standalone#localhost:9990 /] :reload
For Wildfly 10 it's working nontheless. I was able to read the property for an instance started with the standalone-full.xml containing some properties.
The manual must be outdated then I guess? Because even Wildfly itself inserts a new property in the standalone-full.xml when using the Wildfly admin webinterface: http://localhost:9990 > Configuration > System Properties (Wildfly will add the property of course to the xml config which was used to start the instance). That's enough proof for me.