Quantcast

java.lang.ClassNotFoundException: javax.persistence.PersistenceException

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

java.lang.ClassNotFoundException: javax.persistence.PersistenceException

opyate
Hello,

I'm using:
Maven 2.0.10 (my project has many failing tests, and Maven does not
stop on failure)
JDK 1.6.0_12
Sonar 1.10.1 (hosted on "sonar" with MySQL 5.0.72sp1-enterprise-gpl)
Artifactory 2.0.6 (has the "sonar" repo with the timestamped dependencies)

The project is a multi-module project, with the following configured
in the root POM:

<build>
                <plugins>
                        <plugin>
                                <groupId>org.codehaus.mojo</groupId>
                                <artifactId>sonar-maven-plugin</artifactId>
                        </plugin>
                </plugins>
...
</build>


I use the command below to build:

mvn clean install  -e  sonar:sonar -Dsonar.host.url=http://sonar:9000
-Dsonar.jdbc.url=jdbc:mysql://sonar:3306/sonar?useUnicode=true\&characterEncoding=utf8
-Dsonar.jdbc.driver=com.mysql.jdbc.Driver -Dsonar.jdbc.username=sonar
-Dsonar.jdbc.password=sonar

I then get the following error and stack trace:
BUILD ERROR
Can not execute Sonar

#stack trace start#
Embedded error: Unable to find the mojo
'org.codehaus.sonar.runtime:sonar-core-maven-plugin:20090915152427:internal'
in the plugin 'org.codehaus.sonar.runtime:sonar-core-maven-plugin'
javax.persistence.PersistenceException
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute Sonar
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:584)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:513)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:483)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:331)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:228)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:301)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
        at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:87)
        at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65)
        at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:117)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:453)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
        ... 16 more
Caused by: org.apache.maven.plugin.PluginManagerException: Unable to
find the mojo 'org.codehaus.sonar.runtime:sonar-core-maven-plugin:20090915152427:internal'
in the plugin 'org.codehaus.sonar.runtime:sonar-core-maven-plugin'
        at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:620)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:431)
        at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:82)
        ... 20 more
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException:
Unable to lookup component
'org.apache.maven.plugin.Mojoorg.codehaus.sonar.runtime:sonar-core-maven-plugin:20090915152427:internal',
it could not be created
        at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:335)
        at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:440)
        at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:611)
        ... 22 more
Caused by: org.codehaus.plexus.component.factory.ComponentInstantiationException:
Could not instanciate component: role: 'null', implementation:
'org.sonar.batch.BatchMojo'
        at org.codehaus.plexus.component.factory.java.JavaComponentFactory.makeException(JavaComponentFactory.java:77)
        at org.codehaus.plexus.component.factory.java.JavaComponentFactory.newInstance(JavaComponentFactory.java:62)
        at org.codehaus.plexus.DefaultPlexusContainer.createComponentInstance(DefaultPlexusContainer.java:1464)
        at org.codehaus.plexus.component.manager.AbstractComponentManager.createComponentInstance(AbstractComponentManager.java:93)
        at org.codehaus.plexus.component.manager.PerLookupComponentManager.getComponent(PerLookupComponentManager.java:48)
        at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:331)
        ... 24 more
Caused by: java.lang.NoClassDefFoundError:
javax/persistence/PersistenceException
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
        at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
        at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
        at java.lang.Class.getConstructor0(Class.java:2699)
        at java.lang.Class.newInstance0(Class.java:326)
        at java.lang.Class.newInstance(Class.java:308)
        at org.codehaus.plexus.component.factory.java.JavaComponentFactory.newInstance(JavaComponentFactory.java:44)
        ... 28 more
Caused by: java.lang.ClassNotFoundException:
javax.persistence.PersistenceException
        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 org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
        at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
        at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
        at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        ... 48 more
#stack trace end#


I've tried adding JPA as a dependency in the root POM:

<build>
                <plugins>
                        <plugin>
                                <groupId>org.codehaus.mojo</groupId>
                                <artifactId>sonar-maven-plugin</artifactId>
                                <dependencies>
                                        <dependency>

<groupId>javax.persistence</groupId>

<artifactId>persistence-api</artifactId>
                                                <version>1.0</version>
                                        </dependency>
                                </dependencies>
                        </plugin>
                </plugins>
...
</build>

...but, to be honest, this is just grasping for straws - I have no
idea where this JPA dependency comes in (mvn dependency:tree|grep
persistence  yields nothing, but the project does use Hibernate
3.2.6.ga).

I've also tried by-passing my Artifactory server (even after deleting
~/.m2) but I still get the same stack trace.

Can someone please shed some light?

Thanks,

Juan

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: java.lang.ClassNotFoundException: javax.persistence.PersistenceException

