2017-03-28 9 views
0

Eclipse에서 index.html을 열려고합니다. 하지만이 오류가 발생했습니다 :Eclipse에서 index.html을 열려고 할 때 리소스 구성 클래스를로드 할 수 없습니다.

javax.servlet.ServletException: Resource configuration class com.sensorhound.things.rest.ThingsApplication could not be loaded.

Java EE 프레임 워크를 사용하고 있습니다.

이전에는 Node.js 가짜 서버를 사용하여 프런트 엔드 코드를 작성했습니다. 그럼 내 백 엔드 코드를 작성하는 이클립스에서 메이븐 프로젝트를 만듭니다. 백 엔드 코드를 작성하기 전까지 프런트 엔드 코드를이 프로젝트로 옮기지 않았습니다.

내 프론트 엔드 코드를 테스트하기 전에 wildfly 서버와 카산드라 데이터베이스를 시작한 다음 mvn wildfly : 백엔드 프로젝트 디렉토리 아래에 배포합니다. 그런 다음 프런트 엔드 코드 폴더로 이동하여 브라우저에서 index.html을 엽니 다. 그것은 잘 작동합니다.

지금 내가

디렉토리

SRC/메인/웹 어플리케이션에 내 프런트 엔드 코드를 복사 그래서 내 프로젝트를 마무리하고 내 프로젝트를 업데이트해야합니다.

하지만 일식에서 index.html을 열려고 할 때. 그것은 저에게이 오류를줍니다. 좀 더 자세한 정보가 필요하면

