Heroku App Crashing with NoClassDefFoundError: org/eclipse/jetty/server/Handler - java

I am trying to run an app on Heroku. I am doing CI on Travis and deploying from it. My code is at https://github.com/santoshkt/cdetsd123
When I went through the logs in heroku, I see following
2014-03-10T03:14:08.180220+00:00 heroku[web.1]: Starting process with command `j
ava $JAVA_OPTS -cp target/classes:target/dependency/* mytest.Main`
2014-03-10T03:14:10.692378+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Djav
a.rmi.server.useCodebaseOnly=true -Djava.rmi.server.useCodebaseOnly=true
2014-03-10T03:14:11.217814+00:00 app[web.1]: Exception in thread "main" java.lan
g.NoClassDefFoundError: org/eclipse/jetty/server/Handler
2014-03-10T03:14:11.286992+00:00 app[web.1]: Caused by: java.lang.ClassNotFoundE
xception: org.eclipse.jetty.server.Handler
2014-03-10T03:14:11.287150+00:00 app[web.1]: at java.net.URLClassLoader$1.run
(URLClassLoader.java:217)
2014-03-10T03:14:11.287380+00:00 app[web.1]: at java.net.URLClassLoader.findC
lass(URLClassLoader.java:205)
2014-03-10T03:14:11.287271+00:00 app[web.1]: at java.security.AccessControlle
r.doPrivileged(Native Method)
2014-03-10T03:14:11.287380+00:00 app[web.1]: at java.lang.ClassLoader.loadCla
ss(ClassLoader.java:321)
2014-03-10T03:14:11.287380+00:00 app[web.1]: at sun.misc.Launcher$AppClassLoa
der.loadClass(Launcher.java:294)
2014-03-10T03:14:11.287645+00:00 app[web.1]: at java.lang.ClassLoader.loadCla
ss(ClassLoader.java:266)
2014-03-10T03:14:11.296871+00:00 app[web.1]: Could not find the main class: myte
st.Main. Program will exit.
To run this software locally, I use mvn jetty:run command and everything works fine. BTW I'm using maven + jetty in this application. I'm trying to debug this for last 6 hours with no clues. Any help is appreciated.

