Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7619363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:40:07+00:00 2026-05-31T03:40:07+00:00

Hi I am following this tutorial: http://www.mastertheboss.com/hibernate/182-hibernate-tutorial.html I have done all the code so

  • 0

Hi I am following this tutorial: http://www.mastertheboss.com/hibernate/182-hibernate-tutorial.html

I have done all the code so I add this run configuration:
package -e -DgroupId=it.michelepierri -DartifactId=FirstExampleHibernate

This is my 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>it.michele</groupId>
<artifactId>FirstExampleHibernate</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>FirstExampleHibernate</name>
<description>Primo esempio di utilizzo Hibernate</description>

<dependencies>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core<!--or hibernate-core--></artifactId>
        <version>3.3.2.GA</version>
        <type>pom</type>
        <!--hibernate-dependencies is a pom, not needed for hibernate-core -->
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-annotations</artifactId>
        <version>3.4.0.GA</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>3.1.0.GA</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.5.8</version>
    </dependency>
    <dependency>
        <groupId>antlr</groupId>
        <artifactId>antlr</artifactId>
        <version>2.7.6</version>
    </dependency>
    <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>dom4j</groupId>
        <artifactId>dom4j</artifactId>
        <version>1.6.1</version>
    </dependency>
    <dependency>
        <groupId>javassist</groupId>
        <artifactId>javassist</artifactId>
        <version>3.4.GA</version>
    </dependency>
    <dependency>
        <groupId>javax.transaction</groupId>
        <artifactId>jta</artifactId>
        <version>1.1</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.18</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-jdk14</artifactId>
        <version>1.6.4</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>it.michele.TestPerson</mainClass>
                        <packageName>it.michele</packageName>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

So I run it and console says me:

    -------------------------------------------------------
 T E S T S
-------------------------------------------------------
There are no tests to run.

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ FirstExampleHibernate ---
[INFO] Building jar: C:\Users\Michele\workspace\FirstExampleHibernate\target\FirstExampleHibernate-0.0.1-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.707s
[INFO] Finished at: Sun Mar 11 14:59:50 CET 2012
[INFO] Final Memory: 5M/77M
[INFO] ------------------------------------------------------------------------

When I try to launch the jar I have returned:

C:\Users\Michele\workspace\FirstExampleHibernate\target>java -jar 

FirstExampleHibernate-0.0.1-SNAPSH
OT.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/Session
Caused by: java.lang.ClassNotFoundException: org.hibernate.Session
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: it.michelepierri.TestPerson. Program will exit.

What I am doing wrong??????
In TestPerson.java class there is public static void main(String[] args) method.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T03:40:09+00:00Added an answer on May 31, 2026 at 3:40 am

    You are encountering the problem because all the supporting jars (hibernate etc) are not specified in the classpath.

    Try

    mvn exec:java -Dexec.mainClass=it.michelepierri.TestPerson
    

    This is a maven command that will internally invoke java with all the dependent jars added to the classpath.

    You can also try

    mvn assembly:single
    

    which will combine all the jars into one which you then use the run it the way you are doing now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm following this tutorial on Flash Pro CS4: http://www.baycongroup.com/flashCS4/09_flashCS4.html I have a button. I
http://www.codinghorror.com/blog/2008/04/setting-up-subversion-on-windows.html I am following this as a guide to install subversion. The tutorial at
I was following this tutorial: http://www.marcofolio.net/webdesign/a_fancy_apple.com-style_search_suggestion.html And checking out the demo here: http://qpoit.com/marcofolio_demo/apple_search/ I
I am following this tutorial http://www.codeproject.com/KB/cpp/authforwebservices.aspx They have this in the tutorial [SoapHeader(Authentication, Required
I have been following this tutorial series for OpenGL : GLUT : http://www.lighthouse3d.com/opengl/glut/ I
I'm following this tutorial on creating buttons with CSS. http://www.secondpicture.com/tutorials/web_design/css_ul_li_horizontal_css_menu.html The background for the
I have been learning RESTful webservices following this tutorial http://www.vogella.de/articles/REST/article.html . As I understand,
I am following this tutorial to make a repeater control: http://www.w3schools.com/ASPNET/aspnet_repeater.asp I have successfully
I have created a dataset with the C# designer following this tutorial http://www.devx.com/dotnet/Article/28678/1954 ;
I'm using Ubuntu 10, python 2.6.5 I'm following this tutorial: http://www.djangobook.com/en/2.0/chapter02 I followed all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.