Re: Problem concerning Maven with Hibernate JPA

2009-02-17 Thread Wayne Fay
 Unfortunately, I get the an error (see below) when I am creating a jar file
 and run the program afterwards. As I can see, of course, the
 javax.persistence jar provided by the ejb3-persistence.jar is obviously
 missing. But I don't know how to fix the problem. When I'm running the
 program as a simple Java Desktop App, everything is fine.

How are you creating a jar file and run the program? Unless you
build a special package eg with the assembly plugin, it will only
contain your project code and not the dependencies etc.

What are your expectations?

Wayne

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: Problem concerning Maven with Hibernate JPA

2009-02-17 Thread Martin Chmielewski
Hi Wayne,

thank you for your answer. I should be more
precised in my descriptions... Here are the facts, in hope to give you some
hints:

 - It's a desktop java app
 - I'm using the m2eclipse plugin
 - m2eclipse creates a jar file for me to run it as a desktop java app
 - m2eclipse runs with the goals: goals: compile test-compile test
 - junit tests work fine (where database stuff is tested)
 - there's an exec plugin (groupid: org.codehaus.mojo, artifactid:
exec-maven-plugin) which executes the jar after building it. The jar
principally works, but the first time, I'm using a database related process,
I get this error.

Hope, that helps - if you need any more information, please let me know. I
know about the assembly program and I tried to execute the goal
assembly:assembly, but it didn't work...

If you need any more information to solve this problem, please let me know.

Thanks in advance for your support,
Martin

Wayne Fay wayne...@gmail.com schrieb:
 Unfortunately, I get the an error (see below) when I am creating a jar
file
 and run the program afterwards. As I can see, of course, the
 javax.persistence jar provided by the ejb3-persistence.jar is obviously
 missing. But I don't know how to fix the problem. When I'm running the
 program as a simple Java Desktop App, everything is fine.
 
 How are you creating a jar file and run the program? Unless you
 build a special package eg with the assembly plugin, it will only
 contain your project code and not the dependencies etc.
 
 What are your expectations?
 
 Wayne
 
 -
 To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
 For additional commands, e-mail: users-h...@maven.apache.org
 
 



-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: Problem concerning Maven with Hibernate JPA

2009-02-17 Thread Wayne Fay
  - there's an exec plugin (groupid: org.codehaus.mojo, artifactid:
 exec-maven-plugin) which executes the jar after building it. The jar
 principally works, but the first time, I'm using a database related process,
 I get this error.

What does your exec-maven-plugin configuration look like? It seems
like it does not know about this dependency, so it is not including it
in the Java classpath when your program runs which results in the
NCDFE.

 know about the assembly program and I tried to execute the goal
 assembly:assembly, but it didn't work...

You're going to have to do some reading about the assembly plugin to
make it work, that's not sufficient.

Wayne

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Problem concerning Maven with Hibernate JPA

2009-02-16 Thread Martin Chmielewski
Hi,

 

I have only little experience with Maven. Currently, I'm working on a
project with JPA. It's a desktop application without Application Server. I
added the hibernate-entitymanager-3.4.0.GA.jar to the dependencies (all
corresponding dependencies are resolved by Maven). My JUnit tests concerning
Hibernate and Entities run fine with no errors (so I guess that Maven
principally runs fine).

Unfortunately, I get the an error (see below) when I am creating a jar file
and run the program afterwards. As I can see, of course, the
javax.persistence jar provided by the ejb3-persistence.jar is obviously
missing. But I don't know how to fix the problem. When I'm running the
program as a simple Java Desktop App, everything is fine.

 

If you could provide me any more information, that would be great.

 

Thanks in advance.

 

Martin

 

[INFO] Exception in thread AWT-EventQueue-0
java.lang.NoClassDefFoundError: javax/persistence/Persistence

[INFO]  at
de.bamannheim.grademaster.database.DatabaseConnection.init(DatabaseConnect
ion.java:32)

[INFO]  at
de.bamannheim.grademaster.database.UserPersistence.loadUser(UserPersistence.
java:86)

[INFO]  at de.bamannheim.grademaster.meta.Session.login(Session.java:84)

[INFO]  at
de.bamannheim.grademaster.gui.Login.myJBtnLoginMouseClicked(Login.java:137)

[INFO]  at de.bamannheim.grademaster.gui.Login.access$2(Login.java:134)

[INFO]  at
de.bamannheim.grademaster.gui.Login$3.mouseClicked(Login.java:76)

[INFO]  at
java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)

[INFO]  at java.awt.Component.processMouseEvent(Component.java:6137)

[INFO]  at
javax.swing.JComponent.processMouseEvent(JComponent.java:3265)

[INFO]  at java.awt.Component.processEvent(Component.java:5899)

[INFO]  at java.awt.Container.processEvent(Container.java:2023)