Instead of using a Main method to start the server, I solved this by changing the Procfile of Heroku using below.
web: java $JAVA_OPTS -jar target/dependency/jetty-runner.jar --port $PORT target/*.war
Hope this helps anyone facing same issue.

Related

java.lang.ClassNotFoundException: org.mockserver.version.Version

I am trying to start mock server with mockserver-netty-5.13.2 from shell,
java version:
11.0.9
Rough shell code like this:
java -version
echo "start shell before java -jar line"
java -jar ./mockserver-netty-5.13.2.jar -serverPort 9090 -logLevel DEBUG &> ${DIR}/mockserver.log
The exception thrown from java -jar ./mockserver-netty-5.13.2.jar -serverPort 9090
Exception in thread "main" java.lang.NoClassDefFoundError: org/mockserver/version/Version
at org.mockserver.cli.Main.<clinit>(Main.java:27)
Caused by: java.lang.ClassNotFoundException: org.mockserver.version.Version
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 1 more
Has anyone run into this issue and resolved it ?
Any help would be much appreciated !!!

Play deploy on Heroku failed uncaught fatal error from Akka actorsystem

I am trying to deploy my Play/Scala 2.5.4 to Heroku (with free dyno). I am getting this error and application is not going live.
20:51:27 web.1 | 2017-08-12 20:51:27,035 [error] a.a.ActorSystemImpl - Uncaught fatal error from thread [application-akka.actor.default-dispatcher-5] shutting down ActorSystem [application]
JVM options:
Picked up JAVA_TOOL_OPTIONS: -Xmx350m -Xss512k -Dfile.encoding=UTF-8
Increasing memory doesn't help. Any idea why I am getting this error ? App runs fine on Mac.

selenium maven tests work on local machine but not on Jenkins

I have some tests in selenium. When I run them using maven on my local machine then everything works fine, but when I try to start them using jenkins I get an error. Can anyone help me out and tell why it works on my machine, and doesnt on Jenkins? Thanks
[SNOWDEN_develop_Selenium_AutoTests] $ java -cp /var/lib/jenkins/maven33-agent.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven /boot/plexus-classworlds-2.5.2.jar:/var/lib/jenkins/tools /hudson.tasks.Maven_MavenInstallation/maven/conf/logging jenkins.maven3.agent.Maven33Main /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven /var/lib/jenkins/slave.jar /var/lib/jenkins/maven33-interceptor.jar /var/lib/jenkins/maven3-interceptor-commons.jar 43010
Exception in thread "main" java.lang.ClassNotFoundException: hudson.remoting.Launcher
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
at jenkins.maven3.agent.Maven33Main.main(Maven33Main.java:133)
at jenkins.maven3.agent.Maven33Main.main(Maven33Main.java:64)
[SNOWDEN_develop_Selenium_AutoTests] $ /bin/bash -xe /tmp/hudson5734623695552292225.sh
+ cd /var/lib/jenkins/workspace/SNOWDEN_develop_Selenium_AutoTests/snowden-docker
+ ./docker.snowden.sh stop devsel
WORKSPACE: /var/lib/jenkins/workspace/SNOWDEN_develop_Selenium_AutoTests
Docker host : 10.0.0.27:4243 (SNOWDEN-DEV)
Stop docker container snowden_devsel ...
Stoping container snowden_devsel ...
snowden_devsel_tomcat
snowden_devsel_mongodb
ERROR: Failed to parse POMs
java.io.EOFException: unexpected stream termination
at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:365)
at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:310)
at hudson.slaves.Channels.forProcess(Channels.java:115)
at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:294)
at hudson.maven.ProcessCache.get(ProcessCache.java:236)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:798)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1728)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:544)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
Finished: FAILURE

postgres server refuses to connect to heroku

I've set up a remote postgresql database for a gradle app that I'd like to deploy on Heroku. When running my app on my machine it works fine. However, I had a hard time connecting to the database that I've set up on Heroku, so I thought I'd just try to connect to my remote database. This is the error that showed up in my app log:
2016-08-18T13:28:12.606715+00:00 app[web.1]: [JarClassLoader] INFO: findResource(): unable to locate "org/postgresql/translation/messages_en.properties"
2016-08-18T13:28:12.609362+00:00 app[web.1]: Exception in thread "main" java.lang.reflect.InvocationTargetException
2016-08-18T13:28:12.609487+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2016-08-18T13:28:12.609542+00:00 app[web.1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2016-08-18T13:28:12.609642+00:00 app[web.1]: at java.lang.reflect.Method.invoke(Method.java:498)
2016-08-18T13:28:12.609715+00:00 app[web.1]: at com.simontuffs.onejar.Boot.main(Boot.java:161)
2016-08-18T13:28:12.609970+00:00 app[web.1]: Caused by: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
2016-08-18T13:28:12.610011+00:00 app[web.1]: at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:239)
2016-08-18T13:28:12.610060+00:00 app[web.1]: at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
2016-08-18T13:28:12.610112+00:00 app[web.1]: at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:127)
2016-08-18T13:28:12.610162+00:00 app[web.1]: at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29)
2016-08-18T13:28:12.610440+00:00 app[web.1]: at org.postgresql.Driver.connect(Driver.java:282)
2016-08-18T13:28:12.610602+00:00 app[web.1]: at net.bethydiakabana.mbta.MbtaApplication.run(MbtaApplication.java:79)
2016-08-18T13:28:12.611050+00:00 app[web.1]: Caused by: java.net.ConnectException: Connection refused
2016-08-18T13:28:12.611072+00:00 app[web.1]: at java.net.PlainSocketImpl.socketConnect(Native Method)
2016-08-18T13:28:12.611122+00:00 app[web.1]: at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
2016-08-18T13:28:12.611146+00:00 app[web.1]: at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
2016-08-18T13:28:12.611170+00:00 app[web.1]: at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
2016-08-18T13:28:12.611286+00:00 app[web.1]: at org.postgresql.core.PGStream.<init>(PGStream.java:61)
2016-08-18T13:28:12.611331+00:00 app[web.1]: ... 23 more
2016-08-18T13:28:12.688094+00:00 heroku[web.1]: Process exited with status 1
2016-08-18T13:28:12.703273+00:00 heroku[web.1]: State changed from starting to crashed
I've read that I needed to change the permissions in the postgres configuration files yet I kept getting the same errors. What would be the best way to fix this on a windows machine?
EDIT:
I've set up a heroku postgres database to see if that would help. I'm not sure if it's still having connection issues as well as locating the main class. Would it still be worth connecting to my original database? This is the error that I'm getting now:
Starting process with command `java -Ddw.server.connector.port=37275 -Ddw.database.user=mmcyajlpsbacac -Ddw.database.password=C6nrfQzuoS2ZEMDaTqVEssPDxa -Ddw.database.url=jdbc:postgresql://ec2-54-235-254-199.compute-1.amazonaws.com:5 432/d8hvhhr0h3hr8d?user=mmcyajlpsbacac&password=C6nrfQzuoS2ZEMDaTqVEssPDxa&sslmo de=require $JAVA_OPTS -jar build/libs/mbta-tweets.jar server config.yaml`
2016-08-18T17:25:22.842387+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2016-08-18T17:25:22.846667+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx350m -Xss512k -Dfile.encoding=UTF-8
2016-08-18T17:25:23.220849+00:00 app[web.1]: Error: Could not find or load main class 432.d8hvhhr0h3hr8d?user=mmcyajlpsbacac&password=C6nrfQzuoS2ZEMDaTqVEssPDxa&sslmo
2016-08-18T17:25:23.317758+00:00 heroku[web.1]: Process exited with status 1
2016-08-18T17:25:23.331809+00:00 heroku[web.1]: State changed from starting to crashed
Here is a snippet of my yaml configuration that's read by the configuration class:
server:
type: simple
applicationContextPath: /application
adminContextPath: /admin
connector:
type: http
port: 8080
database:
# the name of your JDBC driver
driverClass: org.postgresql.Driver
# the username
user: someusername
# the password
password: somepassword
# the JDBC URL
url: jdbc:postgresql://host:port/dbname?user=username&password=password
Here is my procfile:
web: java $JAVA_OPTS -Ddw.server.connector.port=$PORT -Ddw.database.user=$JDBC_DATABASE_USERNAME -Ddw.database.password=$JDBC_DATABASE_PASSWORD -Ddw.database.url=$JDBC_DATABASE_URL $JAVA_OPTS -jar build/libs/mbta-tweets.jar server config.yaml
This message:
Caused by: org.postgresql.util.PSQLException: Connection to localhost:5432 refused
Suggests that you are trying to connect to a database on localhost on Heroku, which is certainly not correct. Can you show how you've configured your database connection in the Java code?

IntelliJ IDEA failing to run a Grails 2.3.0 project

Recently, I have imported a working Grails project from STS 3.3 into Intelj IDE . But, when I run the application, I get the following error in debug mode.
I'm on Grails 2.3.0 and IntelliJ IDEA 13.1.1
On Grails console on IntelliJIDE i see the following output:
/usr/share/java/jdk1.6.0_30/bin/java -Dgrails.home=/opt/grails-2.3.0 -Dbase.dir=/home/you/Projects/terra-connect -Dtools.jar=/usr/share/java/jdk1.6.0_30/lib/tools.jar -Dgroovy.starter.conf=/opt/grails-2.3.0/conf/groovy-starter.conf -Xmx768M -Xms768M -XX:MaxPermSize=256m -XX:PermSize=256m -javaagent:/opt/grails-2.3.0/lib/org.springsource.springloaded/springloaded-core/jars/springloaded-core-1.1.3.jar -noverify -Dspringloaded=profile=grails -Didea.launcher.port=7532 -Didea.launcher.bin.path=/home/you/Dev/idea-IU-135.480/bin -Dfile.encoding=UTF-8 -classpath /opt/grails-2.3.0/lib/org.codehaus.groovy/groovy-all/jars/groovy-all-2.1.6.jar:/opt/grails-2.3.0/dist/grails-bootstrap-2.3.0.jar:/home/you/Dev/idea-IU-135.480/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain org.codehaus.groovy.grails.cli.support.GrailsStarter --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf /opt/grails-2.3.0/conf/groovy-starter.conf run-app`
and a stacktrace after Running grails app, with this message:
2014-04-10 09:58:48,314 [localhost-startStop-1] ERROR StackTrace - Full Stack Trace:
java.lang.NullPointerException
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodGetDeclaredAnnotations(ReflectiveInterceptor.java:935)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodGetAnnotations(ReflectiveInterceptor.java:1491)
at org.springframework.core.type.StandardAnnotationMetadata.hasAnnotatedMethods(StandardAnnotationMetadata.java:163)
at org.springframework.context.annotation.ConfigurationClassUtils.isLiteConfigurationCandidate(ConfigurationClassUtils.java:106)
at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:88)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:253)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:223)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
at org.codehaus.groovy.grails.commons.spring.DefaultRuntimeSpringConfiguration.getApplicationContext(DefaultRuntimeSpringConfiguration.java:153)
at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:169)
at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:127)
at org.codehaus.groovy.grails.web.context.GrailsConfigUtils.configureWebApplicationContext(GrailsConfigUtils.java:122)
at org.codehaus.groovy.grails.web.context.GrailsContextLoader.initWebApplicationContext(GrailsContextLoader.java:108)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
2014-04-10 09:58:48,319 [localhost-startStop-1] ERROR StackTrace - Full Stack Trace:
java.lang.NullPointerException
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
2014-04-10 09:58:48,320 [localhost-startStop-1] ERROR StackTrace - Full Stack Trace:
java.lang.NullPointerException
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
2014-04-10 09:58:48,320 [localhost-startStop-1] ERROR StackTrace - Full Stack Trace:
java.lang.NullPointerException
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Disconnected from the target VM, address: '127.0.0.1:50341', transport: 'socket'
Process finished with exit code 1
Any ideas?
Hey i have got your problem , am sure your using Linux Machine. Ok , for that you need to do the following :
The root casue of this problem is the IDE need to RUN in root permisssion inorder to connect to sokcets or succsfully debug.so , you should make the following change :
Intellij requires root permissions for the built in functions to work.
Either start using sudo:
sudo /your/inteljdirectory/bin/idea.sh
or give all users to run in debug mode Intellij, then start as yourself:
sudo chmod -R o+rw /your/inteljdirectory/idea.sh
cd /your/inteljdirectory/bin
cd sudo ./idea.sh
Keep in mInd this not directly related with your problem but ,:
The location of IDEA_JDK and JDK_HOME environmental variables. They have to be placed in /etc/profile .
After defining of the environmental vars in etc/profile there are several methods to create a desktop link:
As mentioned above by Roman Shevchenko
Recommended way to integrate IDEA is to invoke Configure | Create Desktop Entry from welcome screen (or via Tools | Create Desktop Entry from main menu)
Invoke "Make Link" on ides.sh and move "link to idea.sh" to Desktop.
DONE!! Happy coding!!
Try to Ctrl + Alt + G then enter --reloading run-app in the Command Line when the run target dialog appears. That fixed it for me!
If that works perfect then you can change the default configuration by going to Run->Edit Configuration and adding --reloading before run-app in the command line box.
Hope that helps #AlexanderSuraphel!
Turns out that it's not an Intellij problem. The issue is with the -reloading option being turned off in Grails 2.3.0. I solved my problem by upgrading to 2.3.8.

Categories

Resources