Freddy Mallet
Hi Juan,

The class javax.persistence.PersistenceException is contained in the org.hibernate:ejb3-persistence:jar:1.0.2.GA jar. Looks like this jar is corrupted in your local repository or perhaps you've defined a Maven policy which prevents to use it ?

Hope it helps,
Freddy

On Tue, Sep 15, 2009 at 6:00 PM, Juan M Uys <[hidden email]> wrote:
Hello,

I'm using:
Maven 2.0.10 (my project has many failing tests, and Maven does not
stop on failure)
JDK 1.6.0_12
Sonar 1.10.1 (hosted on "sonar" with MySQL 5.0.72sp1-enterprise-gpl)
Artifactory 2.0.6 (has the "sonar" repo with the timestamped dependencies)

The project is a multi-module project, with the following configured
in the root POM:

<build>
               <plugins>
                       <plugin>
                               <groupId>org.codehaus.mojo</groupId>
                               <artifactId>sonar-maven-plugin</artifactId>
                       </plugin>
               </plugins>
...
</build>


I use the command below to build:

mvn clean install  -e  sonar:sonar -Dsonar.host.url=http://sonar:9000
-Dsonar.jdbc.url=jdbc:mysql://sonar:3306/sonar?useUnicode=true\&characterEncoding=utf8
-Dsonar.jdbc.driver=com.mysql.jdbc.Driver -Dsonar.jdbc.username=sonar
-Dsonar.jdbc.password=sonar

I then get the following error and stack trace:
BUILD ERROR
Can not execute Sonar

#stack trace start#
Embedded error: Unable to find the mojo
'org.codehaus.sonar.runtime:sonar-core-maven-plugin:20090915152427:internal'
in the plugin 'org.codehaus.sonar.runtime:sonar-core-maven-plugin'
javax.persistence.PersistenceException
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute Sonar
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:584)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:513)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:483)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:331)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:228)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
       at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
       at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
       at org.apache.maven.cli.MavenCli.main(MavenCli.java:301)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
       at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
       at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
       at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
       at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:87)
       at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65)
       at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:117)
       at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:453)
       at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
       ... 16 more
Caused by: org.apache.maven.plugin.PluginManagerException: Unable to
find the mojo 'org.codehaus.sonar.runtime:sonar-core-maven-plugin:20090915152427:internal'
in the plugin 'org.codehaus.sonar.runtime:sonar-core-maven-plugin'
       at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:620)
       at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:431)
       at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:82)
       ... 20 more
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException:
Unable to lookup component
'org.apache.maven.plugin.Mojoorg.codehaus.sonar.runtime:sonar-core-maven-plugin:20090915152427:internal',
it could not be created
       at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:335)
       at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:440)
       at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:611)
       ... 22 more
Caused by: org.codehaus.plexus.component.factory.ComponentInstantiationException:
Could not instanciate component: role: 'null', implementation:
'org.sonar.batch.BatchMojo'
       at org.codehaus.plexus.component.factory.java.JavaComponentFactory.makeException(JavaComponentFactory.java:77)
       at org.codehaus.plexus.component.factory.java.JavaComponentFactory.newInstance(JavaComponentFactory.java:62)
       at org.codehaus.plexus.DefaultPlexusContainer.createComponentInstance(DefaultPlexusContainer.java:1464)
       at org.codehaus.plexus.component.manager.AbstractComponentManager.createComponentInstance(AbstractComponentManager.java:93)
       at org.codehaus.plexus.component.manager.PerLookupComponentManager.getComponent(PerLookupComponentManager.java:48)
       at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:331)
       ... 24 more
Caused by: java.lang.NoClassDefFoundError:
javax/persistence/PersistenceException
       at java.lang.ClassLoader.defineClass1(Native Method)
       at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
       at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
       at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
       at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
       at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
       at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
       at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
       at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
       at java.lang.Class.getDeclaredConstructors0(Native Method)
       at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
       at java.lang.Class.getConstructor0(Class.java:2699)
       at java.lang.Class.newInstance0(Class.java:326)
       at java.lang.Class.newInstance(Class.java:308)
       at org.codehaus.plexus.component.factory.java.JavaComponentFactory.newInstance(JavaComponentFactory.java:44)
       ... 28 more
Caused by: java.lang.ClassNotFoundException:
javax.persistence.PersistenceException
       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 org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
       at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
       at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
       at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
       ... 48 more
#stack trace end#


I've tried adding JPA as a dependency in the root POM:

<build>
               <plugins>
                       <plugin>
                               <groupId>org.codehaus.mojo</groupId>
                               <artifactId>sonar-maven-plugin</artifactId>
                               <dependencies>
                                       <dependency>

