aopalliance-repackaged-2.4.0-b31.jar
asm-debug-all-5.0.4.jar
hk2-api-2.4.0-b31.jar
hk2-locator-2.4.0-b31.jar
hk2-utils-2.4.0-b31.jar
javassist-3.18.1-GA.jar
javax.annotation-api-1.2.jar
javax.inject-2.4.0-b31.jar
javax.servlet-api-3.0.1.jar
javax.ws.rs-api-2.0.1.jar
jaxb-api-2.2.7.jar
jersey-client.jar
jersey-common.jar
jersey-container-servlet-core.jar
jersey-container-servlet.jar
jersey-guava-2.21.jar
jersey-media-jaxb.jar
jersey-server.jar
org.osgi.core-4.2.0.jar
osgi-resource-locator-1.0.1.jar
persistence-api-1.0.jar
validation-api-1.1.0.Final.jar
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>RESTful Jersey Hello World</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Restful</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.lorenzo.rest</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Restful</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
set 21, 2015 12:30:52 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
AVVERTENZA: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Restful' did not find a matching property.
set 21, 2015 12:30:52 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Server version: Apache Tomcat/7.0.64
set 21, 2015 12:30:52 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Server built: Aug 19 2015 17:18:06 UTC
set 21, 2015 12:30:52 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Server number: 7.0.64.0
set 21, 2015 12:30:52 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: OS Name: Windows XP
set 21, 2015 12:30:52 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: OS Version: 5.1
set 21, 2015 12:30:52 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Architecture: x86
set 21, 2015 12:30:52 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Java Home: C:\Programmi\Java\jdk1.8.0_60\jre
set 21, 2015 12:30:52 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: JVM Version: 1.8.0_60-b27
set 21, 2015 12:30:52 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: JVM Vendor: Oracle Corporation
set 21, 2015 12:30:52 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: CATALINA_BASE: C:\Documents and Settings\gcappella\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2
set 21, 2015 12:30:52 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: CATALINA_HOME: C:\Programmi\Apache Software Foundation\Tomcat 7.0
set 21, 2015 12:30:52 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Command line argument: -Dcatalina.base=C:\Documents and Settings\gcappella\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2
set 21, 2015 12:30:52 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Command line argument: -Dcatalina.home=C:\Programmi\Apache Software Foundation\Tomcat 7.0
set 21, 2015 12:30:52 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Command line argument: -Dwtp.deploy=C:\Documents and Settings\gcappella\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps
set 21, 2015 12:30:52 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Command line argument: -Djava.endorsed.dirs=C:\Programmi\Apache Software Foundation\Tomcat 7.0\endorsed
set 21, 2015 12:30:52 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Command line argument: -Dfile.encoding=Cp1252
set 21, 2015 12:30:52 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFORMAZIONI: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Programmi\Java\jdk1.8.0_60\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Programmi/Java/jdk1.8.0_60/bin/../jre/bin/client;C:/Programmi/Java/jdk1.8.0_60/bin/../jre/bin;C:/Programmi/Java/jdk1.8.0_60/bin/../jre/lib/i386;C:\Programmi\Java\jdk1.8.0_60\bin;C:\oracle\ora92\bin;C:\Programmi\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programmi\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;C:\Programmi\Wave Systems Corp\Gemalto\Access Client\v5\;C:\Programmi\Gemplus\GemSafe Libraries\BIN;C:\Programmi\File comuni\Roxio Shared\DLLShared\;C:\Programmi\File comuni\Roxio Shared\9.0\DLLShared\;C:\Programmi\ZipGenius 6\;c:\Programmi\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Serena\Dimensions 14.1\CM\prog;C:\Programmi\Microsoft\Web Platform Installer\;C:\Programmi\Git\cmd;C:\Programmi\Git\mingw32\bin;C:\Programmi\Git\usr\bin;ANT_HOME%\bin;C:\Programmi\nodejs\;C:\Documents and Settings\gcappella\Dati applicazioni\npm;C:\eclipse;;.
set 21, 2015 12:30:52 PM org.apache.coyote.AbstractProtocol init
INFORMAZIONI: Initializing ProtocolHandler ["http-bio-8080"]
set 21, 2015 12:30:52 PM org.apache.coyote.AbstractProtocol init
INFORMAZIONI: Initializing ProtocolHandler ["ajp-bio-8009"]
set 21, 2015 12:30:52 PM org.apache.catalina.startup.Catalina load
INFORMAZIONI: Initialization processed in 835 ms
set 21, 2015 12:30:52 PM org.apache.catalina.core.StandardService startInternal
INFORMAZIONI: Starting service Catalina
set 21, 2015 12:30:52 PM org.apache.catalina.core.StandardEngine startInternal
INFORMAZIONI: Starting Servlet Engine: Apache Tomcat/7.0.64
set 21, 2015 12:30:53 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFORMAZIONI: validateJarFile(C:\Documents and Settings\gcappella\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps\Restful\WEB-INF\lib\javax.servlet-api-3.0.1.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
set 21, 2015 12:30:54 PM org.apache.catalina.startup.TldConfig execute
INFORMAZIONI: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
set 21, 2015 12:30:55 PM org.apache.coyote.AbstractProtocol start
INFORMAZIONI: Starting ProtocolHandler ["http-bio-8080"]
set 21, 2015 12:30:55 PM org.apache.coyote.AbstractProtocol start
INFORMAZIONI: Starting ProtocolHandler ["ajp-bio-8009"]
set 21, 2015 12:30:55 PM org.apache.catalina.startup.Catalina start
INFORMAZIONI: Server startup in 3587 ms
所以现在我想我的问题一定是在XML中...它有什么问题???
直到Jersey 2.6,您可以使用Java6(JDK1.6)运行它。
在版本2.6+之后,您需要(JDK1.7)Java7。
供参考:这是我的from项目。这是一个功能齐全的项目,请参阅下文。我使用的是Jersey 2.6,因为我的生产服务器有Java6,所以我不得不将其从Jersey 2.17降低到2.6。
localhost:8080/OrderStatusWebService/rest/test/hello-world
web.xml
<?xml version="1.0" encoding="UTF-8" ?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>Order Status REST WebService</display-name>
<servlet>
<servlet-name>jersey-serlvet</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer
</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.xxx.orderstatus.config.OrderStatusConfig</param-value>
</init-param>
<init-param>
<param-name>jersey.config.server.provider.scanning.recursive</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jersey-serlvet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
这是一个示例Webservice类
package com.xxx.orderstatus.webservice;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
@Path("/test")
public class TestWebService
{
@GET
@Path("/hello-world")
public Response checkAuth(@QueryParam("userId") String userId) {
return Response.status(200).entity("Hello").build();
}
}
因为我的项目是一个Maven项目,所以这是我的pom.xml。请注意属性
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxx.orderstatus</groupId>
<artifactId>OrderStatusWebService</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>OrderStatusWebService Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<jdk.version>1.6</jdk.version>
<jstl.version>1.2</jstl.version>
<jcl-over-slf4j.version>1.7.5</jcl-over-slf4j.version>
</properties>
<repositories>
<repository>
<id>codelds</id>
<url>https://code.lds.org/nexus/content/groups/main-repo</url>
</repository>
<repository>
<id>maven2-repository.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
<repository>
<id>snapshot-repository.java.net</id>
<name>Java.net Snapshot Repository for Maven</name>
<url>https://maven.java.net/content/repositories/snapshots/</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<!-- My Dependencies START -->
<!-- Jersey -->
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<!-- if your container implements Servlet API older than 3.0, use "jersey-container-servlet-core" -->
<artifactId>jersey-container-servlet</artifactId>
<version>2.6</version>
</dependency>
<!-- JSTL -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
<!-- JDBC -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
<!-- GSON -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
<!-- These jars dont' come by default with the latest Jerser Server Container
Jars -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<!-- Apache Commons Codec -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<!-- SLF4j and Log4j Libs -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.12</version>
</dependency>
<!-- Apache Commons IO -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<!-- Multipart Dependencies -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>2.6</version>
</dependency>
<!-- Commons DBCP 1.4 Starts -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<!-- My Dependencies ENDS -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>OrderStatusWebService</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
问题内容: 我正在使用Jersey 2.0(我从http://repo1.maven.org/maven2/org/glassfish/jersey/bundles/jaxrs- ri/2.5/jaxrs- ri-2.5.zip 下载)开发了一项休息服务。正在使用Tomcat 7.0.47。我从Eclipse运行Tomcat,而我的机器是Mac。 我正在使用Eclipse工具生成WAR并部署服务。
我使用泽西和我有以下两个RESTful方法: 和 在我添加第二种方法之前,一切都很好。但是,我的tomcat现在给出了以下错误。 有什么线索吗?
我的第一个Web应用程序有问题。我使用IntelliJ作为IDE,Tomcat作为WebServer。我尝试访问的每个servlet都会抛出一个404错误。即使我拷贝一些youtube教程,这似乎像一个魅力一样起作用。 表单中的按钮将我发送到:http://localhost:8080/iubhquiz/login
问题内容: 我们正在Tomcat 6和Apache mod_proxy 2.2.3上运行一个Web应用程序。看到很多502错误,如下所示: 错误的网关!代理服务器从上游服务器收到无效响应。 代理服务器无法处理GET /the/page.do请求。 原因:从远程服务器读取错误 如果您认为这是服务器错误,请与网站管理员联系。 错误502 Tomcat具有大量线程,因此不受线程限制。我们正在通过JMet
这是我的gradle档案: 在添加了Atmospher-Jursey之后,我得到了以下错误:
有人能帮我做这个吗? 我不知道错误是什么,也不知道我应该如何修复它。任何帮助都很感激