<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.sensorhound</groupId> 
    <artifactId>aigateway</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>war</packaging> 
    <name>AI Gateway Maven Webapp</name> 
    <url>http://maven.apache.org</url> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <jetty.version>9.3.12.v20160915</jetty.version> 
     <jersey.version>2.23.2</jersey.version> 
     <ogm.version>5.0.4.Final</ogm.version> 
     <hibernate.version>5.0.4.Final</hibernate.version> 
    </properties> 

    <dependencyManagement> 
     <dependencies> 
      <dependency> 
       <groupId>org.hibernate.ogm</groupId> 
       <artifactId>hibernate-ogm-bom</artifactId> 
       <version>5.0.4.Final</version> 
       <type>pom</type> 
       <scope>import</scope> 
      </dependency> 
     </dependencies> 
    </dependencyManagement> 

    <dependencies> 
     <!-- hibernate --> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-core</artifactId> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-search-orm</artifactId> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-entitymanager</artifactId> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.hibernate</groupId> 
      <artifactId>hibernate-search-infinispan</artifactId> 
      <version>5.1.1.Final</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.hibernate.ogm</groupId> 
      <artifactId>hibernate-ogm-cassandra</artifactId> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>dom4j</groupId> 
      <artifactId>dom4j</artifactId> 
      <version>1.6.1</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.jboss.logging</groupId> 
      <artifactId>jboss-logging</artifactId> 
      <version>3.3.0.Final</version> 
     </dependency> 
     <dependency> 
      <groupId>org.jboss</groupId> 
      <artifactId>jandex</artifactId> 
      <version>2.0.3.Final</version> 
     </dependency> 
     <dependency> 
      <groupId>com.fasterxml.jackson.core</groupId> 
      <artifactId>jackson-annotations</artifactId> 
      <version>2.7.3</version> 
     </dependency> 


     <!-- hibernate ogm --> 
     <!-- Hibernate OGM Infinispan module; pulls in the OGM core module --> 
     <dependency> 
      <groupId>org.hibernate.ogm</groupId> 
      <artifactId>hibernate-ogm-infinispan</artifactId> 
      <scope>provided</scope> 
     </dependency> 
     <!-- standard APIs dependencies - provided in a Java EE container --> 
     <dependency> 
      <groupId>org.hibernate.javax.persistence</groupId> 
      <artifactId>hibernate-jpa-2.1-api</artifactId> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.jboss.spec.javax.transaction</groupId> 
      <artifactId>jboss-transaction-api_1.2_spec</artifactId> 
     </dependency> 
     <!-- Add the Narayana Transactions Manager 
     an implementation would be provided in a Java EE container, 
     but this works nicely in Java SE as well --> 
     <dependency> 
      <groupId>org.jboss.narayana.jta</groupId> 
      <artifactId>narayana-jta</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>org.jboss</groupId> 
      <artifactId>jboss-transaction-spi</artifactId> 
      <version>7.5.0.Final</version> 
     </dependency> 
     <dependency> 
      <groupId>jboss</groupId> 
      <artifactId>jbossjta</artifactId> 
      <version>4.2.2.GA</version> 
     </dependency> 
     <dependency> 
      <groupId>org.eclipse.jetty</groupId> 
      <artifactId>jetty-server</artifactId> 
      <version>${jetty.version}</version> 
     </dependency> 
     <!-- dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-servlet</artifactId> 
      <version>${jetty.version}</version> </dependency --> 
     <dependency> 
      <groupId>org.glassfish.jersey.core</groupId> 
      <artifactId>jersey-server</artifactId> 
      <version>${jersey.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.glassfish.jersey.containers</groupId> 
      <artifactId>jersey-container-servlet-core</artifactId> 
      <version>${jersey.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.glassfish.jersey.containers</groupId> 
      <artifactId>jersey-container-jetty-http</artifactId> 
      <version>${jersey.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.fusesource.leveldbjni</groupId> 
      <artifactId>leveldbjni-all</artifactId> 
      <version>1.8</version> 
     </dependency> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>4.12</version> 
     </dependency> 
     <!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api --> 
     <dependency> 
      <groupId>javax.ws.rs</groupId> 
      <artifactId>javax.ws.rs-api</artifactId> 
      <version>2.0</version> 
     </dependency> 
     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>javax.servlet-api</artifactId> 
      <version>3.0.1</version> 
     </dependency> 
     <dependency> 
      <groupId>org.hibernate.javax.persistence</groupId> 
      <artifactId>hibernate-jpa-2.0-api</artifactId> 
      <version>1.0.1.Final</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.googlecode.json-simple</groupId> 
      <artifactId>json-simple</artifactId> 
      <version>1.1.1</version> 
     </dependency> 
     <dependency> 
      <groupId>javax.ejb</groupId> 
      <artifactId>ejb-api</artifactId> 
      <version>3.0</version> 
     </dependency> 
     <dependency> 
      <groupId>javax</groupId> 
      <artifactId>javaee-api</artifactId> 
      <version>7.0</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.google.guava</groupId> 
      <artifactId>guava</artifactId> 
      <version>19.0</version> 
     </dependency> 
    </dependencies> 
    <build> 
     <finalName>aigateway</finalName> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.1</version> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.wildfly.plugins</groupId> 
       <artifactId>wildfly-maven-plugin</artifactId> 
       <version>1.1.0.Final</version> 
       <configuration> 
       <force>true</force> 
<!--    <hostname>${wildfly-hostname}</hostname> --> 
<!--    <username>${wildfly-user}</username> --> 
<!--    <password>${wildfly-password}</password> --> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

, 내가 공유 기꺼이 :

<?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_3_0.xsd" 
    version="3.0"> 
    <display-name>servlet 3.0 Web Application</display-name> 
    <context-param> 
     <param-name>resteasy.providers</param-name> 
     <param-value> 
       com.sensorhound.aigateway.ws.filters.CORSFilter 
     </param-value> 
    </context-param> 
    <servlet> 
     <servlet-name>ServletContainer</servlet-name> 
     <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class> 
     <init-param> 
      <param-name>javax.ws.rs.Application</param-name> 
      <param-value>com.sensorhound.things.rest.ThingsApplication</param-value> 
     </init-param> 
    </servlet> 
    <servlet-mapping> 
     <servlet-name>ServletContainer</servlet-name> 
     <url-pattern>/*</url-pattern> 
    </servlet-mapping> 
</web-app> 

여기 내 pom.xml 파일입니다 :

더 참고로, 여기 내 web.xml에있다.

감사합니다.

답변

0

web.xml에서 서블릿 관련 태그를 제거하여이 문제를 해결했습니다. 그것들은 제 동료가 부두 서버를 사용할 때 추가 한 코드입니다.