我在tomcat webserver上部署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是部署战争的一部分。
有人可以建议这种非法访问是什么以及我如何解决它。
感谢。
答案 0 :(得分:1)
我想你混合了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-stackoverflow/tree/master/restlet/test-restlet-servlet。
希望它能帮到你, 亨利