dimanche 30 décembre 2018

How to include missing dependencies for maven project

I'm trying to run my Rest http server in eclipse and I'm getting the error below. I don't know how to resolve this. I've tried changing to the project directory and entering mvn dependency:resolve but it doesn't work.

SEVERE: The following errors and warnings have been detected with resource and/or provider classes:
  SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.message(java.lang.String,java.lang.String,java.lang.String) throws java.io.IOException at parameter at index 0
  SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.message(java.lang.String,java.lang.String,java.lang.String) throws java.io.IOException at parameter at index 1
  SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.message(java.lang.String,java.lang.String,java.lang.String) throws java.io.IOException at parameter at index 2
  SEVERE: Method, public org.json.JSONObject serverPackage.ServerInRest.message(java.lang.String,java.lang.String,java.lang.String) throws java.io.IOException, annotated with PUT of resource, class serverPackage.ServerInRest, is not recognized as valid resource method.
  SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.leaveRoom(java.lang.String,java.lang.String) throws java.io.IOException at parameter at index 0
  SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.leaveRoom(java.lang.String,java.lang.String) throws java.io.IOException at parameter at index 1
  SEVERE: Method, public org.json.JSONObject serverPackage.ServerInRest.leaveRoom(java.lang.String,java.lang.String) throws java.io.IOException, annotated with PUT of resource, class serverPackage.ServerInRest, is not recognized as valid resource method.
  SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.joinRoom(java.lang.String,java.lang.String) at parameter at index 0
  SEVERE: Missing dependency for method public org.json.JSONObject serverPackage.ServerInRest.joinRoom(java.lang.String,java.lang.String) at parameter at index 1
  SEVERE: Method, public org.json.JSONObject serverPackage.ServerInRest.joinRoom(java.lang.String,java.lang.String), annotated with PUT of resource, class serverPackage.ServerInRest, is not recognized as valid resource method.

There is another error below that I think will be resolved once I fix this one

org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
com.sun.jersey.spi.inject.Errors$ErrorMessagesException


Here is my web.xml file 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>RestServer</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>Jersey Web Application</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
        <init-param>
            <param-name>com.sun.jersey.config.property.packages</param-name>
            <param-value>serverPackage</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Jersey Web Application</servlet-name>
        <url-pattern>/serv/*</url-pattern>
    </servlet-mapping>
</web-app>


Here is my pom.xml file 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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>RestServer</groupId>
  <artifactId>RestServer</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.2.1</version>
        <configuration>
          <warSourceDirectory>WebContent</warSourceDirectory>
        </configuration>
      </plugin>

    </plugins>
  </build>
  <dependencies>
        <dependency>
            <groupId>asm</groupId>
            <artifactId>asm</artifactId>
            <version>3.3.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-bundle</artifactId>
            <version>1.19.4</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20170516</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-server</artifactId>
            <version>1.19.4</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-core</artifactId>
            <version>1.19.4</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.2.6</version>
        </dependency>
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>4.3.4.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-core</artifactId>
            <version>2.2.11</version>
        </dependency>
    </dependencies> 
</project>




Aucun commentaire:

Enregistrer un commentaire