<groupId>javax.persistence</groupId>

<artifactId>persistence-api</artifactId>
                                               <version>1.0</version>
                                       </dependency>
                               </dependencies>
                       </plugin>
               </plugins>
...
</build>

...but, to be honest, this is just grasping for straws - I have no
idea where this JPA dependency comes in (mvn dependency:tree|grep
persistence  yields nothing, but the project does use Hibernate
3.2.6.ga).

I've also tried by-passing my Artifactory server (even after deleting
~/.m2) but I still get the same stack trace.

Can someone please shed some light?

Thanks,

Juan

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: java.lang.ClassNotFoundException: javax.persistence.PersistenceException

opyate
Thanks for the reply, Freddy.

Your checklist:
* The sha1sums match up, so no corruption (I compared the JARs in
~/.m2, my Artifactory server, and the public repo)
* I don't have any exclusions in my POM which excludes the persistence JAR.

Extra checks:
* I also do not have a CLASSPATH defined on the systems I tested this
on (my dev box and the CI server).
* My dev box's mvn is managed by the Debian alternatives system, but
the CI server's mvn is installed by hand, and calling the sonar plugin
via Hudson gives the same results. I tried the builds with/without
M2_HOME defined.
* I also tried Maven 2.1.0 (by pointing Debian's alternatives system
to this new alternative binary).

Other thoughts:
* Maven classloading spaces and how the Maven internals work,
specifically with regards to the RealmClassLoader.class - I may need
to see where Maven looks for this JAR, unless someone can tell me...
* the only "persistence" JAR I have in my ~/.m2 after running said mvn
command is:

juan@rebelbase:~$ find ~/.m2 -name \*persistence*
/home/juan/.m2/repository/javax/persistence
/home/juan/.m2/repository/javax/persistence/persistence-api
/home/juan/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.pom
/home/juan/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar.sha1
/home/juan/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.pom.sha1
/home/juan/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar

find ~/.m2 -name \*ejb* yields nothing.
mvn dependency:tree|grep ejb yields nothing.

What am I supposed to expect?

Where in the chain is this persistence class needed? During instrumenting?

Thanks,
Juan

2009/9/16 Freddy Mallet <[hidden email]>:

