On 3/9/2013 1:10 PM, henry joe wrote:
Hello guys,

Please, I was trying to build a simple maven project but ran into some difficulty. I was checking out the instructions from this site-> `http://www.mkyong.com/hibernate/quick-start-maven-hibernate-mysql-example/` <http://www.mkyong.com/hibernate/quick-start-maven-hibernate-mysql-example/%60>

but when I took a look at the structure, I discovered in my project structure, I couldn't find the .project and the .classpath files. I only found the pom.xml. When I ran the project, I hit an eror:

You don't need .project and .classpath files unless you want them to get built
as Eclipse projects as well.


Exception in thread "main" java.lang.NoClassDefFoundError: com/henry/directory/App
    Caused by: java.lang.ClassNotFoundException: com.henry.directory.App

It is looking for com/henry/directory/App.class in the classpath but cannot find it. I strongly recommend you to study the "Maven Basics 1" under "Java development tools" course
along with 8623_tools_build_maven1.zip.

-S


at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

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>com.henry.directory</groupId>
      <artifactId>FirstMaven</artifactId>
      <packaging>jar</packaging>
      <version>1.0-SNAPSHOT</version>
      <name>FirstMaven</name>
      <url>http://maven.apache.org</url>
      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
          <!-- MySQL database driver -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.9</version>
</dependency>
<!-- Hibernate framework -->
<dependency>
<groupId>hibernate</groupId>
<artifactId>hibernate3</artifactId>
<version>3.2.3.GA <http://3.2.3.GA></version>
</dependency>
<!-- Hibernate library dependecy start -->
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2</version>
</dependency>
<!-- Hibernate library dependecy end -->
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
      </dependencies>
    </project>

I hope someone could help me out at why the class could not be found. Thanks










--
You received this message because you are subscribed to the Google Groups "JPassion.com: Java Programming" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
Visit this group at http://groups.google.com/group/jpassion_java?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.




--
-------------------------------------------------------------------
             Sang Shin, [email protected]
  Founder and Chief Instructor of JPassion.com (JavaPassion.com)
         http://www.linkedin.com/in/javapassion (Linkedin)
          http://twitter.com/javapassion (Tweeter)
            Life is worth living... with Passion!

Free 12-week Webinar series on"Groovy and Grails" starts from March 1st
     Free 10-week Webinar series on "HTML5" starts from March 1st
             http://jpassion.com/webinars
----------------------------------------------------------------------

--
You received this message because you are subscribed to the Google Groups 
"JPassion.com: Java Programming" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/jpassion_java?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to