I noticed I'm having this in other projects as well (my own projects). what am i missing?
here's one project's pom which produces the same errors: <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.company.file</groupId> <artifactId>IniFile</artifactId> <packaging>jar</packaging> <version>1.00.0000</version> <name>IniFile</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <distributionManagement> <repository> <id>ctch</id> <name>Company Maven Repository</name> <url>scp://172.20.20.42: /home/eyale/sonatype-work/nexus/storage/company/</url> </repository> </distributionManagement> <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> </plugins> </build> </project> On Mon, Nov 16, 2009 at 3:39 PM, eyal edri <[email protected]> wrote: > Hi, > > i hope someone can help me out, > > i get this error when trying to run a jar: > > -- [ey...@eyale-f8-32 IncreasePriority]$ java -jar > target/IncreasePriority-1.00.0000.jar > Exception in thread "main" java.lang.NoClassDefFoundError: > org/apache/log4j/Logger > at > com.company.url.unknowns.IncreasePriority.<clinit>(IncreasePriority.java:16) > Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger > at java.net.URLClassLoader$1.run(URLClassLoader.java:200) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:188) > at java.lang.ClassLoader.loadClass(ClassLoader.java:307) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) > at java.lang.ClassLoader.loadClass(ClassLoader.java:252) > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) > ... 1 more > Could not find the main class: com.company.url.unknowns.IncreasePriority. > Program will exit. > > > ------------------------------------------------------------------------------------------------- > i'm initializing log4j in the program like this: > > public class IncreasePriority > { > * static Logger logger = > Logger.getLogger(IncreasePriority.class.getName());* > > public static void main(String[] args) throws Exception > { > > // get conf file from args > if (args.length == 0) > { > Usage(); > } > > > mvn package finishes successfully and the program runs successfully in > eclipse. > > anyone has a clue what's going on? > > *here's the project pom:* > > <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.company.url.unknowns</groupId> > <artifactId>IncreasePriority</artifactId> > <packaging>jar</packaging> > <version>1.00.0000</version> > <name>IncreasePriority</name> > <url>http://maven.apache.org</url> > <organization> > <name>Company</name> > <url>http://www.company.com</url> > </organization> > <build> > <plugins> > <plugin> > <artifactId>maven-resources-plugin</artifactId> > <version>2.4.1</version> > <executions> > <execution> > <id>copy-conf</id> > <phase>install</phase> > <goals> > <goal>copy-resources</goal> > </goals> > <configuration> > > <outputDirectory>/etc/ct-urlf-increase-priority/</outputDirectory> > <resources> > <resource> > <directory>src/main/resources/conf</directory> > </resource> > </resources> > </configuration> > </execution> > <execution> > <id>copy-cron</id> > <phase>install</phase> > <goals> > <goal>copy-resources</goal> > </goals> > <configuration> > <outputDirectory>/etc/cron.d/</outputDirectory> > <resources> > <resource> > <directory>src/main/resources/cron</directory> > </resource> > </resources> > </configuration> > </execution> > <execution> > <id>copy-jar</id> > <phase>install</phase> > <goals> > <goal>copy-resources</goal> > </goals> > <configuration> > > <outputDirectory>/usr/local/ct-urlf-increase-priority/</outputDirectory> > <resources> > <resource> > <directory>target/</directory> > <filtering>true</filtering> > <includes> > <include>**/*.jar</include> > </includes> > </resource> > </resources> > </configuration> > </execution> > </executions> > </plugin> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-jar-plugin</artifactId> > <configuration> > <archive> > <manifest> > > <mainClass>com.company.url.unknowns.IncreasePriority</mainClass> > </manifest> > </archive> > </configuration> > </plugin> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-compiler-plugin</artifactId> > <version>2.0.2</version> > <configuration> > <source>1.5</source> > <target>1.5</target> > </configuration> > </plugin> > </plugins> > </build> > <dependencies> > <dependency> > <groupId>junit</groupId> > <artifactId>junit</artifactId> > <version>3.8.1</version> > <scope>test</scope> > </dependency> > <dependency> > <groupId>javax.mail</groupId> > <artifactId>mail</artifactId> > <version>1.4.1</version> > </dependency> > <dependency> > <groupId>com.company.sql</groupId> > <artifactId>DbUtil</artifactId> > <version>1.00.0000</version> > </dependency> > <dependency> > <groupId>com.company.file</groupId> > <artifactId>IniFile</artifactId> > <version>1.00.0000</version> > </dependency> > <dependency> > <groupId>log4j</groupId> > <artifactId>log4j</artifactId> > <version>1.2.14</version> > </dependency> > </dependencies> > <properties> > <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> > </properties> > <repositories> > <repository> > <id>ctch</id> > <url>http://172.20.20.42:8081/nexus/content/repositories/company/ > </url> > </repository> > </repositories> > <distributionManagement> > <repository> > <id>ctch</id> > <name>Company Maven Repository</name> > <url>scp://172.20.20.42: > /home/eyale/sonatype-work/nexus/storage/company/</url> > </repository> > </distributionManagement> > </project> > > > > Eyal Edri > -- Eyal Edri