> Hi Juan,
>
> The class javax.persistence.PersistenceException is contained in the
> org.hibernate:ejb3-persistence:jar:1.0.2.GA jar. Looks like this jar is
> corrupted in your local repository or perhaps you've defined a Maven policy
> which prevents to use it ?
>
> Hope it helps,
> Freddy
>
> On Tue, Sep 15, 2009 at 6:00 PM, Juan M Uys <[hidden email]> wrote:
>>
>> Hello,
>>
>> I'm using:
>> Maven 2.0.10 (my project has many failing tests, and Maven does not
>> stop on failure)
>> JDK 1.6.0_12
>> Sonar 1.10.1 (hosted on "sonar" with MySQL 5.0.72sp1-enterprise-gpl)
>> Artifactory 2.0.6 (has the "sonar" repo with the timestamped dependencies)
>>
>> The project is a multi-module project, with the following configured
>> in the root POM:
>>
>> <build>
>>                <plugins>
>>                        <plugin>
>>                                <groupId>org.codehaus.mojo</groupId>
>>                                <artifactId>sonar-maven-plugin</artifactId>
>>                        </plugin>
>>                </plugins>
>> ...
>> </build>
>>
>>
>> I use the command below to build:
>>
>> mvn clean install  -e  sonar:sonar -Dsonar.host.url=http://sonar:9000
>>
>> -Dsonar.jdbc.url=jdbc:mysql://sonar:3306/sonar?useUnicode=true\&characterEncoding=utf8
>> -Dsonar.jdbc.driver=com.mysql.jdbc.Driver -Dsonar.jdbc.username=sonar
>> -Dsonar.jdbc.password=sonar
>>
>> I then get the following error and stack trace:
>> BUILD ERROR
>> Can not execute Sonar
>>
>> #stack trace start#
>> Embedded error: Unable to find the mojo
>>
>> 'org.codehaus.sonar.runtime:sonar-core-maven-plugin:20090915152427:internal'
>> in the plugin 'org.codehaus.sonar.runtime:sonar-core-maven-plugin'
>> javax.persistence.PersistenceException
>> [INFO]
>> ------------------------------------------------------------------------
>> [INFO] Trace
>> org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute
>> Sonar
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:584)
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:513)
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:483)
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:331)
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:228)
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
>>        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
>>        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
>>        at org.apache.maven.cli.MavenCli.main(MavenCli.java:301)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>        at
>> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>>        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>>        at
>> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>>        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>> Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute
>> Sonar
>>        at
>> org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:87)
>>        at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65)
>>        at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:117)
>>        at
>> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:453)
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
>>        ... 16 more
>> Caused by: org.apache.maven.plugin.PluginManagerException: Unable to
>> find the mojo
>> 'org.codehaus.sonar.runtime:sonar-core-maven-plugin:20090915152427:internal'
>> in the plugin 'org.codehaus.sonar.runtime:sonar-core-maven-plugin'
>>        at
>> org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:620)
>>        at
>> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:431)
>>        at
>> org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:82)
>>        ... 20 more
>> Caused by:
>> org.codehaus.plexus.component.repository.exception.ComponentLookupException:
>> Unable to lookup component
>>
>> 'org.apache.maven.plugin.Mojoorg.codehaus.sonar.runtime:sonar-core-maven-plugin:20090915152427:internal',
>> it could not be created
>>        at
>> org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:335)
>>        at
>> org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:440)
>>        at
>> org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:611)
>>        ... 22 more
>> Caused by:
>> org.codehaus.plexus.component.factory.ComponentInstantiationException:
>> Could not instanciate component: role: 'null', implementation:
>> 'org.sonar.batch.BatchMojo'
>>        at
>> org.codehaus.plexus.component.factory.java.JavaComponentFactory.makeException(JavaComponentFactory.java:77)
>>        at
>> org.codehaus.plexus.component.factory.java.JavaComponentFactory.newInstance(JavaComponentFactory.java:62)
>>        at
>> org.codehaus.plexus.DefaultPlexusContainer.createComponentInstance(DefaultPlexusContainer.java:1464)
>>        at
>> org.codehaus.plexus.component.manager.AbstractComponentManager.createComponentInstance(AbstractComponentManager.java:93)
>>        at
>> org.codehaus.plexus.component.manager.PerLookupComponentManager.getComponent(PerLookupComponentManager.java:48)
>>        at
>> org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:331)
>>        ... 24 more
>> Caused by: java.lang.NoClassDefFoundError:
>> javax/persistence/PersistenceException
>>        at java.lang.ClassLoader.defineClass1(Native Method)
>>        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
>>        at
>> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>>        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
>>        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
>>        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>>        at
>> org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
>>        at
>> org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
>>        at
>> org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>>        at java.lang.Class.getDeclaredConstructors0(Native Method)
>>        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>>        at java.lang.Class.getConstructor0(Class.java:2699)
>>        at java.lang.Class.newInstance0(Class.java:326)
>>        at java.lang.Class.newInstance(Class.java:308)
>>        at
>> org.codehaus.plexus.component.factory.java.JavaComponentFactory.newInstance(JavaComponentFactory.java:44)
>>        ... 28 more
>> Caused by: java.lang.ClassNotFoundException:
>> javax.persistence.PersistenceException
>>        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
>> org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
>>        at
>> org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
>>        at
>> org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
>>        at
>> org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>>        ... 48 more
>> #stack trace end#
>>
>>
>> I've tried adding JPA as a dependency in the root POM:
>>
>> <build>
>>                <plugins>
>>                        <plugin>
>>                                <groupId>org.codehaus.mojo</groupId>
>>                                <artifactId>sonar-maven-plugin</artifactId>
>>                                <dependencies>
>>                                        <dependency>
>>
>> <groupId>javax.persistence</groupId>
>>
>> <artifactId>persistence-api</artifactId>
>>                                                <version>1.0</version>
>>                                        </dependency>
>>                                </dependencies>
>>                        </plugin>
>>                </plugins>
>> ...
>> </build>
>>
>> ...but, to be honest, this is just grasping for straws - I have no
>> idea where this JPA dependency comes in (mvn dependency:tree|grep
>> persistence  yields nothing, but the project does use Hibernate
>> 3.2.6.ga).
>>
>> I've also tried by-passing my Artifactory server (even after deleting
>> ~/.m2) but I still get the same stack trace.
>>
>> Can someone please shed some light?
>>
>> Thanks,
>>
>> Juan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
>



--
juan
+44 7702 783 956
Samuel Goldwyn  - "I'm willing to admit that I may not always be
right, but I am never wrong." -
http://www.brainyquote.com/quotes/authors/s/samuel_goldwyn.html

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: java.lang.ClassNotFoundException: javax.persistence.PersistenceException

opyate
Hey guys,

I also tried adding ejb3-persistence.jar as a dependency in all the
POMs that has hibernate as a dependency, to no avail.

BUT... I guess I was onto something with the "RealmClassLoader" comment below.

What I've done is add the following line in $M2_HOME/bin/m2.conf (the
'classworlds' configuration for Maven):

load /some/path/ejb3-persistence-1.0.1.GA.jar

