OSX 10.9.1: "Tomcat started." localhost:8080 says "no data received" - java

I've spent hours trying to get Tomcat installed and the server running, and still nothing.
❯ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents
❯ bash startup.sh
Using CATALINA_BASE: /Library/Tomcat
Using CATALINA_HOME: /Library/Tomcat
Using CATALINA_TMPDIR: /Library/Tomcat/temp
Using JRE_HOME: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Using CLASSPATH: /Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar
Using CATALINA_PID: /Library/Tomcat/tomcat.pid
Existing PID file found during start.
Removing/clearing stale PID file.
Tomcat started.
/Library/Tomcat/bin
❯
localhost:8080 still doesn't load.
I've checked, and no other processes are using that port.
I've also added a dummy user. Still, nothing.
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="tomcat" password="tomcat" roles="tomcat,admin,manager"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
Configuration tests:
❯ ./catalina.sh configtest
Using CATALINA_BASE: /Library/Tomcat
Using CATALINA_HOME: /Library/Tomcat
Using CATALINA_TMPDIR: /Library/Tomcat/temp
Using JRE_HOME: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Using CLASSPATH: /Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar
Using CATALINA_PID: /Library/Tomcat/tomcat.pid
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/catalina/startup/Bootstrap : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
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)
Configuration error detected!
❯ which java
/usr/bin/java
❯ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
Yet, for some reason, I have 1.7 showing in my System Preferences.
I even tried Tomcat Controller, but it says something isn't configured properly also.
It'd be really helpful if these errors told me exactly what the problem was.
Feel free to move this to ServerFault

You have two JVMs installed. Not the JRE_HOME line in the output from startup and compare it with the JAVA_HOME path above it.
You'll need to update the JRE_HOME environment variable and the java symlink in /usr/bin to point to the java 7 installation.

Related

maven version exception on mac

When I execute "mvn --version" I get this error:
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
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 org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:254)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
at org.codehaus.plexus.classworlds.launcher.Launcher.getMainClass(Launcher.java:144)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:266)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Maven version I installed is maven 3.3.3
My java version is:
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
echo $PATH returns:
/Library/Maven/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
How to solve the problem of Maven?
$JAVA_HOME should be pointing to 1.8.0_65 as in your case.
If you want it to permanently change the value of JAVA_HOME, you will have to add the command to your ~/.profile file. Below are instructions on how to accomplish this instead:
Open up Terminal.app (Applications → Utilities → Terminal)
Type:
emacs .profile
Add this to the end of the .profile file:
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home
export JAVA_HOME;
Note that JAVA_HOME should be the path of your JDK directory.
Save and exit emacs (ctrl-x, ctrl-s; ctrl-x, ctrl-c)
Open a new Terminal window (cmd-n) and type:
$JAVA_HOME/bin/java -version

IllegalArgument Exception TomEE

I downloaded TomEE 1.7.1 and installed. While bringing the server up an IllegalArgumentException is thrown. What could be the issue as I have not deployed any app yet.
INFO: Using 'openejb.jdbc.datasource- creator=org.apache.tomee.jdbc.TomEEDataSourceCreator'
java.lang.IllegalArgumentException
at java.util.EventObject.<init>(EventObject.java:52)
at java.beans.PropertyChangeEvent.<init>(PropertyChangeEvent.java:41)
at org.apache.tomee.catalina.GlobalListenerSupport$MoniterableHashMap.put(GlobalListenerSupport.java:412)
at java.util.HashMap.putAllImpl(HashMap.java:746)
at java.util.HashMap.putAll(HashMap.java:736)
at java.util.LinkedHashMap.<init>(LinkedHashMap.java:112)
at org.apache.tomee.catalina.GlobalListenerSupport$MoniterableHashMap.<init>(GlobalListenerSupport.java:403)
at org.apache.tomee.catalina.GlobalListenerSupport.addContextListener(GlobalListenerSupport.java:380)
at org.apache.tomee.catalina.GlobalListenerSupport.engineAdded(GlobalListenerSupport.java:224)
at org.apache.tomee.catalina.GlobalListenerSupport.serviceAdded(GlobalListenerSupport.java:201)
at org.apache.tomee.catalina.GlobalListenerSupport.start(GlobalListenerSupport.java:181)
at org.apache.tomee.catalina.TomcatWebAppBuilder.start(TomcatWebAppBuilder.java:409)
at org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:223)
at org.apache.tomee.catalina.ServerListener.install(ServerListener.java:168)
at org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:55)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:110)
at org.apache.catalina.startup.Catalina.load(Catalina.java:638)
at org.apache.catalina.startup.Catalina.load(Catalina.java:663)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:280)
This is all the stacktrace that is thrown out.
Check el JRE_HOME variable environment. JRE_HOME most be reater a 5.
Tomcat EE display for example:
E:\Users\yo\Documents\apache-tomee-webprofile-1.7.4\bin>startup.bat
Using CATALINA_BASE: "E:\Users\yo\Documents\apache-tomee-webprofile-1.7.4"
Using CATALINA_HOME: "E:\Users\yo\Documents\apache-tomee-webprofile-1.7.4"
Using CATALINA_TMPDIR: "E:\Users\yo\Documents\apache-tomee-webprofile-1.7.4\temp"
Using JRE_HOME: "C:\Program Files\Java\jre7"
Using CLASSPATH: "E:\Users\yo\Documents\apache-tomee-webprofile-1.7.4\bin\bootstrap.jar;E:\Users\yo\Documents\ejecutables\apac
he-tomee-webprofile-1.7.4\bin\tomcat-juli.jar"
Check the version of JRE
-- Revisa la versión del JRE

