users@glassfish.java.net

Could not persist secondary entity class - enterprise.appclient.MainWithMod

From: <glassfish_at_javadesktop.org>
Date: Fri, 04 Jun 2010 00:54:50 PDT

Hi All,

I am at a lost on why the following error has taken place when persisting a newly added table (entity class) from an EAR application Client (Java EE 5 - GF 2.1, JDK1.6.17):

04/06/2010 10:50:41 AM com.sun.enterprise.appclient.MainWithModuleSupport <init>
WARNING: ACC003: Application threw an exception.
java.lang.NullPointerException
        at client.SecurityApplicationClient.addSecuritys(SecurityApplicationClient.java:633)
        at client.SecurityApplicationClient.main(SecurityApplicationClient.java:58)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:266)
        at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:449)
        at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
        at com.sun.enterprise.appclient.Main.main(Main.java:200)
Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:461)
        at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:259)
        at com.sun.enterprise.appclient.Main.main(Main.java:200)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:266)
        at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithModuleSupport.java:449)
        ... 2 more
Caused by: java.lang.NullPointerException
        at client.SecurityApplicationClient.addSecuritys(SecurityApplicationClient.java:633)
        at client.SecurityApplicationClient.main(SecurityApplicationClient.java:58)
        ... 8 more

This new entity class has recently been added to an existing working EAR project that is made up of entity classes associated with one persistent unit and a number of session beans. The same persistent unit SecurityDB-PU is used by the newly added table.

Netbeans 6.7 project on Windows XP verification produced the following summary:


          ---------------------------
          STATIC VERIFICATION RESULTS
          ---------------------------
        
         ----------------------------------
         NUMBER OF FAILURES/WARNINGS/ERRORS
         ----------------------------------
         # of Failures : 1
             # of Warnings : 0
         # of Errors : 0

          -------------------------------------
          RESULTS FOR APPLICATION-RELATED TESTS
          -------------------------------------
         --------------
         FAILED TESTS :
         --------------
        
         Test Name : tests.persistence.DefaultProviderVerification
         Test Assertion : Test validity of EJB 3.0 persistence unit. This test tests validity using a portable persistence provider. Please refer to EJB 3.0 Persistence API Specification for further information.
         Test Description : For [ SecurityManagementBean#SecurityManagementBean-ejb.jar#SecurityDB-PU ]
Exception [TOPLINK-7144] (Oracle TopLink Essentials - 2.1 (Build b60e-fcs (12/23/2008))): oracle.toplink.essentials.exceptions.ValidationException Exception Description: SEQ_GEN_IDENTITY: platform DatabasePlatform doesn't support NativeSequence.

<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
<static-verification>
<test>
<test-name>tests.appclient.PersistenceUnitCount</test-name>
<test-assertion>persistence,xml should have atleast one peristence unit. Please refer to EJB 3.0 Persistence API Specification section #6.2.1 for further information.</test-assertion>
<test-description>For [ SecurityManagementBean#SecurityManagementBean-app-client.jar ]
Test is not applicable.
</test-description>

Data from earlier tables are still been added (persisted) correctly which suggests that the persistent unit is intact.

The persistence.xml is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
  <persistence-unit name="SecurityDB-PU" transaction-type="JTA">
    <provider>oracle.toplink.essentials.PersistenceProvider</provider>
    <jta-data-source>MySQLDB</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
      <property name="toplink.ddl-generation" value="drop-and-create-tables"/>
    </properties>
  </persistence-unit>
</persistence>

Any assistant would be much appreciated.

Thanks,

Jack
[Message sent by forum member 'htran_888']

http://forums.java.net/jive/thread.jspa?messageID=472717