Jetty Version 9 throws java.lang.NoClassDefFoundError for Embedded Server - jetty

I decided to upgrade Jetty in order to add support for HTTPS connections. The build was done successfully by Maven and the code runs on Java 7 JRE.
After an upgrade from Jetty 8 (8.1.8.v20121106) to Jetty Version 9 (9.2.14.v20151106) using an embedded server code, I get the following error at the begin of the Jetty server startup.
Any hint what is causing the error at the classloader?
sh ./testit.sh
Exception in thread "main" java.lang.NoClassDefFoundError: org.eclipse.jetty.server.HttpConfiguration$Customizer
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:94)
at java.lang.J9VMInternals.prepare(J9VMInternals.java:514)
at java.lang.Class.getMethod(Class.java:1113)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:507)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:499)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.HttpConfiguration$Customizer
at java.net.URLClassLoader.findClass(URLClassLoader.java:600)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:777)
at java.lang.ClassLoader.loadClass(ClassLoader.java:750)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:326)
at java.lang.ClassLoader.loadClass(ClassLoader.java:731)
... 6 more

I've isolated the error cause. The Maven build tool added the Jetty distribution version number to the target libraries, which did not match my Java static classpath configuration. After correcting the classpath setting in the startup script, the program code started the embedded Jetty 9 server and worked just fine for my project.
#Joakim Erdfelt this is my Java version
java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build pxa6470sr9fp10-20150708_01(SR9 FP10))
IBM J9 VM (build 2.6, JRE 1.7.0 Linux amd64-64 Compressed References 20150701_255667 (JIT enabled, AOT enabled)
J9VM - R26_Java726_SR9_20150701_0050_B255667
JIT - tr.r11_20150626_95120.01
GC - R26_Java726_SR9_20150701_0050_B255667_CMPRSS
J9CL - 20150701_255667)
JCL - 20150628_01 based on Oracle jdk7u85-b15

Related

How to write a startup script for burpsuite on java17

This is the original running script of burpsuite, and there is no problem in the java8 environment.
java -Dfile.encoding=utf-8 -javaagent:BurpSuiteCn.jar -Xmx1024m -noverify -Xbootclasspath/p:burp-loader-keygen-2.jar -jar burpsuite_pro_v2.1.jar
But it will report an error in java17
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
-Xbootclasspath/p is no longer a supported option.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Now changing to java17, how do I update my startup script?

Getting java errors trying to run leiningen

I'm trying to build a project that uses leiningen -- though my issue seems to be with leiningen and not with the project.
When I run lein figwheel dev (for a project that has a /dev folder configured correctly) I get the following:
Figwheel: Cutting some fruit, just a sec ...
Unrecognized option: --add-modules
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Which indicates it's an error with the JVM, but I'm not familiar enough with working with any of JVM / clojure / lein to know what I should be doing to fix it.
Some (hopefully!) helpful information about my stack:
$ java --version
openjdk 11.0.1 2018-10-16
OpenJDK Runtime Environment (build 11.0.1+13-Debian-2)
OpenJDK 64-Bit Server VM (build 11.0.1+13-Debian-2, mixed mode, sharing)
$ lein --version
Leiningen 2.8.1 on Java 1.8.0_171 OpenJDK 64-Bit Server VM
Clone this repo and see if it solves your problems: https://github.com/cloojure/cljs-template
Be sure to read the README.txt file and follow the instructions.
For this project, all you need is:
> lein figwheel
I'm not sure what you have in your ./dev folder - that's probably the problem.

Using Web Application created with Netbeans in Tomcat?

Sorry I newbie.
How to use Web Application ( with Web Services) created with Netbeans in my Tomcat that was manually installed?
I want to use my WA in my Tomcat (this tomcat wasn't installed with Netbeans).
My Tomcat is 8.0.3 version...
My Netbeans is:
Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: Updates available to version NetBeans 8.0 Patch 2
Java: 1.8.0_05; Java HotSpot(TM) Client VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)
I was following http://docs.huihoo.com/netbeans/6.0/kb/60/websvc/jax-ws.html.
I decided to use this old version because this link (newer version) https://netbeans.org/kb/docs/websvc/jax-ws.html is oriented to Glassfish.
Now I want to test my Web Services in Tomcat, I was thinking that I need to copy my folder named: CalculatorWSApplication to webapps\ROOT tomcat's folder, trying to do smothing like:
IPofMyHost:8080/CalculatorWSApplication/
or
IPofMyHost:8080/CalculatorWSApplication/CalculatorWS
I'm very lost
you can tell netebans you have tomcat (menu->tools->server->add server...)
and then configure you project to run with tomcat (project->properties->run->server...)
Or, after building you app in netbeans, just copy the .war file to the tomcat "webapps" folder.
Tomcat will do the deploy for you.

