ClassNotFoundException while running Jetty 7.6 as a windows service - windows

I went through the solution written by #crowne for the question:
Running Jetty 7 as Windows Service
The command I used to install service:
bin\JettyService //IS//JettyService --DisplayName="Jetty Service"
--Install=D:\Jetty-7.6\bin\JettyService.exe --LogPath=D:\Jetty-7.6\logs --LogLevel=Debug --StdOutput=auto --StdError=auto --StartMode=Java --StopMode=Java --Jvm=auto ++JvmOptions=-Djetty.home=D:\Jetty-7.6 ++JvmOptions=-DSTOP.PORT=8087 ++JvmOptions=-DSTOP.KEY=downB0y ++JvmOptions=-Djetty.logs=D:\Jetty-7.6\logs ++JvmOptions=-Dorg.eclipse.jetty.util.log.SOURCE=true ++JvmOptions=-XX:MaxPermSize=128M ++JvmOptions=-XX:+CMSClassUnloadingEnabled ++JvmOptions=-XX:+CMSPermGenSweepingEnabled --Classpath=D:\Jetty-7.6\start.jar --StartClass=org.eclipse.jetty.start.Main ++StartParams=OPTIONS=All ++StartParams=D:\Jetty-7.6\etc\jetty.xml ++StartParams=D:\Jetty-7.6\etc\jetty-deploy.xml ++StartParams=D:\Jetty-7.6\etc\jetty-webapps.xml ++StartParams=D:\Jetty-7.6\etc\jetty-contexts.xml ++StartParams=D:\Jetty-7.6\etc\jetty-testrealm.xml --StopClass=org.eclipse.jetty.start.Main ++StopParams=--stop
but I get this error when starting the jetty server:
2013-06-03 14:58:17 Commons Daemon procrun stderr initialized
java.lang.NoClassDefFoundError: org/eclipse/jetty/start/Main
Caused by: java.lang.ClassNotFoundException:
org.eclipse.jetty.start.Main
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
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.eclipse.jetty.start.Main. Program
will exit.
Exception in thread "main"
I am using Windows 7, 32 bit and Jetty 7.6. Can someone please help me out.

It seems like the issue was with the prunsrv.exe provided with the commons daemon binaries. I then used the 64 bit .exe provided on a 64 bit windows system and it worked just fine. but why id did not work on 32 bit windows is still a mystery

It would appear that you have a classpath issue where the service running java execution does not know about the start.jar file. I would look into whatever options are available on that service dealio and figure out how to add something like
-cp d:\Jetty-7.6\start.jar
so it is on your classpath, from that point on the Jetty start.jar process should craft a reasonable classpath.

Related

Memcached and Tomcat 8 Session Manager Issue

We were using Memcached for session management in our web application with Tomcat 7 and it worked liked charm. In order for it work, I added following jars to Tomcat's lib folder
spymemcached-2.8.12.jar
couchbase-client-1.1.4.jar
memcached-session-manager-tc7-1.6.5.jar
memcached-session-manager-1.6.5.jar
And made following change to Tomcat's server.xml
<Context path="customersupport" docBase="customerSupportOrderCentral#v2" sessionCookieName="CUSTOMERSUPPORT-JSESSIONID">
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:oc-cs-elasticcache.w8eptf.cfg.usw1.cache.amazonaws.com:11211"
sticky="false" requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$" />
</Context>
Now we are in process of upgrading our JDK to 1.8 and Tomcat version to 8. I have been researching online for it and it turned out since tomcat 8 doesn't support getSessionCookieName, I have to update memcache jar files for tomcat 8. so I added new set of jar files at tomcat's lib folder as below.
spymemcached-2.11.1.jar
memcached-session-manager-tc8-1.8.1.jar
memcached-session-manager-1.8.1.jar
couchbase-client-1.4.0.jar
And Kept server.xml same but now Tomcat is throwing following error while starting up.
06-Jan-2016 07:03:48.934 SEVERE [main] org.apache.tomcat.util.digester.Digester.startElement Begin event threw error
java.lang.NoClassDefFoundError: org/apache/catalina/Lifecycle
at java.lang.ClassLoader.findBootstrapClass(Native Method)
at java.lang.ClassLoader.findBootstrapClassOrNull(ClassLoader.java:1012)
at java.lang.ClassLoader.loadClass(ClassLoader.java:413)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:116)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1178)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:766)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1344)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2787)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1451)
at org.apache.catalina.startup.Catalina.load(Catalina.java:551)
at org.apache.catalina.startup.Catalina.load(Catalina.java:599)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:310)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:484)
If I dont change server.xml to include memcache manager, its working fine but with memcache session manager its throwing above error. I can really use some help here to resolve this issue.
Thanks
I had the same issue and got stuck for 2 days. The issue on my end was I had the below memcache specific jars in tomcat/lib and in another project specific classpath - tomcat/{project}/conf. The issue got resolved when I removed these jars from tomcat/{project}/conf
spymemcached-2.11.1.jar
memcached-session-manager-tc8-1.8.1.jar
memcached-session-manager-1.8.1.jar

