Exception while executing java class
up vote
0
down vote
favorite
I executed this command
mvn compile exec:java -Dexec.classpathScope=compile -Dexec.mainClass=crawler.Crawler
and found this
An exception occured while executing the Java class. org/apache/log4j/Logger
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" si:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<repositories>
<repository>
<id>clojars.org</id>
<url>http://clojars.org/repo</url>
</repository>
<repository>
<id>twitter4j.org</id>
<name>twitter4j.org Repository</name>
<url>http://twitter4j.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
second part
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
Error
java.lang.NoClassDefFoundError: org/apache/log4j/Logger
java maven
|
show 1 more comment
up vote
0
down vote
favorite
I executed this command
mvn compile exec:java -Dexec.classpathScope=compile -Dexec.mainClass=crawler.Crawler
and found this
An exception occured while executing the Java class. org/apache/log4j/Logger
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" si:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<repositories>
<repository>
<id>clojars.org</id>
<url>http://clojars.org/repo</url>
</repository>
<repository>
<id>twitter4j.org</id>
<name>twitter4j.org Repository</name>
<url>http://twitter4j.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
second part
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
Error
java.lang.NoClassDefFoundError: org/apache/log4j/Logger
java maven
Presumably log4j is in 'test' scope, not 'compile' scope.
– bmargulies
Jan 18 '15 at 22:42
1
There clearly is a problem with your dependencies. Log4J is missing from the classpath. Are you sure you setup the<scope>
correctly?
– Alessandro Santini
Jan 18 '15 at 22:42
Execuse me i'm new in java and maven how can i check <scope> and where can i find it ?
– user3188912
Jan 18 '15 at 22:46
Is there a pom.xml you can show us?
– Dawood ibn Kareem
Jan 18 '15 at 23:00
What even is the error?
– Dave Newton
Jan 18 '15 at 23:21
|
show 1 more comment
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I executed this command
mvn compile exec:java -Dexec.classpathScope=compile -Dexec.mainClass=crawler.Crawler
and found this
An exception occured while executing the Java class. org/apache/log4j/Logger
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" si:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<repositories>
<repository>
<id>clojars.org</id>
<url>http://clojars.org/repo</url>
</repository>
<repository>
<id>twitter4j.org</id>
<name>twitter4j.org Repository</name>
<url>http://twitter4j.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
second part
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
Error
java.lang.NoClassDefFoundError: org/apache/log4j/Logger
java maven
I executed this command
mvn compile exec:java -Dexec.classpathScope=compile -Dexec.mainClass=crawler.Crawler
and found this
An exception occured while executing the Java class. org/apache/log4j/Logger
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" si:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<repositories>
<repository>
<id>clojars.org</id>
<url>http://clojars.org/repo</url>
</repository>
<repository>
<id>twitter4j.org</id>
<name>twitter4j.org Repository</name>
<url>http://twitter4j.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
second part
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
Error
java.lang.NoClassDefFoundError: org/apache/log4j/Logger
java maven
java maven
edited Nov 11 at 16:09
Cœur
17.2k9102141
17.2k9102141
asked Jan 18 '15 at 22:39
user3188912
Presumably log4j is in 'test' scope, not 'compile' scope.
– bmargulies
Jan 18 '15 at 22:42
1
There clearly is a problem with your dependencies. Log4J is missing from the classpath. Are you sure you setup the<scope>
correctly?
– Alessandro Santini
Jan 18 '15 at 22:42
Execuse me i'm new in java and maven how can i check <scope> and where can i find it ?
– user3188912
Jan 18 '15 at 22:46
Is there a pom.xml you can show us?
– Dawood ibn Kareem
Jan 18 '15 at 23:00
What even is the error?
– Dave Newton
Jan 18 '15 at 23:21
|
show 1 more comment
Presumably log4j is in 'test' scope, not 'compile' scope.
– bmargulies
Jan 18 '15 at 22:42
1
There clearly is a problem with your dependencies. Log4J is missing from the classpath. Are you sure you setup the<scope>
correctly?
– Alessandro Santini
Jan 18 '15 at 22:42
Execuse me i'm new in java and maven how can i check <scope> and where can i find it ?
– user3188912
Jan 18 '15 at 22:46
Is there a pom.xml you can show us?
– Dawood ibn Kareem
Jan 18 '15 at 23:00
What even is the error?
– Dave Newton
Jan 18 '15 at 23:21
Presumably log4j is in 'test' scope, not 'compile' scope.
– bmargulies
Jan 18 '15 at 22:42
Presumably log4j is in 'test' scope, not 'compile' scope.
– bmargulies
Jan 18 '15 at 22:42
1
1
There clearly is a problem with your dependencies. Log4J is missing from the classpath. Are you sure you setup the
<scope>
correctly?– Alessandro Santini
Jan 18 '15 at 22:42
There clearly is a problem with your dependencies. Log4J is missing from the classpath. Are you sure you setup the
<scope>
correctly?– Alessandro Santini
Jan 18 '15 at 22:42
Execuse me i'm new in java and maven how can i check <scope> and where can i find it ?
– user3188912
Jan 18 '15 at 22:46
Execuse me i'm new in java and maven how can i check <scope> and where can i find it ?
– user3188912
Jan 18 '15 at 22:46
Is there a pom.xml you can show us?
– Dawood ibn Kareem
Jan 18 '15 at 23:00
Is there a pom.xml you can show us?
– Dawood ibn Kareem
Jan 18 '15 at 23:00
What even is the error?
– Dave Newton
Jan 18 '15 at 23:21
What even is the error?
– Dave Newton
Jan 18 '15 at 23:21
|
show 1 more comment
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
You need to add dependency on log4j
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
to your pom.xml file (after dependency on junit).
You can read about this dependency in maven repo:
http://mvnrepository.com/artifact/log4j/log4j/1.2.17
I got this after appending <dependency>log4j. please initialize log4j system properly
– user3188912
Jan 21 '15 at 23:02
I am glad, my answer helped you. And now you have new challenge. I think, this topic help you: How to initialize log4j properly? I guess, we can close this discussion. I voted up your question. You can voteup and accept my answer. Good luck!
– Vitaly
Jan 22 '15 at 4:15
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
You need to add dependency on log4j
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
to your pom.xml file (after dependency on junit).
You can read about this dependency in maven repo:
http://mvnrepository.com/artifact/log4j/log4j/1.2.17
I got this after appending <dependency>log4j. please initialize log4j system properly
– user3188912
Jan 21 '15 at 23:02
I am glad, my answer helped you. And now you have new challenge. I think, this topic help you: How to initialize log4j properly? I guess, we can close this discussion. I voted up your question. You can voteup and accept my answer. Good luck!
– Vitaly
Jan 22 '15 at 4:15
add a comment |
up vote
0
down vote
accepted
You need to add dependency on log4j
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
to your pom.xml file (after dependency on junit).
You can read about this dependency in maven repo:
http://mvnrepository.com/artifact/log4j/log4j/1.2.17
I got this after appending <dependency>log4j. please initialize log4j system properly
– user3188912
Jan 21 '15 at 23:02
I am glad, my answer helped you. And now you have new challenge. I think, this topic help you: How to initialize log4j properly? I guess, we can close this discussion. I voted up your question. You can voteup and accept my answer. Good luck!
– Vitaly
Jan 22 '15 at 4:15
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
You need to add dependency on log4j
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
to your pom.xml file (after dependency on junit).
You can read about this dependency in maven repo:
http://mvnrepository.com/artifact/log4j/log4j/1.2.17
You need to add dependency on log4j
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
to your pom.xml file (after dependency on junit).
You can read about this dependency in maven repo:
http://mvnrepository.com/artifact/log4j/log4j/1.2.17
answered Jan 19 '15 at 18:03
Vitaly
1,3821917
1,3821917
I got this after appending <dependency>log4j. please initialize log4j system properly
– user3188912
Jan 21 '15 at 23:02
I am glad, my answer helped you. And now you have new challenge. I think, this topic help you: How to initialize log4j properly? I guess, we can close this discussion. I voted up your question. You can voteup and accept my answer. Good luck!
– Vitaly
Jan 22 '15 at 4:15
add a comment |
I got this after appending <dependency>log4j. please initialize log4j system properly
– user3188912
Jan 21 '15 at 23:02
I am glad, my answer helped you. And now you have new challenge. I think, this topic help you: How to initialize log4j properly? I guess, we can close this discussion. I voted up your question. You can voteup and accept my answer. Good luck!
– Vitaly
Jan 22 '15 at 4:15
I got this after appending <dependency>log4j. please initialize log4j system properly
– user3188912
Jan 21 '15 at 23:02
I got this after appending <dependency>log4j. please initialize log4j system properly
– user3188912
Jan 21 '15 at 23:02
I am glad, my answer helped you. And now you have new challenge. I think, this topic help you: How to initialize log4j properly? I guess, we can close this discussion. I voted up your question. You can voteup and accept my answer. Good luck!
– Vitaly
Jan 22 '15 at 4:15
I am glad, my answer helped you. And now you have new challenge. I think, this topic help you: How to initialize log4j properly? I guess, we can close this discussion. I voted up your question. You can voteup and accept my answer. Good luck!
– Vitaly
Jan 22 '15 at 4:15
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f28015655%2fexception-while-executing-java-class%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Presumably log4j is in 'test' scope, not 'compile' scope.
– bmargulies
Jan 18 '15 at 22:42
1
There clearly is a problem with your dependencies. Log4J is missing from the classpath. Are you sure you setup the
<scope>
correctly?– Alessandro Santini
Jan 18 '15 at 22:42
Execuse me i'm new in java and maven how can i check <scope> and where can i find it ?
– user3188912
Jan 18 '15 at 22:46
Is there a pom.xml you can show us?
– Dawood ibn Kareem
Jan 18 '15 at 23:00
What even is the error?
– Dave Newton
Jan 18 '15 at 23:21