Trying to run the example at
https://glassfish.dev.java.net/javaee5/persistence/persistence-example.html#Using_in_Java_SE
using Maven. 

This exception is thrown when I run mvn test
javax.persistence.PersistenceException: No Persistence provider for
EntityManager named pu1
        at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:89)
        at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
        at
sun.example.entity.TestCustomerOrder.testCustOrder(TestCustomerOrder.java:26)

I am not trying to run this as a part of an ear or war. Given below are the
pom.xml entries and settings.xml entries. Persistence.xml is under
targets/classes/META-INF

        <dependencies>
                <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
                        <version>3.8.1</version>
                        <scope>test</scope>
                </dependency>
                <dependency>
                        <groupId>javax.javaee</groupId>
                        <artifactId>javaee</artifactId>
                        <version>5</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>
                        <groupId>commons-logging</groupId>
                        <artifactId>commons-logging</artifactId>
                        <version>1.0.4</version>
                </dependency>
                <dependency>
                        <groupId>log4j</groupId>
                        <artifactId>log4j</artifactId>
                        <version>1.2.13</version>
                        <scope>test</scope>
                </dependency>
                <dependency>
                        <groupId>hsqldb</groupId>
                        <artifactId>hsqldb</artifactId>
                        <version>1.8.0.4</version>
                </dependency>
        </dependencies>
        <build>
                <plugins>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-compiler-plugin</artifactId>
                                <configuration>
                                        <source>1.5</source>
                                        <target>1.5</target>
                                </configuration>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-surefire-plugin</artifactId>
                                <configuration>
                                        <argLine>${surefire.argLine}</argLine>
                                        <systemProperties>
                                                <property>
                                                        
<name>java.class.path</name>
                                                        
<value>target/classes</value>
                                                </property>
                                        </systemProperties>
                                </configuration>
                        </plugin>

Settings.xml 
<settings xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
                     http://maven.apache.org/xsd/settings-1.0.0.xsd";>
        <profiles>
                <profile>
                        <id>debugger</id>
                        <activation>
                                <property>
                                        <name>debugger</name>
                                </property>
                        </activation>
                        <properties>
                        
<surefire.argLine>-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9000
-Xdebug -Xnoagent -Djava.compiler=NONE,
-javaagent:D:\\Sanjay\\Sun\\AppServer\\lib\\toplink-essentials-agent.jar</surefire.argLine>
                                
<!---Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9876
-Xnoagent -Djava.compiler=NONE-->
                                                              
                        </properties>
                </profile>
        </profiles>
</settings>


I can run this example successfully on the command line using - java
-cp[related classpaths]
-javaagent:${glassfish.home}/lib/toplink-essentials-agent.jar <class-name>

-- 
View this message in context: 
http://www.nabble.com/Unable-to-Run-POJO-entities-in-Maven-tf2820460s177.html#a7872094
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to