在一台centos虚拟机上,安装完tomcat之后,试图启动它,屏幕上没报什么错,但无法通过浏览器访问:
[root@node18 bin]# ./startup.sh
Using CATALINA_BASE: /opt/apache/apache-tomcat-7.0.22
Using CATALINA_HOME: /opt/apache/apache-tomcat-7.0.22
Using CATALINA_TMPDIR: /opt/apache/apache-tomcat-7.0.22/temp
Using JRE_HOME: /usr/java/jdk1.6.0_29
Using CLASSPATH: /opt/apache/apache-tomcat-7.0.22/bin/bootstrap.jar:/opt/apache/apache-tomcat-7.0.22/bin/tomcat-juli.jar
执行关闭命令,发现tomcat根本就没有起来。
[root@node18 bin]# ./shutdown.sh
Using CATALINA_BASE: /opt/apache/apache-tomcat-7.0.22
Using CATALINA_HOME: /opt/apache/apache-tomcat-7.0.22
Using CATALINA_TMPDIR: /opt/apache/apache-tomcat-7.0.22/temp
Using JRE_HOME: /usr/java/jdk1.6.0_29
Using CLASSPATH: /opt/apache/apache-tomcat-7.0.22/bin/bootstrap.jar:/opt/apache/apache-tomcat-7.0.22/bin/tomcat-juli.jar
Jun 29, 2012 10:05:09 AM org.apache.catalina.startup.Catalina stopServer
涓ラ噸: Catalina.stop:
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at java.net.Socket.<init>(Socket.java:375)
at java.net.Socket.<init>(Socket.java:189)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:457)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:371)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:452)
[root@node18 bin]#
检查一下日志文件,即tomcat安装目录中的catalina.out文件,发现了下面的错误信息:
java.lang.NoClassDefFoundError: javax/net/ssl/KeyManagerFactory
at org.apache.tomcat.util.net.AbstractEndpoint.<init>(AbstractEndpoint.java:638)
at org.apache.tomcat.util.net.JIoEndpoint.<init>(JIoEndpoint.java:70)
at org.apache.coyote.http11.Http11Protocol.<init>(Http11Protocol.java:58)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.apache.catalina.connector.Connector.<init>(Connector.java:75)
解决办法,重新安装jdk。
[root@node18 setup]# rpm -qa | grep jdk
jdk-1.6.0_29-fcs
[root@node18 setup]# rpm -e jdk-1.6.0_29-fcs
[root@node18 setup]#
[root@node18 setup]#
[root@node18 setup]# ./jdk-6u29-linux-i586-rpm.bin
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
replace jdk-6u29-linux-i586.rpm? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
inflating: jdk-6u29-linux-i586.rpm
inflating: sun-javadb-common-10.6.2-1.1.i386.rpm
inflating: sun-javadb-core-10.6.2-1.1.i386.rpm
inflating: sun-javadb-client-10.6.2-1.1.i386.rpm
inflating: sun-javadb-demo-10.6.2-1.1.i386.rpm
inflating: sun-javadb-docs-10.6.2-1.1.i386.rpm
inflating: sun-javadb-javadoc-10.6.2-1.1.i386.rpm
Preparing... ########################################### [100%]
1:jdk ########################################### [100%]
Unpacking JAR files...
rt.jar...
jsse.jar...
charsets.jar...
tools.jar...
localedata.jar...
plugin.jar...
javaws.jar...
deploy.jar...
Java(TM) SE Development Kit 6 successfully installed.
Product Registration is FREE and includes many benefits:
* Notification of new versions, patches, and updates
* Special offers on Oracle products, services and training
* Access to early releases and documentation
Product and system data will be collected. If your configuration
supports a browser, the JDK Product Registration form will
be presented. If you do not register, none of this information
will be saved. You may also register your JDK later by
opening the register.html file (located in the JDK installation
directory) in a browser.
For more information on what data Registration collects and
how it is managed and used, see:
http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html
Press Enter to continue.....
Done.
[root@node18 setup]#
现在来尝试一下启动和关闭,发现没有报错了。检查日志,也很正常。
[root@node18 bin]# ./startup.sh
Using CATALINA_BASE: /opt/apache/apache-tomcat-7.0.22
Using CATALINA_HOME: /opt/apache/apache-tomcat-7.0.22
Using CATALINA_TMPDIR: /opt/apache/apache-tomcat-7.0.22/temp
Using JRE_HOME: /usr/java/jdk1.6.0_29
Using CLASSPATH: /opt/apache/apache-tomcat-7.0.22/bin/bootstrap.jar:/opt/apache/apache-tomcat-7.0.22/bin/tomcat-juli.jar
[root@node18 bin]#
能从浏览器访问了,关闭时也很正常。
[root@node18 bin]# ./shutdown.sh
Using CATALINA_BASE: /opt/apache/apache-tomcat-7.0.22
Using CATALINA_HOME: /opt/apache/apache-tomcat-7.0.22
Using CATALINA_TMPDIR: /opt/apache/apache-tomcat-7.0.22/temp
Using JRE_HOME: /usr/java/jdk1.6.0_29
Using CLASSPATH: /opt/apache/apache-tomcat-7.0.22/bin/bootstrap.jar:/opt/apache/apache-tomcat-7.0.22/bin/tomcat-juli.jar
[root@node18 bin]#
这种情况,以前从来没有碰到过。因为jdk是别人以前安装的,不知道中间发生了什么情况。
分享到:
相关推荐
标题 "java.lang.NoClassDefFoundError: javax/persistence/EntityListener" 提到的问题是一个常见的Java运行时异常,通常表示在类加载时找不到指定的类定义。这个错误在Java应用程序或Web应用中出现,可能是因为...
jdk升级jdk10后,原本jdk自带的 webservice一些包确实,引起的一系列错误解决方案
在Java开发过程中,我们经常会遇到`java.lang.NoClassDefFoundError`这个异常,尤其是在进行JDK版本升级时。这个错误通常表示在运行时找不到某个类的定义,即使编译时该类是可用的。在本例中,问题发生在从一个较低...
该jar包解决报错java.lang.NoClassDefFoundError: org/apache/james/mime4j/MimeException,亲测可用。
标题中的“java.lang.NoClassDefFoundError: javax/tools/StandardJavaFile”是一个常见的Java运行时错误,它表示在类路径中找不到某个类的定义。这个错误通常发生在试图执行包含特定类的代码,但该类在运行时环境中...
java.lang.NoClassDefFoundError: de/javakaffee/kryoserializers/CurrencySerializer
java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport异常处理
在Java编程中,`java.lang.NoClassDefFoundError` 是一个常见的运行时错误,它发生在类加载器尝试执行一个类,但在类路径中找不到该类的定义时。在这个特定的场景中,问题聚焦于 `net.sf.ezmorph.Morpher` 类。`...
JavaMail的java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream错误 原因: MyEclipse6.5的javaee.jar中的mail包与JavaMail包有冲突。 解决: 在MyEclipse目录下(D:\Program Files\MyEclipse ...
标题中的“JSON中,java.lang.NoClassDefFoundError: net/sf/ezmorph/Morpher问题解决”指的是一类常见的Java运行时错误,当尝试加载一个类时,如果Java虚拟机(JVM)找不到该类的定义,就会抛出`...
jackson-annotations-2.10.2.jar jackson-core-2.10.2.jar jackson-databind-2.10.2.jar NoClassDefFoundError解决
java.lang.NoClassDefFoundError: javax/validation/valueextraction/ValueExtractorDeclarationException 今天部署环境遇到这个问题,查了好长时间终于解决了; 问题原因: 由于jar包hibernate-validator、...
在Java编程中,`java.lang.NoClassDefFoundError` 是一个常见的运行时异常,它发生在类加载器尝试加载一个在编译时存在但在运行时找不到的类定义时。这个错误通常意味着类路径设置不正确或者依赖项没有正确地被包含...
java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/ConditionalTagSupport 问题-附件资源
Java编程中的`java.lang.NoClassDefFoundError: org/jboss/logging/`是一个常见的运行时错误,通常发生在尝试执行一个类时,JVM无法找到在编译时已经存在的类定义。这个错误并不意味着类在编译期间不存在,而是表明...
在Java编程中,`java.lang.ClassNotFoundException` 是一个常见的运行时异常,通常发生在尝试通过类加载器加载指定类时,但找不到对应的字节码文件。在这个特定的问题中,`ClassNotFoundException` 引发的原因是缺少...
在jsp运行过程中,报错 java.lang.NoClassDefFoundError org.apache.xml.serializer.TreeWalker时的处理方法。
在Android开发过程中,有时会遇到一个常见的运行时异常——`java.lang.NoClassDefFoundError`。这个错误通常意味着在编译期间能够找到类的定义,但在运行时却无法加载该类。本文将深入探讨这个问题,特别是在Android...