OpenSift for the PaaS의 첫 번째 프로젝트를 빌드하고있었습니다. 자바와 함께 가기로 결심 했으므로 JBoss Developer Studio를 다운로드하고 첫 번째 문장을 만들었습니다. 템플릿이 이미 만들어져있어 실행할 수 있도록 변경해야합니다. 나는 이것이 자바 EE 사람들을위한 간단 할 수 있습니다 알고OpenShift Tomcat 7 (JBoss EWS 2.0)
javax.servlet cannot be resolved
하지만 내 질문은 OpenShift를 들어,이 솔루션은 동일 할 것입니다 :하지만 개발자 스튜디오에서,이 오류가 발생합니다. 우리는 단지 아파치 tomcat jar 파일을 프로젝트 폴더에 복사 할 수 있습니까? JBoss Develper Studio는 정확히 Eclipse와 같지 않습니다. 그래서 항아리를 추가하면 오류가 사라집니다.
Classpath entry .. tomecat-7.0.42/lib/servlet-api.jar will not be exported or published ClassNotFoundException may result.
질문
오류 및 사라질 경고에 대한 옳은 일이 무엇입니까 : 그럼이 경고가? Openshift는 PaaS 이후에 항아리가 있어야합니까? IaaS가 아닙니다. 빌드하는 데 항아리가 필요한 것일 뿐이지 만이 항아리는 웹 앱의 일부가 아니겠습니까?
정보
제이보스 디벨로퍼 스튜디오 기본 pom.xml 파일이 서블릿 API에 대한 올바른 의존성이없는 것 같다
<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>tom</groupId>
<artifactId>tom</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>tom</name>
<repositories>
<repository>
<id>eap</id>
<url>http://maven.repository.redhat.com/techpreview/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>eap</id>
<url>http://maven.repository.redhat.com/techpreview/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.2-1003-jdbc4</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.25</version>
</dependency>
</dependencies>
<profiles>
<profile>
<!-- When built in OpenShift the 'openshift' profile will be used when
invoking mvn. -->
<!-- Use this profile for any OpenShift specific customization your app
will need. -->
<!-- By default that is to put the resulting archive into the 'webapps'
folder. -->
<!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
<id>openshift</id>
<build>
<finalName>tom</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<outputDirectory>webapps</outputDirectory>
<warName>ROOT</warName>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
그래 ... 주위 임의'jar's을 복사하는 것은 아마 좋은 생각이다. 'jar '는'class' 파일의 압축 된 모음입니다. –
그는 외부 항아리를 사용하는 것 같습니다. 그렇지 않으면 경고가 다른 경로를 가리키는 이유는 무엇입니까? 초보자는 다른 것을 시도해 보았을지도 모르며 결국 마침내 작동하게 된 것을 잊어 버렸을 것입니다. 일반적으로 servlet-api.jar (tomcat)은 이미 JBOSS 서버의 일부입니다. 개발자는 컴파일 할 필요가 있습니다. –
당신은 메이븐을 사용하고 있습니까? 그렇다면 pom.xml을 보여주세요. – fascynacja