nickaiva (4) [Avatar] Offline
#1
Hello experts!

After following the instructions:

To run the Java SE example for JPA
Modify etc/javase/persistence.xml with appropriate values for the database

To run the example
ant run-javase

I received an Exception as shown at the end of the text:

Buildfile: C:UsersNickDocumentseBooksJavaJ2EEEJB 3 in actionglassfishchapter12uild.xml

common:
[echo] BuildName: chapter12
[echo] BuildHome: C:UsersNickDocumentseBooksJavaJ2EEEJB 3 in actionglassfishchapter12
[echo] BuildFile: C:UsersNickDocumentseBooksJavaJ2EEEJB 3 in actionglassfishchapter12uild.xml
[echo] BuildJVM: 1.6

java-env-check:

init:
[echo] -----> Initializing project properties

setup:
[echo] -----> Creating the required sub-directories

compile-cli-classes:
[javac] C:UsersNickDocumentseBooksJavaJ2EEEJB 3 in actionglassfishchapter12uild.xml:226: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds

cli-descriptor:

package-client:

run-javase:
[java] [TopLink Config]: 2010.03.27 07:45:22.058--ServerSession(243323391)--Thread(Thread[main,5,main])--The alias name for the entity class [class actionbazaar.persistence.ContactInfo] is being defaulted to: ContactInfo.
[java] [TopLink Config]: 2010.03.27 07:45:22.098--ServerSession(243323391)--Thread(Thread[main,5,main])--The column name for element [public java.lang.String actionbazaar.persistence.Address.getCountry()] is being defaulted to: COUNTRY.
[java] [TopLink Config]: 2010.03.27 07:45:22.098--ServerSession(243323391)--Thread(Thread[main,5,main])--The column name for element [public java.lang.String actionbazaar.persistence.Address.getStreetName1()] is being defaulted to: STREETNAME1.
[java] [TopLink Config]: 2010.03.27 07:45:22.108--ServerSession(243323391)--Thread(Thread[main,5,main])--The column name for element [public java.lang.String actionbazaar.persistence.Address.getStreetName2()] is being defaulted to: STREETNAME2.
[java] [TopLink Config]: 2010.03.27 07:45:22.108--ServerSession(243323391)--Thread(Thread[main,5,main])--The column name for element [public java.lang.String actionbazaar.persistence.Address.getCity()] is being defaulted to: CITY.
[java] [TopLink Config]: 2010.03.27 07:45:22.108--ServerSession(243323391)--Thread(Thread[main,5,main])--The column name for element [public java.lang.String actionbazaar.persistence.ContactInfo.getEMail()] is being defaulted to: EMAIL.
[java] [TopLink Config]: 2010.03.27 07:45:22.118--ServerSession(243323391)--Thread(Thread[main,5,main])--The alias name for the entity class [class actionbazaar.persistence.Item] is being defaulted to: Item.
[java] [TopLink Config]: 2010.03.27 07:45:22.118--ServerSession(243323391)--Thread(Thread[main,5,main])--The target entity (reference) class for the many to many mapping element [public java.util.Set actionbazaar.persistence.Item.getCategory()] is being defaulted to: class actionbazaar.persistence.Category.
[java] [TopLink Config]: 2010.03.27 07:45:22.238--ServerSession(243323391)--Thread(Thread[main,5,main])--The alias name for the entity class [class actionbazaar.persistence.Bidder] is being defaulted to: Bidder.
[java] [TopLink Config]: 2010.03.27 07:45:22.238--ServerSession(243323391)--Thread(Thread[main,5,main])--The alias name for the entity class [class actionbazaar.persistence.User] is being defaulted to: User.
[java] [TopLink Config]: 2010.03.27 07:45:22.258--ServerSession(243323391)--Thread(Thread[main,5,main])--The alias name for the entity class [class actionbazaar.persistence.Bid] is being defaulted to: Bid.
[java] [TopLink Config]: 2010.03.27 07:45:22.318--ServerSession(243323391)--Thread(Thread[main,5,main])--The alias name for the entity class [class actionbazaar.persistence.Category] is being defaulted to: Category.
[java] [TopLink Config]: 2010.03.27 07:45:22.328--ServerSession(243323391)--Thread(Thread[main,5,main])--The alias name for the entity class [class actionbazaar.persistence.Seller] is being defaulted to: Seller.
[java] [TopLink Config]: 2010.03.27 07:45:22.328--ServerSession(243323391)--Thread(Thread[main,5,main])--The alias name for the entity class [class actionbazaar.persistence.BillingInfo] is being defaulted to: BillingInfo.
[java] [TopLink Config]: 2010.03.27 07:45:22.418--ServerSession(243323391)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to many mapping element [public java.util.Set actionbazaar.persistence.Bidder.getBids()] is being defaulted to: class actionbazaar.persistence.Bid.
[java] [TopLink Config]: 2010.03.27 07:45:22.468--ServerSession(243323391)--Thread(Thread[main,5,main])--The target entity (reference) class for the many to one mapping element [public actionbazaar.persistence.Bidder actionbazaar.persistence.Bid.getBidder()] is being defaulted to: class actionbazaar.persistence.Bidder.
[java] [TopLink Config]: 2010.03.27 07:45:22.508--ServerSession(243323391)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to many mapping element [public java.util.Set actionbazaar.persistence.Category.getCategorySet()] is being defaulted to: class actionbazaar.persistence.Category.
[java] [TopLink Config]: 2010.03.27 07:45:22.508--ServerSession(243323391)--Thread(Thread[main,5,main])--The target entity (reference) class for the many to one mapping element [public actionbazaar.persistence.Category actionbazaar.persistence.Category.getCategory()] is being defaulted to: class actionbazaar.persistence.Category.
[java] [TopLink Config]: 2010.03.27 07:45:22.608--ServerSession(243323391)--Thread(Thread[main,5,main])--The target entity (reference) class for the many to many mapping element [public java.util.Set actionbazaar.persistence.Category.getItems()] is being defaulted to: class actionbazaar.persistence.Item.
[java] [TopLink Config]: 2010.03.27 07:45:22.608--ServerSession(243323391)--Thread(Thread[main,5,main])--The target entity (reference) class for the many to one mapping element [public actionbazaar.persistence.User actionbazaar.persistence.Category.getUser()] is being defaulted to: class actionbazaar.persistence.User.
[java] [TopLink Config]: 2010.03.27 07:45:22.708--ServerSession(243323391)--Thread(Thread[main,5,main])--The target entity (reference) class for the many to one mapping element [public actionbazaar.persistence.Item actionbazaar.persistence.Bid.getItem()] is being defaulted to: class actionbazaar.persistence.Item.
[java] [TopLink Config]: 2010.03.27 07:45:22.708--ServerSession(243323391)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to one mapping element [public actionbazaar.persistence.ContactInfo actionbazaar.persistence.User.getContactInfo()] is being defaulted to: class actionbazaar.persistence.ContactInfo.
[java] [TopLink Config]: 2010.03.27 07:45:22.808--ServerSession(243323391)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to many mapping element [public java.util.Set actionbazaar.persistence.User.getcategories()] is being defaulted to: class actionbazaar.persistence.Category.
[java] [TopLink Config]: 2010.03.27 07:45:22.808--ServerSession(243323391)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to one mapping element [public actionbazaar.persistence.BillingInfo actionbazaar.persistence.User.getBillingInfo()] is being defaulted to: class actionbazaar.persistence.BillingInfo.
[java] [TopLink Config]: 2010.03.27 07:45:22.908--ServerSession(243323391)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to many mapping element [public java.util.Set actionbazaar.persistence.Item.getBids()] is being defaulted to: class actionbazaar.persistence.Bid.
[java] [TopLink Config]: 2010.03.27 07:45:22.908--ServerSession(243323391)--Thread(Thread[main,5,main])--The target entity (reference) class for the many to one mapping element [public actionbazaar.persistence.Seller actionbazaar.persistence.Item.getSeller()] is being defaulted to: class actionbazaar.persistence.Seller.
[java] [TopLink Config]: 2010.03.27 07:45:23.008--ServerSession(243323391)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to many mapping element [public java.util.Set actionbazaar.persistence.Seller.getItems()] is being defaulted to: class actionbazaar.persistence.Item.
[java] Exception in thread "main" java.lang.NullPointerException
[java] at actionbazaar.buslogic.PlaceBidBeanJavaSE.main(PlaceBidBeanJavaSE.java:26)
[java] [TopLink Info]: 2010.03.27 07:45:23.588--ServerSession(243323391)--Thread(Thread[main,5,main])--TopLink, version: Oracle TopLink Essentials - 2.1 (Build b31g-fcs (10/19/2009))

