persistence@glassfish.java.net

no.weaving option

From: Pierre Delisle <Pierre.Delisle_at_Sun.COM>
Date: Thu, 12 Jan 2006 07:47:31 -0800

Dear persistence gurus,

I ran the persistence example at
https://glassfish.dev.java.net/javaee5/persistence/persistence-example.html
on Java SE using -javaagent and everything worked great
(as shown below):

  D:\sw\javapersistence_javase_ex1\classes>java -cp d:\tscextdep\lib\mysql.jar;. -javaagent:d:\glassfish_cvs\publish\glassfish\lib\toplink-essentials-agent.jar client.Client
  [TopLink Info]: 2006.01.11 09:30:31.484--ServerSession(15431769)--TopLink, versi
  on: Oracle TopLink Essentials - 10g release 4 (10.1.4.0.0) (Build 051205Dev)
  [TopLink Info]: 2006.01.11 09:30:32.031--ServerSession(15431769)--pu1 login successful
  Inserting Customer and Orders... OK
  Verifying that all are inserted... OK
  Removing all... OK
  Verifying that all are removed... OK

-----
I am now trying to run the same example without the -javaagent.

I talked to Marina, and she mentioned that the option "no.weaving"
should do the trick. The persistence.xml is as follows:
(note that I have tried with both "no.weaving" and "toplink.no.weaving")

  <persistence xmlns="http://java.sun.com/xml/ns/persistence">
      <persistence-unit name="pu1">
          <provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
          <class>entity.Customer</class>
          <class>entity.Order</class>
          <properties>
              <property name="jdbc.driver" value="org.gjt.mm.mysql.Driver"/>
              <property name="jdbc.connection.string" value="jdbc:mysql://localhost:3306/test?autoReconnect=true"/>
              <property name="jdbc.user" value=""/>
              <property name="jdbc.password" value=""/>
              <property name="toplink.logging.level" value="INFO"/>
              <property name="no.weaving" value="true"/>
          </properties>
      </persistence-unit>
  </persistence>


Unfortunately, I get an NPE as shown below:

D:\sw\javapersistence_javase_ex1\classes>java -cp d:\tscextdep\lib\mysql.jar;.;d:\glassfish_cvs\publish\glassfish\lib\toplink-essentials.jar;d:\glassfish_cvs\publish\glassfish\lib\antlr.jar;d:\glassfish_cvs\publish\glassfish\lib\javaee.jar;d:\glassfish_cvs\publish\glassfish\lib\asm.jar;d:\glassfish_cvs\publish\glassfish\lib\asm-attrs.jar client.Client

Exception in thread "main" java.lang.NullPointerException
        at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.call
Predeploy(JavaSECMPInitializer.java:133)
        at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.init
PersistenceUnits(JavaSECMPInitializer.java:279)
        at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.init
ialize(JavaSECMPInitializer.java:298)
        at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.init
ializeFromMain(JavaSECMPInitializer.java:335)
        at oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.getJ
avaSECMPInitializer(JavaSECMPInitializer.java:78)
        at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.getSe
rverSession(EntityManagerFactoryProvider.java:240)
        at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.creat
eEntityManagerFactory(EntityManagerFactoryProvider.java:97)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.
java:61)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.
java:50)
        at client.Client.main(Client.java:45)


Any help to solve this issue would be greatly appreciated.

Thanks!

    -- Pierre