Issue Details (XML | Word | Printable)

Key: NUCMAVEN-21
Type: Sub-task Sub-task
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Unassigned
Reporter: Arjun Balla
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Tools : Maven plugin
NUCMAVEN-20

Getting java.lang.NoClassDefFoundError: org/datanucleus/store/rdbms/SchemaTool

Created: 16/Jun/11 08:49 AM   Updated: 17/Jun/11 05:16 PM   Resolved: 16/Jun/11 09:00 AM
Component/s: None
Affects Version/s: 3.0.0.m2
Fix Version/s: None

Environment:
JDK 1.6.0_23
Maven 3.0.2

Datastore: MySQL
Severity: Production


 Description  « Hide
Thanks for the reply. Is the second part of issue still valid or am I missing something?

I got [ERROR] java.lang.NoClassDefFoundError: org/datanucleus/store/rdbms/SchemaTool when tried to execute the below maven script

***** The reason is depenedencies are resolved to 3.x.x by maven and those doesnot have org/datanucleus/store/rdbms/SchemaTool (SchemaTool class package is also changed in 3.x.x)
I tried with latest version of maven plugin 3.0.0-m2, it gave error - There is no available StoreManager of type "jdbc".
This is because the trasitive dependecy on datanuclues-rdbms is removed in 3.x.x.


=========================
Complete details
=========================
Maven script
--------------
<build>
       <plugins>
               <plugin>
                       <groupId>org.datanucleus</groupId>
                       <artifactId>maven-datanucleus-plugin</artifactId>
                       <version>2.2.0-release</version>
                       <configuration>
                               <log4jConfiguration>${basedir}/src/main/resources/log4j/log4j.properties</log4jConfiguration>
                               <verbose>true</verbose>
                               <props>${basedir}/src/main/resources/jdo/db.properties</props>
                               <verbose>true</verbose>
                               <metadataDirectory>${basedir}/src/main/resources/jdo</metadataDirectory>
                               <ddlFile>${basedir}/src/main/resources/ddl/com.epaas.manager.model.ddl</ddlFile>
                               <log4jConfiguration>${basedir}/src/main/resources/log4j/log4j.properties</log4jConfiguration>
                               <completeDdl>true</completeDdl>
                       </configuration>
                       <executions>
                               <execution>
                                       <phase>process-classes</phase>
                                       <goals>
                                               <goal>enhance</goal>
                                               <goal>schema-create</goal>
                                       </goals>
                               </execution>
                       </executions>
               </plugin>
       </plugins>
</build>

The reason is depenedencies are resolved to 3.x.x by maven and those doesnot have org/datanucleus/store/rdbms/SchemaTool (package is also changed in 3.x.x)

pluginArtifacts = [
 org.datanucleus:maven-datanucleus-plugin:maven-plugin:2.2.0-release:
 org.datanucleus:datanucleus-core:jar:3.0.0-m4:runtime
 org.datanucleus:datanucleus-enhancer:jar:3.0.0-m3:runtime
 javax.jdo:jdo-api:jar:3 .1-SNAPSHOT-20110319:runtime
 javax.transaction:transaction-api:jar:1.1:runtime
 org.datanucleus:datanucleus-rdbms:jar:3 .0.0-m3:runtime
 org.datanucleus:datanucleus-jpa:jar:2.1.7:runtime
 org.apache.geronimo.specs:geronimo-jpa_2.0_spec:jar: 1.0:runtime
 asm:asm:jar:3.3.1:runtime
 org.codehaus.plexus:plexus-utils:jar:1.2:compile
 junit:junit:jar:3.8.1:compile
]

Even if latest version of maven plugin 3.0.0-m2 is used, it will give the below error (intially I had no clue).
This is because the trasitive dependecy on datanuclues-rdbms is removed in 3.x.x.


SEVERE: Error creating NucleusContext
There is no available StoreManager of type "jdbc". Make sure that you have put the relevant DataNucleus store plugin in
your CLASSPATH and if defining a connection via JNDI or DataSource you also need to provide persistence property "datanu
cleus.storeManagerType"
org.datanucleus.exceptions.NucleusUserException: There is no available StoreManager of type "jdbc". Make sure that you h
ave put the relevant DataNucleus store plugin in your CLASSPATH and if defining a connection via JNDI or DataSource you
also need to provide persistence property "datanucleus.storeManagerType"
       at org.datanucleus.NucleusContext.createStoreManagerForProperties(NucleusContext.java:476)
       at org.datanucleus.NucleusContext.initialise(NucleusContext.java:257)
       at org.datanucleus.store.schema.SchemaTool.getNucleusContextForMode(SchemaTool.java:561)
       at org.datanucleus.store.schema.SchemaTool.main(SchemaTool.java:253)

We need to add the following to make it work.
============================
<dependency>
       <groupId>org.datanucleus</groupId>
       <artifactId>datanucleus-rdbms</artifactId>
       <version>3.0.0-m4</version>
</dependency>
============================

The complete sample pom for mysql could be
============================
<dependencies>
       <dependency>
               <groupId>javax.jdo</groupId>
               <artifactId>jdo-api</artifactId>
               <version>3.0</version>
       </dependency>
       <dependency>
               <groupId>org.datanucleus</groupId>
               <artifactId>datanucleus-api-jdo</artifactId>
               <version>3.0.0-m3</version>
       </dependency>
       <dependency>
               <groupId>mysql</groupId>
               <artifactId>mysql-connector-java</artifactId>
               <version>5.0.5</version>
       </dependency>
       <dependency>
               <groupId>org.datanucleus</groupId>
               <artifactId>datanucleus-rdbms</artifactId>
               <version>3.0.0-m4</version>
       </dependency>
</dependencies>
<build>
       <plugin>
               <groupId>org.datanucleus</groupId>
               <artifactId>maven-datanucleus-plugin</artifactId>
               <version>3.0.0-m2</version>
               <configuration>
                       <log4jConfiguration>${basedir}/src/main/resources/log4j/log4j.properties</log4jConfiguration>
                       <verbose>true</verbose>
                       <props>${basedir}/src/main/resources/jdo/db.properties</props>
                       <verbose>true</verbose>
                       <metadataDirectory>${basedir}/src/main/resources/jdo</metadataDirectory>
                       <ddlFile>${basedir}/src/main/resources/ddl/com.epaas.manager.model.ddl</ddlFile>
                       <log4jConfiguration>${basedir}/src/main/resources/log4j/log4j.properties</log4jConfiguration>
                       <completeDdl>true</completeDdl>
               </configuration>
               <executions>
                       <execution>
                               <phase>process-classes</phase>
                               <goals>
                                       <goal>enhance</goal>
                                       <goal>schema-create</goal>
                               </goals>
                       </execution>
               </executions>
       </plugin>
       </plugins>
</build>
============================


Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 16/Jun/11 09:00 AM
The forum is the place to ask questions.

As per all docs (for 3.0) SchemaTool works for many different datastores now and makes no sense to include such dependencies in M2 plugins. Include it in your project