BUILD SUCCESSFUL
Total time: 4 seconds

Am I missing something else?
Should I add something more at the classpath environment variable?
Any helping hand is welcome,
Thank you very much in advance!

NA
http://nickaiva.blogspot.com

Message was edited by:
nickaiva
reza_rahman (456) [Avatar] Offline
#2
Re: Chapter 12 client PlaceBidBeanJavaSE throws NPException
Nick,

What version of GlassFish are you using? Keep in mind, the examples were developed for GlassFish v1. At this point, we are focusing on the second edition and do not plan to upgrade the code samples for the first edition.

Cheers,
Reza
nickaiva (4) [Avatar] Offline
#3
Re: Chapter 12 client PlaceBidBeanJavaSE throws NPException
Thank you for your reply!
I am currently using Glassfish ver.2.1 and planning to migrate to oc4j. The web application using the jsp form works perfectly.
However, the aforementioned client code corresponds to a java standard edition class as mentioned in paragraph: "12.3.3 Accessing an application-managed EntityManager
outside the container".
The client is supposed to work independently of any version of J2EE 1.5 compatible ejb container that is running, or not?

NA
http://nickaiva.blogspot.com

Message was edited by:
nickaiva
nickaiva (4) [Avatar] Offline
#4
Re: Chapter 12 client PlaceBidBeanJavaSE throws NPException