JAVA tomcat出错
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JAVA tomcat出错相关的知识,希望对你有一定的参考价值。
严重: StandardWrapper.Throwable
java.lang.NullPointerException
at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1003)
at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:955)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4044)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1023)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
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.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2009-11-22 16:05:19 org.apache.catalina.core.StandardContext loadOnStartup
严重: Servlet /structs threw load() exception
java.lang.NullPointerException
at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1003)
at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:955)
at org.apache.struts.action.ActionServlet.parseModuleConfigFile
看到一大堆异常不要慌,一般都是第一个提示出错的地方就是最接近根源的地方。其他后面跟出来的一大串都是因为此异常连带出来的。 参考技术A 有可能是少了struts-config.xml文件 参考技术B load()
这个方法空指向异常
想办法重新处理一下你的load() 方法
看看是哪里写的不对 参考技术C 空指针异常~ 参考技术D 没分都是好异常
使用 Tomcat 和 Mysql 将应用程序部署到 Heroku 时出错
【中文标题】使用 Tomcat 和 Mysql 将应用程序部署到 Heroku 时出错【英文标题】:Error deploying app to Heroku with Tomcat and Mysql 【发布时间】:2020-04-02 00:46:02 【问题描述】:我有一个包含 4 个模块的 Maven 应用程序。我正在将该应用程序部署到 heroku。我使用 Tomcat 9.0.29,Java 8。本地一切正常,但 heroku 上有一个错误。问题是,我什至不知道它是什么。错误在哪里?有人可以帮助我吗?
2019-12-08T20:36:20.143115+00:00 app[web.1]: variable.
2019-12-08T20:36:20.143117+00:00 app[web.1]: --bind-on-init
2019-12-08T20:36:20.143119+00:00 app[web.1]: Controls when the socket used by the connector is bound. By default it
2019-12-08T20:36:20.143121+00:00 app[web.1]: is bound when the connector is initiated and unbound when the connector
2019-12-08T20:36:20.143123+00:00 app[web.1]: is destroyed., default value: true
2019-12-08T20:36:20.143125+00:00 app[web.1]: Default: true
2019-12-08T20:36:20.143126+00:00 app[web.1]: --compressable-mime-types
2019-12-08T20:36:20.143129+00:00 app[web.1]: Comma delimited list of mime types that will be compressed when using
2019-12-08T20:36:20.143131+00:00 app[web.1]: GZIP compression.
2019-12-08T20:36:20.143134+00:00 app[web.1]: Default: text/html,text/xml,text/plain,text/css,application/json,application/xml,text/javascript,application/javascript
2019-12-08T20:36:20.143136+00:00 app[web.1]: --context-xml
2019-12-08T20:36:20.143138+00:00 app[web.1]: The path to the context xml to use.
2019-12-08T20:36:20.143140+00:00 app[web.1]: --enable-basic-auth
2019-12-08T20:36:20.143142+00:00 app[web.1]: Secure the app with basic auth. Use with --basic-auth-user and
2019-12-08T20:36:20.143144+00:00 app[web.1]: --basic-auth-pw or --tomcat-users-location
2019-12-08T20:36:20.143146+00:00 app[web.1]: Default: false
2019-12-08T20:36:20.143148+00:00 app[web.1]: --enable-client-auth
2019-12-08T20:36:20.143150+00:00 app[web.1]: Specify -Djavax.net.ssl.keyStore and -Djavax.net.ssl.keyStorePassword in
2019-12-08T20:36:20.143151+00:00 app[web.1]: JAVA_OPTS
2019-12-08T20:36:20.143153+00:00 app[web.1]: Default: false
2019-12-08T20:36:20.143155+00:00 app[web.1]: --enable-compression
2019-12-08T20:36:20.143157+00:00 app[web.1]: Enable GZIP compression on responses
2019-12-08T20:36:20.143159+00:00 app[web.1]: Default: false
2019-12-08T20:36:20.143161+00:00 app[web.1]: --enable-naming
2019-12-08T20:36:20.143162+00:00 app[web.1]: Enables JNDI naming
2019-12-08T20:36:20.143165+00:00 app[web.1]: Default: false
2019-12-08T20:36:20.143166+00:00 app[web.1]: --enable-ssl
2019-12-08T20:36:20.143168+00:00 app[web.1]: Specify -Djavax.net.ssl.keyStore, -Djavax.net.ssl.keystoreStorePassword,
2019-12-08T20:36:20.143171+00:00 app[web.1]: -Djavax.net.ssl.trustStore and -Djavax.net.ssl.trustStorePassword in
2019-12-08T20:36:20.143173+00:00 app[web.1]: JAVA_OPTS. Note: should not be used if a reverse proxy is terminating
2019-12-08T20:36:20.143175+00:00 app[web.1]: SSL for you (such as on Heroku)
2019-12-08T20:36:20.143177+00:00 app[web.1]: Default: false
2019-12-08T20:36:20.143179+00:00 app[web.1]: --expand-war-file
2019-12-08T20:36:20.143181+00:00 app[web.1]: Expand the war file and set it as source
2019-12-08T20:36:20.143183+00:00 app[web.1]: Default: true
2019-12-08T20:36:20.143185+00:00 app[web.1]: --expanded-dir-name
2019-12-08T20:36:20.143187+00:00 app[web.1]: The name of the directory the WAR file will be expanded into.
2019-12-08T20:36:20.143189+00:00 app[web.1]: Default: expanded
2019-12-08T20:36:20.143191+00:00 app[web.1]: --help
2019-12-08T20:36:20.143193+00:00 app[web.1]:
2019-12-08T20:36:20.143195+00:00 app[web.1]: --max-threads
2019-12-08T20:36:20.143197+00:00 app[web.1]: Set the maximum number of worker threads
2019-12-08T20:36:20.143200+00:00 app[web.1]: Default: 0
2019-12-08T20:36:20.143202+00:00 app[web.1]: --memcached-transcoder-factory-class
2019-12-08T20:36:20.143204+00:00 app[web.1]: The class name of the factory that creates the transcoder to use for
2019-12-08T20:36:20.143206+00:00 app[web.1]: serializing/deserializing sessions to/from memcached.
2019-12-08T20:36:20.143208+00:00 app[web.1]: --path
2019-12-08T20:36:20.143210+00:00 app[web.1]: The context path
2019-12-08T20:36:20.143212+00:00 app[web.1]: Default: <empty string>
2019-12-08T20:36:20.143214+00:00 app[web.1]: --port
2019-12-08T20:36:20.143216+00:00 app[web.1]: The port that the server will accept http requests on.
2019-12-08T20:36:20.143218+00:00 app[web.1]: Default: 8080
2019-12-08T20:36:20.143220+00:00 app[web.1]: --proxy-base-url
2019-12-08T20:36:20.143222+00:00 app[web.1]: Set proxy URL if tomcat is running behind reverse proxy
2019-12-08T20:36:20.143224+00:00 app[web.1]: Default: <empty string>
2019-12-08T20:36:20.143226+00:00 app[web.1]: --scanBootstrapClassPath
2019-12-08T20:36:20.143228+00:00 app[web.1]: Set jar scanner scan bootstrap classpath.
2019-12-08T20:36:20.143230+00:00 app[web.1]: Default: false
2019-12-08T20:36:20.143232+00:00 app[web.1]: --session-store
2019-12-08T20:36:20.143234+00:00 app[web.1]: Session store to use (valid options are 'memcache' or 'redis')
2019-12-08T20:36:20.143236+00:00 app[web.1]: --session-store-ignore-pattern
2019-12-08T20:36:20.143238+00:00 app[web.1]: Request pattern to not track sessions for. Valid only with memcache
2019-12-08T20:36:20.143240+00:00 app[web.1]: session store. (default is '.*\.(png|gif|jpg|css|js)$'. Has no effect
2019-12-08T20:36:20.143241+00:00 app[web.1]: for 'redis')
2019-12-08T20:36:20.143244+00:00 app[web.1]: Default: .*\.(png|gif|jpg|css|js)$
2019-12-08T20:36:20.143246+00:00 app[web.1]: --session-store-locking-mode
2019-12-08T20:36:20.143247+00:00 app[web.1]: Session locking mode for use with memcache session store. (default is
2019-12-08T20:36:20.143249+00:00 app[web.1]: all. Has no effect for 'redis')
2019-12-08T20:36:20.143251+00:00 app[web.1]: Default: all
2019-12-08T20:36:20.143253+00:00 app[web.1]: --session-store-operation-timeout
2019-12-08T20:36:20.143255+00:00 app[web.1]: Operation timeout for the memcache session store. (default is 5000ms)
2019-12-08T20:36:20.143257+00:00 app[web.1]: Default: 5000
2019-12-08T20:36:20.143279+00:00 app[web.1]: --session-store-pool-size
2019-12-08T20:36:20.143283+00:00 app[web.1]: Pool size of the session store connections (default is 10. Has no effect
2019-12-08T20:36:20.143285+00:00 app[web.1]: for 'memcache')
2019-12-08T20:36:20.143287+00:00 app[web.1]: Default: 10
2019-12-08T20:36:20.143289+00:00 app[web.1]: --session-timeout
2019-12-08T20:36:20.143291+00:00 app[web.1]: The number of minutes of inactivity before a user's session is timed
2019-12-08T20:36:20.143293+00:00 app[web.1]: out.
2019-12-08T20:36:20.143295+00:00 app[web.1]: --shutdown-override
2019-12-08T20:36:20.143296+00:00 app[web.1]: Overrides the default behavior and casues Tomcat to ignore lifecycle
2019-12-08T20:36:20.143299+00:00 app[web.1]: failure events rather than shutting down when they occur.
2019-12-08T20:36:20.143300+00:00 app[web.1]: Default: false
2019-12-08T20:36:20.143303+00:00 app[web.1]: --temp-directory
2019-12-08T20:36:20.143304+00:00 app[web.1]: Define the temp directory, default value: ./target/tomcat.PORT
2019-12-08T20:36:20.143306+00:00 app[web.1]: --tomcat-users-location
2019-12-08T20:36:20.143308+00:00 app[web.1]: Location of the tomcat-users.xml file. (relative to the location of the
2019-12-08T20:36:20.143310+00:00 app[web.1]: webapp-runner jar file)
2019-12-08T20:36:20.143312+00:00 app[web.1]: --uri-encoding
2019-12-08T20:36:20.143314+00:00 app[web.1]: Set the URI encoding to be used for the Connector.
2019-12-08T20:36:20.143316+00:00 app[web.1]: --use-body-encoding-for-uri
2019-12-08T20:36:20.143325+00:00 app[web.1]: Set if the entity body encoding should be used for the URI.
2019-12-08T20:36:20.143327+00:00 app[web.1]: Default: false
2019-12-08T20:36:20.143329+00:00 app[web.1]: -A
2019-12-08T20:36:20.143331+00:00 app[web.1]: Allows setting HTTP connector attributes. For example: -Acompression=on
2019-12-08T20:36:20.143333+00:00 app[web.1]: Syntax: -Akey=value
2019-12-08T20:36:20.143335+00:00 app[web.1]: Default:
2019-12-08T20:36:20.143336+00:00 app[web.1]:
2019-12-08T20:36:20.223662+00:00 heroku[web.1]: State changed from starting to crashed
2019-12-08T20:36:20.204740+00:00 heroku[web.1]: Process exited with status 1
Procfile 取自 Heroku 网站 Heroku
web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war'
Pom 文件
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com/jj</groupId>
<artifactId>hi</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>common</module>
<module>dao</module>
<module>service</module>
<module>web</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals><goal>copy</goal></goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.github.jsimone</groupId>
<artifactId>webapp-runner</artifactId>
<version>9.0.27.0</version>
<destFileName>webapp-runner.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<project.java.version>1.8</project.java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.160</version>
</dependency>
<!-- Servlet API 4.0 for tomcat 9 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.15</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.0-M1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>```
【问题讨论】:
【参考方案1】:您看到的是 webapp-runner 的“帮助”输出。我认为这表明webapp-runner.jar
的参数不正确。
您的Procfile
命令末尾似乎有一个杂散的'
字符。您可能需要删除它。
【讨论】:
以上是关于JAVA tomcat出错的主要内容,如果未能解决你的问题,请参考以下文章
启动tomcat就报错:java.lang.ClassNotFoundException: org.apache.commons.beanutils.Converter