Classpath for ojdbc6.jar not detected after being added to .bashrc in ubuntu

i have added the ojdbc6.jar and the ojdbc6_g.jar file in the .bashrc but i keep getting the driver error:
java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:259)
at jdbcdisplay.main(jdbcdisplay.java:17)
I have added the following Classpath to the .bashrc file for the ojdbc6.jar file:
export CLASSPATH=".:/home/shawnreese/Downloads/ojdbc6.jar:/home/shawnreese/Downloads/ojdbc6_g(1).jar"
The jar files are not even detected.They just keep showing the same error.On performing echo ${CLASSPATH} i get the jar file of opencsv.jar added in .bashrc.
.:/home/shawnreese/Downloads/opencsv-2.3/deploy/opencsv-2.3.jar
I am using java version:
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
and Oracle 11g Release 2.

tomcat produce exceptions when running deployed war file

During development I use tomcat plugging for maven: tomcat7-maven-plugin version 2.2
When I deploy war file to the remote host, tomcat throws errors. Here is the version of tomcat on the remote server:
root#vido:/var/lib/tomcat7/webapps# sh /usr/share/tomcat7/bin/version.sh
Using CATALINA_BASE: /var/lib/tomcat7
Using CATALINA_HOME: /usr/share/tomcat7
Using CATALINA_TMPDIR: /var/lib/tomcat7/temp
Using JRE_HOME: /usr/lib/jvm/java-7-oracle
Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
Server version: Apache Tomcat/7.0.26
Server built: Apr 1 2013 08:32:04
Server number: 7.0.26.0
OS Name: Linux
OS Version: 3.8.0-29-generic
Architecture: amd64
JVM Version: 1.7.0_55-b13
JVM Vendor: Oracle Corporation
Here is java version:
root#vido:/var/lib/tomcat7/webapps# java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
Here is a part of pom.xml file:
<!-- web sockets -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<!-- servlets -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
Here are exceptions:
DEBUG [pool-2-thread-1] (AnnotationAttributesReadingVisitor.java:186) - Failed to class-load type while reading annotation metadata. This is a non-fatal error, but certain annotation metadata may be unavailable.
java.lang.ClassNotFoundException: javax.websocket.server.ServerEndpoint
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1701)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546)
at org.springframework.core.type.classreading.RecursiveAnnotationAttributesVisitor.visitEnd(AnnotationAttributesReadingVisitor.java:182)
at org.springframework.asm.ClassReader.readAnnotationValues(ClassReader.java:1788)
DEBUG [pool-2-thread-1] (DefaultListableBeanFactory.java:404) - Ignoring bean class loading failure for bean 'getDataHandler'
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [com.vm.controllers.GetDataHandler] for bean with name 'getDataHandler' defined in file [/var/lib/tomcat7/webapps/videomessenger/WEB-INF/classes/com/vm/controllers/GetDataHandler.class]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: com/vm/controllers/GetDataHandler : Unsupported major.minor version 51.0 (unable to load class com.vm.controllers.GetDataHandler)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1330)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:594)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1396)
There are more errors but all of them of described type above.
solved by installing tomcat v 7.0.53
I guess you are building a web app based on the JEE 7 specs, I can see the WebSocket api, While your dependency is for the JEE 6. Add the correct dependency for JEE 7 and the error will be removed. The error is due to its not able to find the class. Due to dependency mismatch its showing a version mismatch error too.

umlgraph error, Could not find the main class

Folks, trying to automatically generate UML diagrams from code to speed up the discovery process. I've come across a project that does exactly what we need, http://www.umlgraph.org/doc/indexw.html
After the installation, I get the following:
umlgraph test png
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/umlgraph/doclet/UmlGraph : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: org.umlgraph.doclet.UmlGraph. Program will exit.
Java version on the system:
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.11.90) (rhel-1.62.1.11.11.90.el6_4-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
Can someone please point me in the correct direction? Does anyone use a similar project? Thanks!
It looks like umlgraph 5.6_6.1-SNAPSHOT was compiled for Java 7 only. Here's a snapshot from it's build.xml:
<javac srcdir="${src}" destdir="${build}" debug="true" deprecation="true" >
<compilerarg value="-Xlint"/>
</javac>
No "target" attribute set explicitly, so platform java version is used. And from JAR manifest it's obvoius, that it was compiled on java 1.7
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.2
Created-By: 1.7.0_21-b11 (Oracle Corporation)
So you can either install Java 7 to run umlgraph, or use the older version of ulmgraph, which was compiled to be compartible with Java 6.

Categories