大家好,我有一个问题,我不能在JBOSS 7.0.1服务器上部署restful服务,它看起来是已部署的,但问题是,当我在服务中通过post尝试它时,我得到404错误。。。。我不知道在这种情况下该怎么办,在同一台服务器上的其他web项目中,我没有遇到任何问题。
这是一个从SVN存储库导入的项目。
我发帖子的链接是http://localhost:8080/Project-战争/服务示例/测试
我有三个项目:
服务器日志
14:45:42,850 INFORMACIÓN [org.jboss.modules] JBoss Modules version 1.1.5.GA
14:45:43,131 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
14:45:43,293 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.0.Final "Thunder" starting
14:45:44,258 INFO [org.xnio] XNIO Version 3.0.3.GA
14:45:44,258 INFO [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
14:45:44,267 INFO [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
14:45:44,282 INFO [org.jboss.remoting] JBoss Remoting version 3.2.2.GA
14:45:44,298 INFO [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers
14:45:44,313 INFO [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem
14:45:44,345 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
14:45:44,376 INFO [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem
14:45:44,376 INFO [org.jboss.as.security] (MSC service thread 1-3) JBAS013100: Current PicketBox version=4.0.6.final
14:45:44,392 INFO [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem
14:45:44,413 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem
14:45:44,425 INFO [org.jboss.as.connector] (MSC service thread 1-4) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.7.Final)
14:45:44,431 INFO [org.jboss.as.naming] (MSC service thread 1-1) JBAS011802: Starting Naming Service
14:45:44,439 INFO [org.jboss.as.mail.extension] (MSC service thread 1-4) JBAS015400: Bound mail session [java:jboss/mail/Default]
14:45:44,558 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
14:45:44,766 INFO [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-4) JBoss Web Services - Stack CXF Server 4.0.1.GA
14:45:44,839 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class com.microsoft.sqlserver.jdbc.SQLServerDriver (version 4.0)
14:45:44,864 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
14:45:45,232 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-1) Arrancando Coyote HTTP/1.1 en puerto http--0.0.0.0-8080
14:45:45,232 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-2) Arrancando Coyote HTTP/1.1 en puerto http--0.0.0.0-8443
14:45:45,393 INFO [org.jboss.as.remoting] (MSC service thread 1-6) JBAS017100: Listening on /0.0.0.0:4447
14:45:45,395 INFO [org.jboss.as.remoting] (MSC service thread 1-5) JBAS017100: Listening on localhost/127.0.0.1:9999
14:45:45,397 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-2) JBAS015012: Started FileSystemDeploymentService for directory C:\jboss-as-7.1.0.Final\standalone\deployments
14:45:45,401 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015014: Re-attempting failed deployment Project-EAR.ear
14:45:45,423 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found Project-EAR.ear in deployment directory. To trigger deployment create a file called Project-EAR.ear.dodeploy
14:45:45,626 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "Project-EAR.ear"
14:46:03,066 WARN [org.jboss.as.server.deployment] (MSC service thread 1-3) Class Path entry jaxb-api.jar in "/C:/jboss-as-7.1.0.Final/standalone/deployments/Project-EAR.ear/jaxb-impl-2.2.5.jar" does not point to a valid jar for a Class-Path reference.
14:46:03,068 WARN [org.jboss.as.server.deployment] (MSC service thread 1-3) Class Path entry activation.jar in "/C:/jboss-as-7.1.0.Final/standalone/deployments/Project-EAR.ear/jaxb-impl-2.2.5.jar" does not point to a valid jar for a Class-Path reference.
14:46:03,071 WARN [org.jboss.as.server.deployment] (MSC service thread 1-3) Class Path entry jsr173_1.0_api.jar in "/C:/jboss-as-7.1.0.Final/standalone/deployments/Project-EAR.ear/jaxb-impl-2.2.5.jar" does not point to a valid jar for a Class-Path reference.
14:46:03,074 WARN [org.jboss.as.server.deployment] (MSC service thread 1-3) Class Path entry jaxb1-impl.jar in "/C:/jboss-as-7.1.0.Final/standalone/deployments/Project-EAR.ear/jaxb-impl-2.2.5.jar" does not point to a valid jar for a Class-Path reference.
14:46:03,077 WARN [org.jboss.as.server.deployment] (MSC service thread 1-3) Class Path entry jaxb-api.jar in "/C:/jboss-as-7.1.0.Final/standalone/deployments/Project-EAR.ear/jaxb-xjc-2.2.5.jar" does not point to a valid jar for a Class-Path reference.
14:46:03,079 WARN [org.jboss.as.server.deployment] (MSC service thread 1-3) Class Path entry jaxb-impl.jar in "/C:/jboss-as-7.1.0.Final/standalone/deployments/Project-EAR.ear/jaxb-xjc-2.2.5.jar" does not point to a valid jar for a Class-Path reference.
14:46:03,082 WARN [org.jboss.as.server.deployment] (MSC service thread 1-3) Class Path entry jsr173_1.0_api.jar in "/C:/jboss-as-7.1.0.Final/standalone/deployments/Project-EAR.ear/jaxb-xjc-2.2.5.jar" does not point to a valid jar for a Class-Path reference.
14:46:03,085 WARN [org.jboss.as.server.deployment] (MSC service thread 1-3) Class Path entry activation.jar in "/C:/jboss-as-7.1.0.Final/standalone/deployments/Project-EAR.ear/jaxb-xjc-2.2.5.jar" does not point to a valid jar for a Class-Path reference.
14:46:03,089 WARN [org.jboss.as.server.deployment] (MSC service thread 1-3) Class Path entry activation.jar in "/C:/jboss-as-7.1.0.Final/standalone/deployments/Project-EAR.ear/mail-1.4.jar" does not point to a valid jar for a Class-Path reference.
14:46:03,097 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "Project-WAR.war"
14:46:03,381 INFO [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016002: Processing weld deployment Project-EAR.ear
14:46:03,434 INFO [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016002: Processing weld deployment Project-WAR.war
14:46:03,450 INFO [org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016005: Starting Services for CDI deployment: Project-EAR.ear
14:46:03,483 INFO [org.jboss.weld.Version] (MSC service thread 1-4) WELD-000900 1.1.5 (AS71)
14:46:03,516 INFO [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016008: Starting weld service for deployment Project-EAR.ear
14:46:03,990 INFO [org.jboss.web] (MSC service thread 1-1) JBAS018210: Registering web context: /Project-WAR
14:46:03,992 INFO [org.jboss.as] (MSC service thread 1-4) JBAS015874: JBoss AS 7.1.0.Final "Thunder" started in 21819ms - Started 238 of 327 services (76 services are passive or on-demand)
14:46:04,035 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "Project-EAR.ear"
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>Restful Web Application</display-name>
</web-app>
应用程序配置。JAVA
package com.services.rest;
import java.util.Set;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("")
public class ApplicationConfig extends Application {
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> resources = new java.util.HashSet<Class<?>>();
addRestResourceClasses(resources);
return resources;
}
private void addRestResourceClasses(Set<Class<?>> resources) {
resources.add(ServiceExample.class);
}
}
你必须在网上添加以下内容。xml。它看起来像网络。xml有点空。应该是这样的。
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>Restful Web Application</display-name>
<servlet>
<servlet-name>Jersey REST Service</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.services.rest</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
您还应该有一个资源类,它应该至少有一个这样的终端。下面我提供一个例子。
@GET
@Produces(MediaType.TEXT_PLAIN)
public String sayHello() {
return "Hello World";
}
我一直试图在tomcat上部署一个简单的Web服务,但我没有成功,它总是返回我404错误。 我使用了这个例子中的代码 http://www.mkyong.com/webservices/jax-ws/deploy-jax-ws-web-services-on-tomcat/ 但无法使用war,因为我在服务器中设置了上下文信息。xml 因此,我使用了与mkyong相同的代码,但在部署时遵循以下步骤:
使用jersey编写JAXRS服务并部署在tomcat上。应用子类 资源类 在 WEB-INF/lib 中添加了除 javax.servlet-api-3.0.1 之外的所有球衣罐子.jar并点击网址 但是得到404错误。未将任何web.xml指定为子类应用程序。
我试图使一个API工作在springstart但是当我输入请求:http://localhost:8080/employee/all我得到这个结果: 它是一个经典的服务,包含一个模型、一个服务、一个存储库、一个映射器和一个异常(如果没有员工),使用的数据库是sql中的实体,如下所示 服务: 仓库 模型 制图员 例外 波姆。xml
你好,作为角2学习项目的一部分,我正在创建一个测试应用程序。 我试图急切地加载一个名为的模块,但是,出现以下错误: 错误:(SystemJS)XHR错误(404未找到)加载http://localhost:3000/app/core.js错误:XHR错误(未找到404)加载http://localhost:3000/app/core.js在XMLHttpRequest。wrapFn[as _onr
我在我的本地主机上开发了一个laravel应用程序,运行非常好。我正试图使用Ubuntu 20.04上的nginx将其部署到AWS Lightsail实例上。我已经上传了我的laravel应用程序,并将nginx根目录更改为laravelapp/public。 主索引页(着陆页)工作正常,但我的路线都不工作(即 /login, /about等)。当我试图访问任何路线时,我得到一个404未找到错误。
我已经跟随杰弗里·韦的教程。 教程: https://laracasts.com/series/real-time-laravel-with-socket-io/episodes/1 null 我尝试使用