Hello,
I am trying to generate the meta-model but have been stumped on the exception below. This is a Maven based project targeting Java EE 7/GlassFish 4. I am using the Eclipselink that ships with GlassFish 4. I was able to get this to work with one of the GlassFish 4.0 betas.
I am able to retrieve the persistence_2_1.xsd using curl no problem - also NetBeans 7.3.1 is able to validate (which I assume means it reached out and checked the schema) the file successfully.
Thanks,
-Ryan
Here's what I have for dependencies:
...
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.0-M5</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
...
Note: GlassFish appears to be using EclipseLink 2.5.0-M5 for the 4.0 release.
Here's what I have in the persistence.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xmlns="
http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://xmlns.jcp.org/xml/ns/persistencehttp://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="actionbazaar2" transaction-type="JTA">
...
When I do a compile, it fails on the step to generate the meta-model:
[INFO] javac option: -proc:only
[INFO] javac option: -Aeclipselink.persistencexml=/Users/rcuprak/Projects/action-bazaar/chapter10b7/src/main/resources/META-INF/persistence.xml
[INFO] javac option: -processor
[INFO] javac option: org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
[INFO] javac option: -d
[INFO] javac option: /Users/rcuprak/Projects/action-bazaar/chapter10b7/target/classes
[INFO] javac option: -s
[INFO] javac option: /Users/rcuprak/Projects/action-bazaar/chapter10b7/target/generated-sources/metamodel
[ERROR] execute error
java.lang.RuntimeException: java.lang.RuntimeException: Exception [EclipseLink-25008] (Eclipse Persistence Services - 2.5.0.v20121120-ec51fcc): org.eclipse.persistence.exceptions.XMLMarshalException
Exception Description: A descriptor with default root element {
http://xmlns.jcp.org/xml/ns/persistence}persistence was not found in the project
at com.sun.tools.javac.main.Main.compile(Main.java:469)
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:132)
at org.bsc.maven.plugin.processor.AbstractAnnotationProcessorMojo.executeWithExceptionsHandled(AbstractAnnotationProcessorMojo.java:231)
at org.bsc.maven.plugin.processor.AbstractAnnotationProcessorMojo.execute(AbstractAnnotationProcessorMojo.java:124)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)