이 코드는 webdynamic oproject를 만들었다. fllowing 클래스, jars와 web.xml 파일을 추가했는데, warfly 파일을 export했다. stadalone> 배포 및 서버를 실행했지만 작동하지 않습니다 im serching dor 솔루션 감사합니다! 내 user.java 클래스나는 자바에서 deploiment 편안한 WS에 문제가있다. 내가 야생 플라이를 사용 중이다.
package com.TP6;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "user")
public class User implements Serializable {
private static final long serialVersionUID = 1L;
private int id;
private String name;
private String profession;
public User(){}
public User(int id, String name, String profession){
this.id = id;
this.name = name;
this.profession = profession;
}
public int getId() {
return id;
}
@XmlElement
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
@XmlElement
public void setName(String name) {
this.name = name;
}
public String getProfession() {
return profession;
}
@XmlElement
public void setProfession(String profession) {
this.profession = profession;
}
}
내 UserDaojava 등급 :
package com.TP6;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.List;
public class UserDao {
public List<User> getAllUsers(){
List<User> userList = null;
try {
File file = new File("Users.dat");
if (!file.exists()) {
User user = new User(1, "Mariem", "Student");
userList = new ArrayList<User>();
userList.add(user);
saveUserList(userList);
}
else{
FileInputStream fis = new FileInputStream(file);
ObjectInputStream ois = new ObjectInputStream(fis);
userList = (List<User>) ois.readObject();
ois.close();
}
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return userList;
}
private void saveUserList(List<User> userList){
try {
File file = new File("Users.dat");
FileOutputStream fos;
fos = new FileOutputStream(file);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(userList);
oos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
내 UserService.java 등급 :
package com.TP6 ;
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("/UserService")
public class UserService {
UserDao userDao = new UserDao();
@GET
@Path("/users")
@Produces(MediaType.APPLICATION_XML)
public List<User> getUsers(){
return userDao.getAllUsers();
}
}
내 web.xml 파일 :
<?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>UserManagment</display-name>
<servlet>
<servlet-name>Jersey RESTful Application</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.TP6</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Jersey RESTful Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
이것은 콘솔입니다 :
13:32:59,769 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.0.Final
13:33:00,117 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.0.Final
13:33:00,207 INFO [org.jboss.as] (MSC service thread 1-6) JBAS015899: WildFly 8.0.0.Final "WildFly" starting
13:33:01,817 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found UserManagment.war in deployment directory. To trigger deployment create a file called UserManagment.war.dodeploy
13:33:01,845 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
13:33:01,872 INFO [org.xnio] (MSC service thread 1-8) XNIO version 3.2.0.Final
13:33:01,894 INFO [org.xnio.nio] (MSC service thread 1-8) XNIO NIO Implementation Version 3.2.0.Final
13:33:02,102 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 49) JBAS017502: Undertow 1.0.0.Final starting
13:33:02,117 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 33) JBAS010280: Activating Infinispan subsystem.
13:33:02,145 INFO [org.jboss.as.connector.logging] (MSC service thread 1-2) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.3.Final)
13:33:02,151 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 39) JBAS012615: Activated the following JSF Implementations: [main]
13:33:02,155 INFO [org.jboss.as.security] (ServerService Thread Pool -- 46) JBAS013171: Activating Security Subsystem
13:33:02,159 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 50) JBAS015537: Activating WebServices Extension
13:33:02,161 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 41) JBAS011800: Activating Naming Subsystem
13:33:02,163 INFO [org.wildfly.extension.undertow] (MSC service thread 1-5) JBAS017502: Undertow 1.0.0.Final starting
13:33:02,183 INFO [org.jboss.as.security] (MSC service thread 1-3) JBAS013170: Current PicketBox version=4.0.20.Final
13:33:02,306 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 28) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
13:33:02,320 INFO [org.jboss.as.naming] (MSC service thread 1-6) JBAS011802: Starting Naming Service
13:33:02,322 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-5) JBAS010417: Started Driver service with driver-name = h2
13:33:02,325 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 28) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
13:33:02,326 INFO [org.jboss.as.mail.extension] (MSC service thread 1-5) JBAS015400: Bound mail session [java:jboss/mail/Default]
13:33:02,327 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) JBAS010417: Started Driver service with driver-name = mysql
13:33:02,357 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 49) JBAS017527: Creating file handler for path C:\Users\Emel\wildfly-8.0.0.Final/welcome-content
13:33:02,421 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017525: Started server default-server.
13:33:02,532 INFO [org.jboss.remoting] (MSC service thread 1-8) JBoss Remoting version 4.0.0.Final
13:33:02,742 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017531: Host default-host starting
13:33:02,897 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010400: Bound data source [java:/DsBibliotheque]
13:33:02,910 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-7) JBAS010400: Bound data source [java:/DsBanque]
13:33:03,135 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876: Starting deployment of "UserManagment.war" (runtime-name: "UserManagment.war")
13:33:03,142 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-7) JBAS015012: Started FileSystemDeploymentService for directory C:\Users\Emel\wildfly-8.0.0.Final\standalone\deployments
13:33:03,263 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) JBAS017519: Undertow HTTP listener default listening on localhost/127.0.0.1:8180
13:33:03,480 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
13:33:03,555 INFO [org.hibernate.validator.internal.util.Version] (MSC service thread 1-3) HV000001: Hibernate Validator 5.0.3.Final
13:33:03,651 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."UserManagment.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."UserManagment.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "UserManagment.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.8.0_91]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.8.0_91]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_91]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer from [Module "deployment.UserManagment.war:main" from Service Module Loader]
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.checkDeclaredApplicationClassAsServlet(JaxrsScanningProcessor.java:292)
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scanWebDeployment(JaxrsScanningProcessor.java:154)
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:105)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.0.0.Final.jar:8.0.0.Final]
... 5 more
Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer from [Module "deployment.UserManagment.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:443) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:431) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:373) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:118) [jboss-modules.jar:1.3.0.Final]
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.checkDeclaredApplicationClassAsServlet(JaxrsScanningProcessor.java:290)
... 8 more
13:33:03,737 INFO [org.jboss.ws.common.management] (MSC service thread 1-7) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.3.Final
13:33:03,741 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "UserManagment.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"UserManagment.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"UserManagment.war\".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment \"UserManagment.war\"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer from [Module \"deployment.UserManagment.war:main\" from Service Module Loader]
Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer from [Module \"deployment.UserManagment.war:main\" from Service Module Loader]"}}
13:33:03,817 INFO [org.jboss.as.server] (ServerService Thread Pool -- 29) JBAS018559: Deployed "UserManagment.war" (runtime-name : "UserManagment.war")
13:33:03,822 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."UserManagment.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."UserManagment.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "UserManagment.war"
13:33:03,928 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:10090/management
13:33:03,929 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:10090
13:33:03,929 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: WildFly 8.0.0.Final "WildFly" started (with errors) in 4508ms - Started 207 of 257 services (1 services failed or missing dependencies, 82 services are lazy, passive or on-demand)
13:33:04,446 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment UserManagment.war (runtime-name: UserManagment.war) in 18ms
13:33:04,727 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018558: Undeployed "UserManagment.war" (runtime-name: "UserManagment.war")
13:33:04,728 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."UserManagment.war".POST_MODULE
13:33:04,974 ERROR [org.jboss.remoting.remote.connection] (XNIO-1 I/O-1) JBREM000200: Remote connection failed: java.io.IOException: Une connexion établie a été abandonnée par un logiciel de votre ordinateur hôte
13:33:05,194 ERROR [org.jboss.remoting.remote.connection] (XNIO-1 I/O-1) JBREM000200: Remote connection failed: java.io.IOException: Une connexion établie a été abandonnée par un logiciel de votre ordinateur hôte
13:33:08,906 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) JBAS015003: Found UserManagment.war in deployment directory. To trigger deployment create a file called UserManagment.war.dodeploy
probelem 전쟁 파일의 deploiment에, 내가 exemple.war.dodeploy 그것을 변경되었지만 문제가 해결되지 것입니다! 오류가 발생한 war 파일의 위치 일 수 있습니까? 어디에 넣을 까?
정말 고마워요, 고마워요! –