Tomcat 7 deployment fails. org.apache.commons.codec.binary.Base64 not found - maven

I am trying to deploy a web application to a Tomcat 7 instance using the tomcat7-maven-plugin's tomcat7:deploy goal. However, it continuously fails to deploy, citing that:
java.lang.NoClassDefFoundError: org/apache/commons/codec/binary/Base64
All of the posts I've read suggest adding the Apache commons-codec to pom.xml. I have done that and it doesn't do a bit of good. I tried manually downloading the JAR and placing it in the WEB-INF/lib folder but that also had no effect.
Here is my pom.xml file:
<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>edu.uta</groupId>
<artifactId>MavAppoint</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>MavAppoint Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>7.0.59</version>
</dependency>
</dependencies>
<build>
<finalName>MavAppoint</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>TomcatServer</server>
<path>/MavAppoint</path>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
</build>
</project>
I have tried changing the scope for the commons-codec but nothing has worked so far. It's been driving me absolutely nuts! Any advice would be greatly appreciated.

I ended up using the "Run on Server" option in Eclipse to run the application instead of trying to deploy the application to the Tomcat installation on my computer.

Related

Maven in Jenkins : Doesn't find any test

I'm trying to run automatised test on Jenkins with Maven. However, when I use the command "mvn test" in a Maven Project Job, the console return me that's no test was found.
The path to my test files respect the convention (I think) and are at src/test/java/Gui/CameraTest.java
Here is my 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>groupId</groupId>
<artifactId>GoSecuri</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>13</maven.compiler.source>
<maven.compiler.target>13</maven.compiler.target>
<jenkins.e2eTests.reportsDirectory>target/protractor-reports</jenkins.e2eTests.reportsDirectory>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.google.firebase/firebase-admin -->
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>6.8.1</version>
</dependency>
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>opencv</artifactId>
<version>4.0.1-1.4.4</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.0.0-M5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.0.0-M5</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Can anyone help me pls ?
maven-surefire-plugin
2.19
add this piece and try to build from testng.xml and don't forget to add your runner class to your testng.xml
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/java/runners/testNG/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>

Cannot resolve symbol #Configuration in spring webmvc project

