在 tomcat 上部署基于 restlet 的应用程序时出现问题
Issue in deploying restlet based application on tomcat
我在 tomcat 网络服务器上部署 restlet 应用程序时遇到问题。
我可以直接从 eclipse 运行 应用程序,但是当我在 tomcat 上部署时,我遇到如下问题。
May 10, 2015 10:04:32 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load org.simpleframework.transport.connect.Connection.
The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at org.restlet.engine.Engine.registerHelper(Engine.java:781)
at org.restlet.engine.Engine.registerHelpers(Engine.java:813)
at org.restlet.engine.Engine.registerHelpers(Engine.java:853)
at org.restlet.engine.Engine.discoverConnectors(Engine.java:544)
at org.restlet.engine.Engine.<init>(Engine.java:379)
at org.restlet.engine.Engine.register(Engine.java:301)
at org.restlet.engine.Engine.register(Engine.java:290)
at org.restlet.engine.Engine.getInstance(Engine.java:199)
at org.restlet.data.Method.<init>(Method.java:337)
at org.restlet.data.Method.<init>(Method.java:396)
at org.restlet.data.Method.<init>(Method.java:361)
at org.restlet.data.Method.<clinit>(Method.java:48)
at org.restlet.resource.ClientResource.<init>(ClientResource.java:396)
May 10, 2015 10:04:32 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load org.simpleframework.transport.connect.Connection. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at org.restlet.engine.Engine.registerHelper(Engine.java:781)
at org.restlet.engine.Engine.registerHelpers(Engine.java:813)
at org.restlet.engine.Engine.registerHelpers(Engine.java:853)
at org.restlet.engine.Engine.discoverConnectors(Engine.java:544)
at org.restlet.engine.Engine.<init>(Engine.java:379)
at org.restlet.engine.Engine.register(Engine.java:301)
at org.restlet.engine.Engine.register(Engine.java:290)
at org.restlet.engine.Engine.getInstance(Engine.java:199)
at org.restlet.data.Method.<init>(Method.java:337)
at org.restlet.data.Method.<init>(Method.java:396)
at org.restlet.data.Method.<init>(Method.java:361)
at org.restlet.data.Method.<clinit>(Method.java:48)
at org.restlet.resource.ClientResource.<init>(ClientResource.java:396)
INFO: Illegal access: this web application instance has been stopped already. Could not load java.net.InetSocketAddress. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at org.restlet.engine.Engine.registerHelper(Engine.java:781)
at org.restlet.engine.Engine.registerHelpers(Engine.java:813)
at org.restlet.engine.Engine.registerHelpers(Engine.java:853)
at org.restlet.engine.Engine.discoverConnectors(Engine.java:544)
at org.restlet.engine.Engine.<init>(Engine.java:379)
at org.restlet.engine.Engine.register(Engine.java:301)
at org.restlet.engine.Engine.register(Engine.java:290)
at org.restlet.engine.Engine.getInstance(Engine.java:199)
at org.restlet.data.Method.<init>(Method.java:337)
at org.restlet.data.Method.<init>(Method.java:396)
at org.restlet.data.Method.<init>(Method.java:361)
at org.restlet.data.Method.<clinit>(Method.java:48)
at org.restlet.resource.ClientResource.<init>(ClientResource.java:396)
INFO: Illegal access: this web application instance has been stopped already. Could not load org.restlet.data.Protocol. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.restlet.ext.simple.HttpServerHelper.<init>(HttpServerHelper.java:57)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.restlet.engine.Engine.registerHelper(Engine.java:781)
at org.restlet.engine.Engine.registerHelpers(Engine.java:813)
at org.restlet.engine.Engine.registerHelpers(Engine.java:853)
at org.restlet.engine.Engine.discoverConnectors(Engine.java:544)
at org.restlet.engine.Engine.<init>(Engine.java:379)
at org.restlet.engine.Engine.register(Engine.java:301)
at org.restlet.engine.Engine.register(Engine.java:290)
at org.restlet.engine.Engine.getInstance(Engine.java:199)
at org.restlet.data.Method.<init>(Method.java:337)
at org.restlet.data.Method.<init>(Method.java:396)
at org.restlet.data.Method.<init>(Method.java:361)
at org.restlet.data.Method.<clinit>(Method.java:48)
at org.restlet.resource.ClientResource.<init>(ClientResource.java:396)
INFO: Illegal access: this web application instance has been stopped already. Could not load java.util.logging.Logger. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.restlet.engine.log.LoggerFacade.getLogger(LoggerFacade.java:117)
at org.restlet.engine.Engine.getLogger(Engine.java:255)
at org.restlet.Context.getCurrentLogger(Context.java:81)
at org.restlet.engine.Engine.registerHelper(Engine.java:785)
at org.restlet.engine.Engine.registerHelpers(Engine.java:813)
at org.restlet.engine.Engine.registerHelpers(Engine.java:853)
at org.restlet.engine.Engine.discoverConnectors(Engine.java:544)
at org.restlet.engine.Engine.<init>(Engine.java:379)
at org.restlet.engine.Engine.register(Engine.java:301)
at org.restlet.engine.Engine.register(Engine.java:290)
at org.restlet.engine.Engine.getInstance(Engine.java:199)
at org.restlet.data.Method.<init>(Method.java:337)
at org.restlet.data.Method.<init>(Method.java:396)
at org.restlet.data.Method.<init>(Method.java:361)
at org.restlet.data.Method.<clinit>(Method.java:48)
at org.restlet.resource.ClientResource.<init>(ClientResource.java:396)
我检查了一下 simple.jar 是部署的 war 的一部分。
谁能告诉我这个非法访问是什么以及我该如何解决它。
谢谢。
我猜你混合了 Restlet 的独立和嵌入式方法:
- 使用独立方法,您需要一个服务器连接器,如 Simple framework 或 Jetty,Restlet 负责管理它们(启动、停止)
- 使用嵌入式方法,Restlet 不再需要管理它。您启动您的 servlet 引擎,请求将通过其适配器 servlet 委托给 Restlet。
您是否尝试在 Eclipse 中使用独立方法或嵌入式方法(例如使用 WTP)?
这是一个允许您创建嵌入式项目的 Maven 文件:
<?xml version="1.0" encoding="UTF-8"?>
<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>org.restlet</groupId>
<artifactId>restlet-war</artifactId>
<name>${project.artifactId}</name>
<packaging>war</packaging>
<version>1.0.0-snapshot</version>
<properties>
<java-version>1.7</java-version>
<restlet-version>2.3.1</restlet-version>
<wtp-version>2.0</wtp-version>
</properties>
<dependencies>
<dependency>
<groupId>org.restlet.jee</groupId>
<artifactId>org.restlet</artifactId>
<version>${restlet-version}</version>
</dependency>
<dependency>
<groupId>org.restlet.jee</groupId>
<artifactId>org.restlet.ext.servlet</artifactId>
<version>${restlet-version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>maven-restlet</id>
<name>Public online Restlet repository</name>
<url>http://maven.restlet.com</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<wtpapplicationxml>true</wtpapplicationxml>
<wtpversion>${wtp-version}</wtpversion>
</configuration>
</plugin>
</plugins>
</build>
</project>
可以使用命令 mvn eclipse:eclipse
.
为 Eclipse 初始化项目
您可以在这个地址找到一个完整的简单项目:https://github.com/templth/restlet-Whosebug/tree/master/restlet/test-restlet-servlet。
希望对您有所帮助,
蒂埃里
我在 tomcat 网络服务器上部署 restlet 应用程序时遇到问题。
我可以直接从 eclipse 运行 应用程序,但是当我在 tomcat 上部署时,我遇到如下问题。
May 10, 2015 10:04:32 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load org.simpleframework.transport.connect.Connection.
The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at org.restlet.engine.Engine.registerHelper(Engine.java:781)
at org.restlet.engine.Engine.registerHelpers(Engine.java:813)
at org.restlet.engine.Engine.registerHelpers(Engine.java:853)
at org.restlet.engine.Engine.discoverConnectors(Engine.java:544)
at org.restlet.engine.Engine.<init>(Engine.java:379)
at org.restlet.engine.Engine.register(Engine.java:301)
at org.restlet.engine.Engine.register(Engine.java:290)
at org.restlet.engine.Engine.getInstance(Engine.java:199)
at org.restlet.data.Method.<init>(Method.java:337)
at org.restlet.data.Method.<init>(Method.java:396)
at org.restlet.data.Method.<init>(Method.java:361)
at org.restlet.data.Method.<clinit>(Method.java:48)
at org.restlet.resource.ClientResource.<init>(ClientResource.java:396)
May 10, 2015 10:04:32 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load org.simpleframework.transport.connect.Connection. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at org.restlet.engine.Engine.registerHelper(Engine.java:781)
at org.restlet.engine.Engine.registerHelpers(Engine.java:813)
at org.restlet.engine.Engine.registerHelpers(Engine.java:853)
at org.restlet.engine.Engine.discoverConnectors(Engine.java:544)
at org.restlet.engine.Engine.<init>(Engine.java:379)
at org.restlet.engine.Engine.register(Engine.java:301)
at org.restlet.engine.Engine.register(Engine.java:290)
at org.restlet.engine.Engine.getInstance(Engine.java:199)
at org.restlet.data.Method.<init>(Method.java:337)
at org.restlet.data.Method.<init>(Method.java:396)
at org.restlet.data.Method.<init>(Method.java:361)
at org.restlet.data.Method.<clinit>(Method.java:48)
at org.restlet.resource.ClientResource.<init>(ClientResource.java:396)
INFO: Illegal access: this web application instance has been stopped already. Could not load java.net.InetSocketAddress. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at org.restlet.engine.Engine.registerHelper(Engine.java:781)
at org.restlet.engine.Engine.registerHelpers(Engine.java:813)
at org.restlet.engine.Engine.registerHelpers(Engine.java:853)
at org.restlet.engine.Engine.discoverConnectors(Engine.java:544)
at org.restlet.engine.Engine.<init>(Engine.java:379)
at org.restlet.engine.Engine.register(Engine.java:301)
at org.restlet.engine.Engine.register(Engine.java:290)
at org.restlet.engine.Engine.getInstance(Engine.java:199)
at org.restlet.data.Method.<init>(Method.java:337)
at org.restlet.data.Method.<init>(Method.java:396)
at org.restlet.data.Method.<init>(Method.java:361)
at org.restlet.data.Method.<clinit>(Method.java:48)
at org.restlet.resource.ClientResource.<init>(ClientResource.java:396)
INFO: Illegal access: this web application instance has been stopped already. Could not load org.restlet.data.Protocol. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.restlet.ext.simple.HttpServerHelper.<init>(HttpServerHelper.java:57)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.restlet.engine.Engine.registerHelper(Engine.java:781)
at org.restlet.engine.Engine.registerHelpers(Engine.java:813)
at org.restlet.engine.Engine.registerHelpers(Engine.java:853)
at org.restlet.engine.Engine.discoverConnectors(Engine.java:544)
at org.restlet.engine.Engine.<init>(Engine.java:379)
at org.restlet.engine.Engine.register(Engine.java:301)
at org.restlet.engine.Engine.register(Engine.java:290)
at org.restlet.engine.Engine.getInstance(Engine.java:199)
at org.restlet.data.Method.<init>(Method.java:337)
at org.restlet.data.Method.<init>(Method.java:396)
at org.restlet.data.Method.<init>(Method.java:361)
at org.restlet.data.Method.<clinit>(Method.java:48)
at org.restlet.resource.ClientResource.<init>(ClientResource.java:396)
INFO: Illegal access: this web application instance has been stopped already. Could not load java.util.logging.Logger. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.restlet.engine.log.LoggerFacade.getLogger(LoggerFacade.java:117)
at org.restlet.engine.Engine.getLogger(Engine.java:255)
at org.restlet.Context.getCurrentLogger(Context.java:81)
at org.restlet.engine.Engine.registerHelper(Engine.java:785)
at org.restlet.engine.Engine.registerHelpers(Engine.java:813)
at org.restlet.engine.Engine.registerHelpers(Engine.java:853)
at org.restlet.engine.Engine.discoverConnectors(Engine.java:544)
at org.restlet.engine.Engine.<init>(Engine.java:379)
at org.restlet.engine.Engine.register(Engine.java:301)
at org.restlet.engine.Engine.register(Engine.java:290)
at org.restlet.engine.Engine.getInstance(Engine.java:199)
at org.restlet.data.Method.<init>(Method.java:337)
at org.restlet.data.Method.<init>(Method.java:396)
at org.restlet.data.Method.<init>(Method.java:361)
at org.restlet.data.Method.<clinit>(Method.java:48)
at org.restlet.resource.ClientResource.<init>(ClientResource.java:396)
我检查了一下 simple.jar 是部署的 war 的一部分。
谁能告诉我这个非法访问是什么以及我该如何解决它。
谢谢。
我猜你混合了 Restlet 的独立和嵌入式方法:
- 使用独立方法,您需要一个服务器连接器,如 Simple framework 或 Jetty,Restlet 负责管理它们(启动、停止)
- 使用嵌入式方法,Restlet 不再需要管理它。您启动您的 servlet 引擎,请求将通过其适配器 servlet 委托给 Restlet。
您是否尝试在 Eclipse 中使用独立方法或嵌入式方法(例如使用 WTP)?
这是一个允许您创建嵌入式项目的 Maven 文件:
<?xml version="1.0" encoding="UTF-8"?>
<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>org.restlet</groupId>
<artifactId>restlet-war</artifactId>
<name>${project.artifactId}</name>
<packaging>war</packaging>
<version>1.0.0-snapshot</version>
<properties>
<java-version>1.7</java-version>
<restlet-version>2.3.1</restlet-version>
<wtp-version>2.0</wtp-version>
</properties>
<dependencies>
<dependency>
<groupId>org.restlet.jee</groupId>
<artifactId>org.restlet</artifactId>
<version>${restlet-version}</version>
</dependency>
<dependency>
<groupId>org.restlet.jee</groupId>
<artifactId>org.restlet.ext.servlet</artifactId>
<version>${restlet-version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>maven-restlet</id>
<name>Public online Restlet repository</name>
<url>http://maven.restlet.com</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<wtpapplicationxml>true</wtpapplicationxml>
<wtpversion>${wtp-version}</wtpversion>
</configuration>
</plugin>
</plugins>
</build>
</project>
可以使用命令 mvn eclipse:eclipse
.
您可以在这个地址找到一个完整的简单项目:https://github.com/templth/restlet-Whosebug/tree/master/restlet/test-restlet-servlet。
希望对您有所帮助, 蒂埃里