Hi,
 
By digging at hibernate source code it seems like the plugin was reexecuting 
configuration again (hibernate format) because of the node:
 
<configurationfile>src/test/resources/META-INF/persistence.xml</configurationfile>

so to anyone hitting this problem, dont use <configurationfile> if you are 
mapping with JPA (even if hibernate is the JPA provider).
 
Thanks,
-Guillaume

________________________________

From: Jeudy, Guillaume
Sent: Tue 05/08/2008 1:28 PM
To: user@mojo.codehaus.org
Subject: Hibernate3 Maven Plugin NPE


Hi,

I'm trying to leverage hibernate3 maven plugin with a JPA mapping.

I tried running mvn hibernate3:hbm2ddl and I get a NullPointerException 
somewhere during the loading of hibernate mappings...

Here's my plugin config:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<configuration>
<components>
<component>
<name>hbm2ddl</name>
<implementation>jpaconfiguration</implementation>
</component>
</components>
<componentProperties>
<jdk5>true</jdk5>
<ejb3>true</ejb3>
<persistenceunit>ReferenceDataManagerTestDB</persistenceunit>
<configurationfile>src/test/resources/META-INF/persistence.xml</configurationfile>
</componentProperties>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>hbm2ddl</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>${test.db.group}</groupId>
<artifactId>${test.db.artifact}</artifactId>
<version>${test.db.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</plugin>

Stacktrace:

[INFO] Trace

java.lang.NullPointerException
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1529)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1443)
at 
org.codehaus.mojo.hibernate3.configuration.AbstractComponentConfiguration.doConfiguration(AbstractComponentConfiguration.java:77)
at 
org.codehaus.mojo.hibernate3.configuration.AbstractComponentConfiguration.getConfiguration(AbstractComponentConfiguration.java:40)
at 
org.codehaus.mojo.hibernate3.exporter.Hbm2DDLExporterMojo.doExecute(Hbm2DDLExporterMojo.java:87)
at 
org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:140)
at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:447)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
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)

I know my hibernate configuration and mapping load fine in a spring test unit 
test environment and/or application server.

Can you please advise?

Thanks,

Guillaume Jeudy

 


____________________________________________________________________________________________________
This electronic mail (including any attachments) may contain information that 
is privileged, confidential, and/or otherwise protected from disclosure to 
anyone other than its intended recipient(s). Any dissemination or use of this 
electronic email or its contents (including any attachments) by persons other 
than the intended recipient(s) is strictly prohibited. If you have received 
this message in error, please notify us immediately by reply email so that we 
may correct our internal records. Please then delete the original message 
(including any attachments) in its entirety. Thank you.

Reply via email to