I am creating a Spring MVC project in Intellij and when I have created WebConfigclass, the #Configuration annotation is not recognised by Intellij and it gives "Cannot resolve symbol" error. Even though I have used "import org.springframework.context.annotation.Configuration" but it could not recognise "springframework" either. Can someone help me with this.
This is my 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>academy.learnprogramming</groupId>
<artifactId>Todo-list</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<logback.version>1.2.3</logback.version>
<spring.version>5.0.5.RELEASE</spring.version>
<java.version>8</java.version>
<annotation-api.version>1.3.2</annotation-api.version>
<servlet-api.version>3.1.0</servlet-api.version>
<!-- <lombok.version>1.18.12</lombok.version>-->
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${annotation-api.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>edge</version>
<scope>system</scope>
<systemPath>${basedir}/libs/lombok-1.18.12.jar</systemPath>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet-api.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<target>${java.version}</target>
<source>${java.version}</source>
<release>${java.version}</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.6.7</version>
<configuration>
<container>
<containerId>tomcat9x</containerId>
<type>embedded</type>
</container>
<configuration>
<properties>
<cargo.servlet.port>8081</cargo.servlet.port>
</properties>
</configuration>
</configuration>
</plugin>
</plugins>
</build>
</project>
#Configuration belongs to module spring-context-${spring.version}. Make sure it appears among dependencies. Since in maven dependencies can be transitive, consider using:
mvn dependency:tree
to see which dependency brings the required jar.
When you're done, re-import the maven project into intelliJ so that the IDE will update its internal indices

How to stop Maven upgrading to latest Google Cloud SDK

I have just deployed my latest code to GCP. I use maven and recently migrated from com.google.appengine 1.9.58 to the latest com.google.cloud.tools using appengine-maven-plugin.
The version I deployed last month was the Cloud SDK version 265.0.0. When I deployed my new code today it upgraded me to 267.0.0. How do I prevent this from happening and control which SDK version I'm on.
I tried adding a dependancy to my POM:
<dependency>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>265.0.0</version>
</dependency>
But this failed.
As per my comment, the Cloud SDK upgrades to the latest when I run mvn appengine:deploy or mvn appengine:run
Thanks
TimN
POM file:
<?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>
<packaging>war</packaging>
<version>1.0</version>
<groupId>com.company.app</groupId>
<artifactId>xxxyyydb</artifactId>
<properties>
<appengine.app.version>1</appengine.app.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<prerequisites>
<maven>3.6.1</maven>
</prerequisites>
<dependencies>
<!-- Compile/runtime dependencies -->
<dependency>
<groupId>com.google.appengine.tools</groupId>
<artifactId>appengine-gcs-client</artifactId>
<version>0.6</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.58</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>2.17</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
<version>2.17</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>com.googlecode.objectify</groupId>
<artifactId>objectify</artifactId>
<version>5.1.5</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo-api</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.github.mpkorstanje</groupId>
<artifactId>simmetrics-core</artifactId>
<version>3.2.3</version>
</dependency>
</dependencies>
<build>
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>display-dependency-updates</goal>
<goal>display-plugin-updates</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<version>3.2</version>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>2.0.0</version>
<configuration>
<projectId>xxxyyydb</projectId>
<version>1</version>
</configuration>
</plugin>
</plugins>
</build>
</project>
I found (and read!) the User Guide to the appengine-maven-plugin:
https://github.com/GoogleCloudPlatform/app-maven-plugin/blob/master/USER_GUIDE.md
Setting the cloudSdkVersion in the configuration section of the plugin in my pom.xml allowed me to force the SDK version. Without it, the plugin always downloads the latest Cloud SDK.
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>2.0.0</version>
<configuration>
<projectId>xxxyyyProjectID</projectId>
<version>1</version>
<cloudSdkVersion>267.0.0</cloudSdkVersion>
</configuration>
</plugin>

Sonar 3.0 does no analysis but displays no errors/warnings

Im using eclipse with m2e for developing and maven 3.0.4 with Sonar 3.0 for analysis.
On the console i get a "Build success" for mvn clean install and a "ANALYSIS SUCCESSFUL, you can browse..." for mvn sonar:sonar. I do not recognize any errors/warnings etc.
In sonar i can see my project, the actual version and build date but there is no analysis.
Are there any reported problems with sonar 3.0 or someone got an idea whats wrong?
Thanks a lot.
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>DungeonMasterTools</groupId>
<artifactId>DungeonMasterTools</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<executable>${JDK_1_7_HOME}/bin/javac</executable>
<compilerArgument>-verbose</compilerArgument>
<source>1.7</source>
<target>1.7</target>
<meminitial>128m</meminitial>
<maxmem>512m</maxmem>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.2</version>
</dependency>
</dependencies>
</project>

Netbeans with Maven - Adding dependency libraries

I am currently trying to build a Java Project with several dependencies. I have created it as a Maven Web Application and I have added all the necessary dependencies. Yet, the imports are not getting resolved.
In the link below, I have attached a screenshot of my Netbeans wherein in the right panel, the import errors are visible. In the left panel, I have highlighted the libraries that I have added. Could anyone please tell me why this is happening ? Any help would be very much appreciated. Thank you :)
http://img20.imageshack.us/img20/5558/screenshotat20120312121.png
POM FILE CONTENTS :
<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.mycompany</groupId>
<artifactId>nutchTest2</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>nutchTest2 Java EE 6 Webapp</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>java.net2</id>
<name>Repository hosting the jee6 artifacts</name>
<url>http://download.java.net/maven/2</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>org.jvnet.hudson.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>0.19.1-hudson-3</version>
</dependency>
<dependency>
<groupId>com.saucelabs.selenium</groupId>
<artifactId>selenium-htmlunit-driver</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>solrj</groupId>
<artifactId>solr-solrj-1.3.0.jar</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>solr</groupId>
<artifactId>solr-common-1.3.0-sources</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
<finalName>nutchTest2</finalName>
</build>
<profiles>
<profile>
<id>endorsed</id>
<activation>
<property>
<name>sun.boot.class.path</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<!-- javaee6 contains upgrades of APIs contained within the JDK itself.
As such these need to be placed on the bootclasspath, rather than classpath of the
compiler.
If you don't make use of these new updated API, you can delete the profile.
On non-SUN jdk, you will need to create a similar profile for your jdk, with the similar property as sun.boot.class.path in Sun's JDK.-->
<compilerArguments>
<bootclasspath>${settings.localRepository}/javax/javaee-endorsed-api/6.0/javaee-endorsed-api-6.0.jar${path.separator}${sun.boot.class.path}</bootclasspath>
</compilerArguments>
</configuration>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
maybe because the files you show us are in the source bundle (solr-common*sources*jar)(notice than you point to files with .java extension, not .class), not in compiled library. Include compiled library to your project.
Need to see pom file to provide more detailed answer
After I saw .pom file: you should change
<dependency>
<groupId>solr</groupId>
<artifactId>solr-common-1.3.0-sources</artifactId>
<version>1.3.0</version>
</dependency>
to
<dependency>
<groupId>solr</groupId>
<artifactId>solr-common</artifactId>
<version>1.3.0</version>
</dependency>

Resources