java.lang.OutOfMemoryError: Perm Gen Space..again

I followed the instructions from several great posts in dealing with this error when compiling my JSP and it seemed to go away ---for a while, but now it's back with a vengeance :(
First off here are the 'specs':
Spring 3.1.0 release
Using WebLogic Server 10.3.5,
Adjusted the STS.ini file to read as follows:
-Dosgi.requiredJavaVersion=1.5
-Xmn28m
-Xms120m
-Xmx2048m
-Xss1m
-XX:PermSize=256m
-XX:MaxPermSize=512m
and here is the error I am receiving when trying to view my page:
java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:630)
at java.lang.ClassLoader.defineClass(ClassLoader.java:614)
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:305)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
at com.bea.core.repackaged.jdt.internal.compiler.ClassFile.<init>(ClassFile.java:256)
at com.bea.core.repackaged.jdt.internal.compiler.ClassFilePool.acquire(ClassFilePool.java:34)
at com.bea.core.repackaged.jdt.internal.compiler.ClassFile.getNewInstance(ClassFile.java:229)
at com.bea.core.repackaged.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:512)
at com.bea.core.repackaged.jdt.internal.compiler.ast.TypeDeclaration.generateCode(TypeDeclaration.java:611)
at com.bea.core.repackaged.jdt.internal.compiler.ast.CompilationUnitDeclaration.generateCode(CompilationUnitDeclaration.java:358)
at com.bea.core.repackaged.jdt.internal.compiler.Compiler.process(Compiler.java:770)
at com.bea.core.repackaged.jdt.internal.compiler.Compiler.compile(Compiler.java:464)
at weblogic.jsp.internal.java.JDTJavaCompiler.generateByteCode(JDTJavaCompiler.java:104)
at weblogic.jsp.internal.java.JavaSourceFile._codeGen(JavaSourceFile.java:211)
at weblogic.jsp.internal.java.JavaSourceFile.codeGen(JavaSourceFile.java:201)
at weblogic.jsp.internal.ProxySourceFile.compileGeneratedFiles(ProxySourceFile.java:310)
at weblogic.jsp.internal.ProxySourceFile.codeGen(ProxySourceFile.java:248)
at weblogic.jsp.internal.SourceFile.codeGen(SourceFile.java:327)
at weblogic.jsp.internal.client.ClientUtilsImpl$CodeGenJob.run(ClientUtilsImpl.java:599)
at weblogic.jsp.internal.client.Job.performJob(Job.java:83)
at weblogic.jsp.internal.client.ThreadPool$WorkerThread.run(ThreadPool.java:217)
The error went away a week ago after adjusting the default PermSize (don't remember what it was set to)...is there anything else I should be looking for here?
As a follow on to George D's answer: For weblogic, any changes to JVM args should be put in $DOMAIN_HOME/bin/setDomainEnv.sh (this is for Linux, should be a similar path for Windows).

Moving ehcache server from one machine to another

We have been using ehcache.server.1.0.0.war for almost a year.
This week we moved to new computer. We copied cache and changed ehcache.xml accordingly.
However, the new server is now not starting. It throws the error:
SEVERE: WSSERVLET11: failed to parse runtime descriptor: java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;
java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;
at org.slf4j.impl.JDK14LoggerAdapter.warn(JDK14LoggerAdapter.java:429)
at net.sf.ehcache.store.DiskStore.deleteIndexIfCorrupt(DiskStore.java:267)
at net.sf.ehcache.store.DiskStore.initialiseFiles(DiskStore.java:210)
at net.sf.ehcache.store.DiskStore.<init>(DiskStore.java:166)
at net.sf.ehcache.store.DiskStore.create(DiskStore.java:187)
at net.sf.ehcache.Cache.createDiskStore(Cache.java:1069)
at net.sf.ehcache.Cache.initialise(Cache.java:941)
at net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:921)
at net.sf.ehcache.CacheManager.addConfiguredCaches(CacheManager.java:607)
at net.sf.ehcache.CacheManager.init(CacheManager.java:336)
at net.sf.ehcache.CacheManager.<init>(CacheManager.java:276)
at net.sf.ehcache.CacheManager.create(CacheManager.java:636)
at net.sf.ehcache.CacheManager.getInstance(CacheManager.java:657)
at net.sf.ehcache.server.soap.EhcacheWebServiceEndpoint.<init>(EhcacheWebServiceEndpoint.java:71)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
Any ideas appreciated.
java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;
This error happens when you have wrong slf4j version of the jar. Check carefully all jar versions/sizes on your old server and make sure they are the same on a new server.
Also diff. versions of the jars could be in your new app server system classpath that would interfere with your application classpath. You should configure class loading order policy in your deployment descriptor (its specific to the app server vendor you are using)