Jetty 6 from Debain packages with Oracle Java

i try to install jetty from the Debian (wheezy) packages. But instead of default Openjdk i installed Oracle Java.
Download tar.gz. and build a deb package
(https://wiki.debian.org/Java/Sun or http://www.webstimme.de/2013/02/05/linux-java-unter-debian-wheezy-installieren-anleitung/)
$java -v
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
Afterwards i istalled jetty with apt-get, but it also installes the packages
openjdk-6-jre-headless openjdk-6-jre-lib
so Java is then
java -version
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1~deb7u1)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
I will give it a second try with installing the Oracle Java version 1.6.
Any Experiences with installing the jetty package repo and use an Oracle Java, will this ever works?
Edit:
It's possible with Oracle Java 6 (1.6) but not with Oracle Java 7 (1.7)
I tried to run it with Oracle Java because of potential better performance for Solr. I somebody has knowledge about the difference in perfomance with Open JDK and Oracle Java it would be nice to post it here :) Thanks
Edit:
I was wrong. It runs also with Oracle JDK 7.
Just download and extract it e.g. to /opt/Oracle_Java and put the path in the /etc/default/jetty as JAVA_HOME
JAVA_HOME="/opt/Oracle_Java"
Which jre is used by default is controlled by alternatives system. Use the command update-java-alternatives -l to list which JREs are installed and then use update-java-alternatives -sto choose which JRE to use.
I have two JDKs on my machine:
# update-java-alternatives -l
j2sdk1.6-oracle 315 /usr/lib/jvm/j2sdk1.6-oracle
jdk-7-oracle-x64 317 /usr/lib/jvm/jdk-7-oracle-x64
To use jdk-7 as my default JDK I would run update-java-alternatives -s jdk-7-oracle-x64
It is possible to run Jetty 6 from Debian or Ubuntu package repository with Oracle Java 6 and Oracle Java 7.

Can I run a Grails war under Tomcat in a machine without JDK (Only JRE)?

Can I run a Grails war under Tomcat in a machine without JDK (Only JRE)?
I have a Grails app that works fine in grails run-war or in a separate tomcat server in the same computer.
When I deploy this .war on a server that has a JDK, I have no problem.
When I try to do this in a server that only has a JRE, the application won't work.
specs:
grails app:
grails 1.2.2.
groovyWS,
i18n templates
dev pc:
win xp sp3
2gb ram
athlon 64 x 2
java: build 1.6.0_20-b02 ( JDK )
tomcat: 6.0.24 ( test 1 )
tomcat 5.5 ( test 2 )
server that do not work:
so: windows server 2003
app server: tomcat 2.2 as a service ,
java: 1.6.0.18 , ( ONLY JRE )
wsclient: groovyws-0.5.1.jar ( minimal ) ( and all depenedncies added by hand )
Stacktrace
[ERROR] IOException during exec() of compiler "javac". Check your path environment variable.
2010-03-18 15:55:23,522 [http-8080-1] ERROR dynamic.DynamicClientFactory - Could not compile java files for http://SOMEURL/SOMEWS.asmx?WSDL.
2010-03-18 15:55:23,553 [http-8080-1] ERROR errors.GrailsExceptionResolver - "org.tempuri" doesnt contain ObjectFactory.class or jaxb.index
javax.xml.bind.JAXBException: "org.tempuri" doesnt contain ObjectFactory.class or jaxb.index
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:197)
at javax.xml.bind.ContextFinder.newInstance(Unknown Source)
at javax.xml.bind.ContextFinder.find(Unknown Source)
at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:349)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:196)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:175)
at groovyx.net.ws.AbstractCXFWSClient.createClient(AbstractCXFWSClient.java:198)
at groovyx.net.ws.WSClient.initialize(WSClient.java:107)
at groovyx.net.ws.IWSClient$initialize.call(Unknown Source)
GroovyWS needs javac to create stubs dynamically, so it needs JDK.
JSP's need to be compiled (even if they're in the war), so there needs to be a compiler for it. You can't just use the JRE. This is for Java stuff, for groovy its most likely the same.