Now I get new ClassNotFoundException stack traces, which I can solve
in a similar fashion.
(FYI, the new root cause is:
Caused by: java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver)

But the question still remains what the ACTUAL problem is. If a Maven
"dependency" tag does not add it to my classpath, how do I need to get
it into my classpath without hacking at the 'classworlds' config?

I found some info here:
http://classworlds.codehaus.org/launchusage.html

Thanks,
Juan

2009/9/16 Juan M Uys <[hidden email]>:

> Thanks for the reply, Freddy.
>
> Your checklist:
> * The sha1sums match up, so no corruption (I compared the JARs in
> ~/.m2, my Artifactory server, and the public repo)
> * I don't have any exclusions in my POM which excludes the persistence JAR.
>
> Extra checks:
> * I also do not have a CLASSPATH defined on the systems I tested this
> on (my dev box and the CI server).
> * My dev box's mvn is managed by the Debian alternatives system, but
> the CI server's mvn is installed by hand, and calling the sonar plugin
> via Hudson gives the same results. I tried the builds with/without
> M2_HOME defined.
> * I also tried Maven 2.1.0 (by pointing Debian's alternatives system
> to this new alternative binary).
>
> Other thoughts:
> * Maven classloading spaces and how the Maven internals work,
> specifically with regards to the RealmClassLoader.class - I may need
> to see where Maven looks for this JAR, unless someone can tell me...
> * the only "persistence" JAR I have in my ~/.m2 after running said mvn
> command is:
>
> juan@rebelbase:~$ find ~/.m2 -name \*persistence*
> /home/juan/.m2/repository/javax/persistence
> /home/juan/.m2/repository/javax/persistence/persistence-api
> /home/juan/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.pom
> /home/juan/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar.sha1
> /home/juan/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.pom.sha1
> /home/juan/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar
>
> find ~/.m2 -name \*ejb* yields nothing.
> mvn dependency:tree|grep ejb yields nothing.
>
> What am I supposed to expect?
>
> Where in the chain is this persistence class needed? During instrumenting?
>
> Thanks,
> Juan
>
> 2009/9/16 Freddy Mallet <[hidden email]>:
>> Hi Juan,
>>
>> The class javax.persistence.PersistenceException is contained in the
>> org.hibernate:ejb3-persistence:jar:1.0.2.GA jar. Looks like this jar is
>> corrupted in your local repository or perhaps you've defined a Maven policy
>> which prevents to use it ?
>>
>> Hope it helps,
>> Freddy
>>
>> On Tue, Sep 15, 2009 at 6:00 PM, Juan M Uys <[hidden email]> wrote:
>>>
>>> Hello,
>>>
>>> I'm using:
>>> Maven 2.0.10 (my project has many failing tests, and Maven does not
>>> stop on failure)
>>> JDK 1.6.0_12
>>> Sonar 1.10.1 (hosted on "sonar" with MySQL 5.0.72sp1-enterprise-gpl)
>>> Artifactory 2.0.6 (has the "sonar" repo with the timestamped dependencies)
>>>
>>> The project is a multi-module project, with the following configured
>>> in the root POM:
>>>
>>> <build>
>>>                <plugins>
>>>                        <plugin>
>>>                                <groupId>org.codehaus.mojo</groupId>
>>>                                <artifactId>sonar-maven-plugin</artifactId>
>>>                        </plugin>
>>>                </plugins>
>>> ...
>>> </build>
>>>
>>>
>>> I use the command below to build:
>>>
>>> mvn clean install  -e  sonar:sonar -Dsonar.host.url=http://sonar:9000
>>>
>>> -Dsonar.jdbc.url=jdbc:mysql://sonar:3306/sonar?useUnicode=true\&characterEncoding=utf8
>>> -Dsonar.jdbc.driver=com.mysql.jdbc.Driver -Dsonar.jdbc.username=sonar
>>> -Dsonar.jdbc.password=sonar
>>>
>>> I then get the following error and stack trace:
>>> BUILD ERROR
>>> Can not execute Sonar
>>>
>>> #stack trace start#
>>> Embedded error: Unable to find the mojo
>>>
>>> 'org.codehaus.sonar.runtime:sonar-core-maven-plugin:20090915152427:internal'
>>> in the plugin 'org.codehaus.sonar.runtime:sonar-core-maven-plugin'
>>> javax.persistence.PersistenceException
>>> [INFO]
>>> ------------------------------------------------------------------------
>>> [INFO] Trace
>>> org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute
>>> Sonar
>>>        at
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:584)
>>>        at
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:513)
>>>        at
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:483)
>>>        at
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:331)
>>>        at
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:228)
>>>        at
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
>>>        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
>>>        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
>>>        at org.apache.maven.cli.MavenCli.main(MavenCli.java:301)
>>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>        at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>        at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>>        at
>>> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>>>        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>>>        at
>>> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>>>        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>>> Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute
>>> Sonar
>>>        at
>>> org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:87)
>>>        at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65)
>>>        at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:117)
>>>        at
>>> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:453)
>>>        at
>>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
>>>        ... 16 more
>>> Caused by: org.apache.maven.plugin.PluginManagerException: Unable to
>>> find the mojo
>>> 'org.codehaus.sonar.runtime:sonar-core-maven-plugin:20090915152427:internal'
>>> in the plugin 'org.codehaus.sonar.runtime:sonar-core-maven-plugin'
>>>        at
>>> org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:620)
>>>        at
>>> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:431)
>>>        at
>>> org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:82)
>>>        ... 20 more
>>> Caused by:
>>> org.codehaus.plexus.component.repository.exception.ComponentLookupException:
>>> Unable to lookup component
>>>
>>> 'org.apache.maven.plugin.Mojoorg.codehaus.sonar.runtime:sonar-core-maven-plugin:20090915152427:internal',
>>> it could not be created
>>>        at
>>> org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:335)
>>>        at
>>> org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:440)
>>>        at
>>> org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:611)
>>>        ... 22 more
>>> Caused by:
>>> org.codehaus.plexus.component.factory.ComponentInstantiationException:
>>> Could not instanciate component: role: 'null', implementation:
>>> 'org.sonar.batch.BatchMojo'
>>>        at
>>> org.codehaus.plexus.component.factory.java.JavaComponentFactory.makeException(JavaComponentFactory.java:77)
>>>        at
>>> org.codehaus.plexus.component.factory.java.JavaComponentFactory.newInstance(JavaComponentFactory.java:62)
>>>        at
>>> org.codehaus.plexus.DefaultPlexusContainer.createComponentInstance(DefaultPlexusContainer.java:1464)
>>>        at
>>> org.codehaus.plexus.component.manager.AbstractComponentManager.createComponentInstance(AbstractComponentManager.java:93)
>>>        at
>>> org.codehaus.plexus.component.manager.PerLookupComponentManager.getComponent(PerLookupComponentManager.java:48)
>>>        at
>>> org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:331)
>>>        ... 24 more
>>> Caused by: java.lang.NoClassDefFoundError:
>>> javax/persistence/PersistenceException
>>>        at java.lang.ClassLoader.defineClass1(Native Method)
>>>        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
>>>        at
>>> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>>>        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
>>>        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
>>>        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
>>>        at java.security.AccessController.doPrivileged(Native Method)
>>>        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>>>        at
>>> org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
>>>        at
>>> org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
>>>        at
>>> org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
>>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>>>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>>>        at java.lang.Class.getDeclaredConstructors0(Native Method)
>>>        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>>>        at java.lang.Class.getConstructor0(Class.java:2699)
>>>        at java.lang.Class.newInstance0(Class.java:326)
>>>        at java.lang.Class.newInstance(Class.java:308)
>>>        at
>>> org.codehaus.plexus.component.factory.java.JavaComponentFactory.newInstance(JavaComponentFactory.java:44)
>>>        ... 28 more
>>> Caused by: java.lang.ClassNotFoundException:
>>> javax.persistence.PersistenceException
>>>        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
>>> org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
>>>        at
>>> org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
>>>        at
>>> org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
>>>        at
>>> org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
>>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>>>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>>>        ... 48 more
>>> #stack trace end#
>>>
>>>
>>> I've tried adding JPA as a dependency in the root POM:
>>>
>>> <build>
>>>                <plugins>
>>>                        <plugin>
>>>                                <groupId>org.codehaus.mojo</groupId>
>>>                                <artifactId>sonar-maven-plugin</artifactId>
>>>                                <dependencies>
>>>                                        <dependency>
>>>
>>> <groupId>javax.persistence</groupId>
>>>
>>> <artifactId>persistence-api</artifactId>
>>>                                                <version>1.0</version>
>>>                                        </dependency>
>>>                                </dependencies>
>>>                        </plugin>
>>>                </plugins>
>>> ...
>>> </build>
>>>
>>> ...but, to be honest, this is just grasping for straws - I have no
>>> idea where this JPA dependency comes in (mvn dependency:tree|grep
>>> persistence  yields nothing, but the project does use Hibernate
>>> 3.2.6.ga).
>>>
>>> I've also tried by-passing my Artifactory server (even after deleting
>>> ~/.m2) but I still get the same stack trace.
>>>
>>> Can someone please shed some light?
>>>
>>> Thanks,
>>>
>>> Juan
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>    http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>>
>
>
>
> --
> juan
> +44 7702 783 956
> Samuel Goldwyn  - "I'm willing to admit that I may not always be
> right, but I am never wrong." -
> http://www.brainyquote.com/quotes/authors/s/samuel_goldwyn.html
>



