Reputation: 59
I'm struggling with eclipse+tomcat configuration. I deployed my app on the cloud but I'd liek to do some changes offline (it's faster) and then deploy something working. I have web project set up using maven. I have 2 dependencies(not mentioning essential javax): org.json
and joda-time
. The problem is I can not figure out how to download those dependencies. Every time I want to run the project tomcat fails to start with a long stack trace, but I know that the problem is that line: Caused by: Java.lang.NoClassDefFoundError: javax/json/JsonObject
. That means, dependencies jars aren't there(int WEB-INF/lib
I think). I've tried ppm on project->maven->update project, ppm on server->clean, ppm on server->publish. Also I checked project->properties->Deployment Asembly and Maven Dependencies are there... I've searched a lot thourgh the web and I'm running out of ideas. Thanks for any help, cheers!
UPDATE pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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>openshifttest</groupId>
<artifactId>openshifttest</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>openshifttest</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.8.2</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 'deployments' folder. -->
<!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
<id>openshift</id>
<build>
<finalName>openshifttest</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<outputDirectory>deployments</outputDirectory>
<warName>ROOT</warName>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Upvotes: 0
Views: 279
Reputation: 3643
I think that tomcat may not be providing Java EE API, please try changing
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
to
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
(remove provided scope).
Upvotes: 1