[INFO]  at java.awt.Component.dispatchEventImpl(Component.java:4501)

[INFO]  at java.awt.Container.dispatchEventImpl(Container.java:2081)

[INFO]  at java.awt.Component.dispatchEvent(Component.java:4331)

[INFO]  at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)

[INFO]  at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:3974)

[INFO]  at
java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)

[INFO]  at java.awt.Container.dispatchEventImpl(Container.java:2067)

[INFO]  at java.awt.Window.dispatchEventImpl(Window.java:2458)

[INFO]  at java.awt.Component.dispatchEvent(Component.java:4331)

[INFO]  at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)

[INFO]  at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java
:269)

[INFO]  at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:18
4)

[INFO]  at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:174)

[INFO]  at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)

[INFO]  at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)

[INFO]  at
java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

[INFO] Caused by: java.lang.ClassNotFoundException:
javax.persistence.Persistence

[INFO]  at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

[INFO]  at java.security.AccessController.doPrivileged(Native Method)

[INFO]  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

[INFO]  at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

[INFO]  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

[INFO]  at java.lang.ClassLoader.loadClass(ClassLoader.java:252)

[INFO]  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

[INFO]  ... 27 more



Re: Problem concerning Maven with Hibernate JPA

2009-02-16 Thread David C. Hicks

Martin,
While the app I'm currently working on is a web-based app, I have an 
explicit dependency declare for the persistence API.  Whether it is 
necessary, I'm not sure, but it's in the POM.  So, I thought I'd reply 
with it for you.


   dependency
   rgroupIdjavax.persistence/groupId
   artifactIdpersistence-api/artifactId
   version1.0/version
   /dependency

I hope this is helpful,
Dave


Martin Chmielewski wrote:

Hi,

 


I have only little experience with Maven. Currently, I'm working on a
project with JPA. It's a desktop application without Application Server. I
added the hibernate-entitymanager-3.4.0.GA.jar to the dependencies (all
corresponding dependencies are resolved by Maven). My JUnit tests concerning
Hibernate and Entities run fine with no errors (so I guess that Maven
principally runs fine).

Unfortunately, I get the an error (see below) when I am creating a jar file
and run the program afterwards. As I can see, of course, the
javax.persistence jar provided by the ejb3-persistence.jar is obviously
missing. But I don't know how to fix the problem. When I'm running the
program as a simple Java Desktop App, everything is fine.

 


If you could provide me any more information, that would be great.

 


Thanks in advance.

 


Martin

 


[INFO] Exception in thread AWT-EventQueue-0
java.lang.NoClassDefFoundError: javax/persistence/Persistence

[INFO]  at
de.bamannheim.grademaster.database.DatabaseConnection.init(DatabaseConnect
ion.java:32)

[INFO]  at
de.bamannheim.grademaster.database.UserPersistence.loadUser(UserPersistence.
java:86)

[INFO]  at de.bamannheim.grademaster.meta.Session.login(Session.java:84)

[INFO]  at
de.bamannheim.grademaster.gui.Login.myJBtnLoginMouseClicked(Login.java:137)

[INFO]  at de.bamannheim.grademaster.gui.Login.access$2(Login.java:134)

[INFO]  at
de.bamannheim.grademaster.gui.Login$3.mouseClicked(Login.java:76)

[INFO]  at
java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)

[INFO]  at java.awt.Component.processMouseEvent(Component.java:6137)

[INFO]  at
javax.swing.JComponent.processMouseEvent(JComponent.java:3265)

[INFO]  at java.awt.Component.processEvent(Component.java:5899)

[INFO]  at java.awt.Container.processEvent(Container.java:2023)

[INFO]  at java.awt.Component.dispatchEventImpl(Component.java:4501)

[INFO]  at java.awt.Container.dispatchEventImpl(Container.java:2081)

[INFO]  at java.awt.Component.dispatchEvent(Component.java:4331)

[INFO]  at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)

[INFO]  at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:3974)

[INFO]  at
java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)

[INFO]  at java.awt.Container.dispatchEventImpl(Container.java:2067)

[INFO]  at java.awt.Window.dispatchEventImpl(Window.java:2458)

[INFO]  at java.awt.Component.dispatchEvent(Component.java:4331)

[INFO]  at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)

[INFO]  at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java
:269)

[INFO]  at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:18
4)

[INFO]  at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:174)

[INFO]  at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)

[INFO]  at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)

[INFO]  at
java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

[INFO] Caused by: java.lang.ClassNotFoundException:
javax.persistence.Persistence

[INFO]  at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

[INFO]  at java.security.AccessController.doPrivileged(Native Method)

[INFO]  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

[INFO]  at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

[INFO]  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

[INFO]  at java.lang.ClassLoader.loadClass(ClassLoader.java:252)

[INFO]  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

[INFO]  ... 27 more


  


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org