--
juan
+44 7702 783 956
Ogden Nash  - "The trouble with a kitten is that when it grows up,
it's always a cat." -
http://www.brainyquote.com/quotes/authors/o/ogden_nash.html

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: java.lang.ClassNotFoundException: javax.persistence.PersistenceException

Freddy Mallet
In reply to this post by opyate
Sorry Juan, I made a mistake in my previous answer :

Sonar depends on org.hibernate:hibernate-entitymanager:jar:3.3.1.ga which depends on javax.persistence:persistence-api:jar:1.0

If you launch mvn -X sonar:sonar, the following line should appear :

[DEBUG]       javax.persistence:persistence-api:jar:1.0:runtime (selected for runtime)

But I really can't manage to figure out why this dependency is not loaded by the Maven classloader in your context :-(

Freddy



On Wed, Sep 16, 2009 at 1:09 PM, Juan M Uys <[hidden email]> wrote:
Thanks for the reply, Freddy.

Your checklist:
* The sha1sums match up, so no corruption (I compared the JARs in
~/.m2, my Artifactory server, and the public repo)
* I don't have any exclusions in my POM which excludes the persistence JAR.

Extra checks:
* I also do not have a CLASSPATH defined on the systems I tested this
on (my dev box and the CI server).
* My dev box's mvn is managed by the Debian alternatives system, but
the CI server's mvn is installed by hand, and calling the sonar plugin
via Hudson gives the same results. I tried the builds with/without
M2_HOME defined.
* I also tried Maven 2.1.0 (by pointing Debian's alternatives system
to this new alternative binary).