Tomcat webpage not coming up

My tomcat default web page does not come up, please could someone tell me the reason following i have pasted the last 100 lines for catalina log
Exception in thread "Timer-0" java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/CursorableLinkedList$Cursor
at org.apache.commons.pool.impl.CursorableLinkedList.cursor(CursorableLinkedList.java:305)
at org.apache.commons.pool.impl.GenericObjectPool.evict(GenericObjectPool.java:1488)
at org.apache.commons.pool.impl.GenericObjectPool$Evictor.run(GenericObjectPool.java:1700)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool.impl.CursorableLinkedList$Cursor
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
... 5 more
The stack trace indicates that Tomcat cannot find a class from the Apache Commons Pool library. Try adding the commons-pool jar under the WEB-INF/lib directory of your webapp.

Sonar Runner not starting

I am trying to configure Sonar 3.2 in my Windows 7 64 bit operating system with java 1.7.0_05.
When I start Sonar runner - 1.4, I am getting this exception
Exception in thread "main" org.sonar.batch.bootstrapper.BootstrapException: org.sonar.batch.bootstrapper.BootstrapException: Fail to download the file: http://localhost:9000/batch/hibernate-entitymanager-3.4.0.GA.jar
at org.sonar.batch.bootstrapper.Bootstrapper.downloadBatchFiles(Bootstrapper.java:164)
at org.sonar.batch.bootstrapper.Bootstrapper.createClassLoader(Bootstrapper.java:87)
at org.sonar.runner.Runner.createClassLoader(Runner.java:176)
at org.sonar.runner.Runner.execute(Runner.java:84)
at org.sonar.runner.Main.main(Main.java:67)
Caused by: org.sonar.batch.bootstrapper.BootstrapException: Fail to download the file: http://localhost:9000/batch/hibernate-entitymanager-3.4.0.GA.jar
at org.sonar.batch.bootstrapper.Bootstrapper.remoteContentToFile(Bootstrapper.java:113)
at org.sonar.batch.bootstrapper.Bootstrapper.downloadBatchFiles(Bootstrapper.java:159)
... 4 more
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:150)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
at sun.net.www.http.ChunkedInputStream.fastRead(ChunkedInputStream.java:239)
at sun.net.www.http.ChunkedInputStream.read(ChunkedInputStream.java:680)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3035)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3029)
at org.sonar.batch.bootstrapper.BootstrapperIOUtils.copyLarge(BootstrapperIOUtils.java:63)
at org.sonar.batch.bootstrapper.Bootstrapper.remoteContentToFile(Bootstrapper.java:109)
any solution to solve this issue is appreciated.
I am able to download hibernate-entitymanager-3.4.0.GA.jar from http://localhost:9000/batch/hibernate-entitymanager-3.4.0.GA.jar in the browser.
I see in your configuration details that you are running Sonar using a Java 7 VM: could you please try with Java 6?
That might not be the root cause, but I know we have users who reported some issues with Java 7.
This is the error I get when I execute the runner without administrative privileges.
If you're launching the runner from a DOS prompt, try right-clicking on "Windows Command Processor" and choosing "Run as Administrator."

Resources