Other thoughts:
* Maven classloading spaces and how the Maven internals work,
specifically with regards to the RealmClassLoader.class - I may need
to see where Maven looks for this JAR, unless someone can tell me...
* the only "persistence" JAR I have in my ~/.m2 after running said mvn
command is:

juan@rebelbase:~$ find ~/.m2 -name \*persistence*
/home/juan/.m2/repository/javax/persistence
/home/juan/.m2/repository/javax/persistence/persistence-api
/home/juan/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.pom
/home/juan/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar.sha1
/home/juan/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.pom.sha1
/home/juan/.m2/repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar

find ~/.m2 -name \*ejb* yields nothing.
mvn dependency:tree|grep ejb yields nothing.

What am I supposed to expect?

Where in the chain is this persistence class needed? During instrumenting?

Thanks,
Juan

2009/9/16 Freddy Mallet <[hidden email]>:
> Hi Juan,
>
> The class javax.persistence.PersistenceException is contained in the
> org.hibernate:ejb3-persistence:jar:1.0.2.GA jar. Looks like this jar is
> corrupted in your local repository or perhaps you've defined a Maven policy
> which prevents to use it ?
>
> Hope it helps,
> Freddy
>
> On Tue, Sep 15, 2009 at 6:00 PM, Juan M Uys <[hidden email]> wrote:
>>
>> Hello,
>>
>> I'm using:
>> Maven 2.0.10 (my project has many failing tests, and Maven does not
>> stop on failure)
>> JDK 1.6.0_12
>> Sonar 1.10.1 (hosted on "sonar" with MySQL 5.0.72sp1-enterprise-gpl)
>> Artifactory 2.0.6 (has the "sonar" repo with the timestamped dependencies)
>>
>> The project is a multi-module project, with the following configured
>> in the root POM:
>>
>> <build>
>>                <plugins>
>>                        <plugin>
>>                                <groupId>org.codehaus.mojo</groupId>
>>                                <artifactId>sonar-maven-plugin</artifactId>
>>                        </plugin>
>>                </plugins>
>> ...
>> </build>
>>
>>
>> I use the command below to build:
>>
>> mvn clean install  -e  sonar:sonar -Dsonar.host.url=http://sonar:9000
>>
>> -Dsonar.jdbc.url=jdbc:mysql://sonar:3306/sonar?useUnicode=true\&characterEncoding=utf8
>> -Dsonar.jdbc.driver=com.mysql.jdbc.Driver -Dsonar.jdbc.username=sonar
>> -Dsonar.jdbc.password=sonar
>>
>> I then get the following error and stack trace:
>> BUILD ERROR
>> Can not execute Sonar
>>
>> #stack trace start#
>> Embedded error: Unable to find the mojo
>>
>> 'org.codehaus.sonar.runtime:sonar-core-maven-plugin:20090915152427:internal'
>> in the plugin 'org.codehaus.sonar.runtime:sonar-core-maven-plugin'
>> javax.persistence.PersistenceException
>> [INFO]
>> ------------------------------------------------------------------------
>> [INFO] Trace
>> org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute
>> Sonar
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:584)
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:513)
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:483)
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:331)
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:228)
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
>>        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
>>        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
>>        at org.apache.maven.cli.MavenCli.main(MavenCli.java:301)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>        at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>        at java.lang.reflect.Method.invoke(Method.java:597)
>>        at
>> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>>        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>>        at
>> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>>        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
>> Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute
>> Sonar
>>        at
>> org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:87)
>>        at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65)
>>        at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:117)
>>        at
>> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:453)
>>        at
>> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
>>        ... 16 more
>> Caused by: org.apache.maven.plugin.PluginManagerException: Unable to
>> find the mojo
>> 'org.codehaus.sonar.runtime:sonar-core-maven-plugin:20090915152427:internal'
>> in the plugin 'org.codehaus.sonar.runtime:sonar-core-maven-plugin'
>>        at
>> org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:620)
>>        at
>> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:431)
>>        at
>> org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:82)
>>        ... 20 more
>> Caused by:
>> org.codehaus.plexus.component.repository.exception.ComponentLookupException:
>> Unable to lookup component
>>
>> 'org.apache.maven.plugin.Mojoorg.codehaus.sonar.runtime:sonar-core-maven-plugin:20090915152427:internal',
>> it could not be created
>>        at
>> org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:335)
>>        at
>> org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:440)
>>        at
>> org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:611)
>>        ... 22 more
>> Caused by:
>> org.codehaus.plexus.component.factory.ComponentInstantiationException:
>> Could not instanciate component: role: 'null', implementation:
>> 'org.sonar.batch.BatchMojo'
>>        at
>> org.codehaus.plexus.component.factory.java.JavaComponentFactory.makeException(JavaComponentFactory.java:77)
>>        at
>> org.codehaus.plexus.component.factory.java.JavaComponentFactory.newInstance(JavaComponentFactory.java:62)
>>        at
>> org.codehaus.plexus.DefaultPlexusContainer.createComponentInstance(DefaultPlexusContainer.java:1464)
>>        at
>> org.codehaus.plexus.component.manager.AbstractComponentManager.createComponentInstance(AbstractComponentManager.java:93)
>>        at
>> org.codehaus.plexus.component.manager.PerLookupComponentManager.getComponent(PerLookupComponentManager.java:48)
>>        at
>> org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:331)
>>        ... 24 more
>> Caused by: java.lang.NoClassDefFoundError:
>> javax/persistence/PersistenceException
>>        at java.lang.ClassLoader.defineClass1(Native Method)
>>        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
>>        at
>> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>>        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
>>        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
>>        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>>        at
>> org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
>>        at
>> org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
>>        at
>> org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>>        at java.lang.Class.getDeclaredConstructors0(Native Method)
>>        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>>        at java.lang.Class.getConstructor0(Class.java:2699)
>>        at java.lang.Class.newInstance0(Class.java:326)
>>        at java.lang.Class.newInstance(Class.java:308)
>>        at
>> org.codehaus.plexus.component.factory.java.JavaComponentFactory.newInstance(JavaComponentFactory.java:44)
>>        ... 28 more
>> Caused by: java.lang.ClassNotFoundException:
>> javax.persistence.PersistenceException
>>        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
>> org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
>>        at
>> org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
>>        at
>> org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
>>        at
>> org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>>        ... 48 more
>> #stack trace end#
>>
>>
>> I've tried adding JPA as a dependency in the root POM:
>>
>> <build>
>>                <plugins>
>>                        <plugin>
>>                                <groupId>org.codehaus.mojo</groupId>
>>                                <artifactId>sonar-maven-plugin</artifactId>
>>                                <dependencies>
>>                                        <dependency>
>>
>> <groupId>javax.persistence</groupId>
>>
>> <artifactId>persistence-api</artifactId>
>>                                                <version>1.0</version>
>>                                        </dependency>
>>                                </dependencies>
>>                        </plugin>
>>                </plugins>
>> ...
>> </build>
>>
>> ...but, to be honest, this is just grasping for straws - I have no
>> idea where this JPA dependency comes in (mvn dependency:tree|grep
>> persistence  yields nothing, but the project does use Hibernate
>> 3.2.6.ga).
>>
>> I've also tried by-passing my Artifactory server (even after deleting
>> ~/.m2) but I still get the same stack trace.
>>
>> Can someone please shed some light?
>>
>> Thanks,
>>
>> Juan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
>



--
juan
+44 7702 783 956
Samuel Goldwyn  - "I'm willing to admit that I may not always be
right, but I am never wrong." -
http://www.brainyquote.com/quotes/authors/s/samuel_goldwyn.html

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Loading...