NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Affable Bean Java EJB Glassfish tutorial issues

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
amitrajput7



Joined: 02 May 2013
Posts: 3

PostPosted: Mon Sep 16, 2013 3:34 pm    Post subject: Affable Bean Java EJB Glassfish tutorial issues Reply with quote

I have been following the affableBean tutorial from the NetBeans site located https://netbeans.org/kb/docs/javaee/ecommerce/transaction.html. I have run into an issue where I am unable to submit a purchase order(checkout.jsp). When I submit the form data, I receive an http 500 status and the following errors:

EJB5184:A system exception occurred during an invocation on EJB OrderManager, method: public int session.OrderManager.placeOrder(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,cart.ShoppingCart) WARNING: javax.ejb.EJBException at controller.ControllerServlet.doPost(ControllerServlet.java:201) Caused by: at session.OrderManager.addOrder(OrderManager.java:8Cool at session.OrderManager.placeOrder(OrderManager.java:56)

Line 201 of ControllerServlet is: int orderId= orderManager.placeOrder(name,email,phone,address,cityRegion,ccNumber,cart);

Line 88 and 56 of OrderManager is:em.persist(customer); em.persist(order);

While running a debug session, it seems that persist method has null value in both case.my conclusion is that because there is no id genreated by database so it persist method has null value. i do not understand what i do now to persist data in the my database table.
thanks for help me.
Back to top
CarlosFMeneses



Joined: 22 Mar 2016
Posts: 10

PostPosted: Fri Oct 07, 2016 5:21 pm    Post subject: Re: Affable Bean Java EJB Glassfish tutorial issues Reply with quote

amitrajput7 wrote:
While running a debug session, it seems that persist method has null value in both case.my conclusion is that because there is no id genreated by database so it persist method has null value. i do not understand what i do now to persist data in the my database table.
thanks for help me.


I'm having a similar issue. I am doing the AffableBean tutorial (6yrs after it's been written, I know), and I am not able to get to the confirmation page either.

I was able to add a call to flush the persistence context to the database, as per the tutorial. In the addOrderedItems method:

Code:
private void addOrderedItems(CustomerOrder order, ShoppingCart cart) {

    em.flush(); // flush persistence context to database

    List<ShoppingCartItem> items = cart.getItems();
    …

Still, the server responds with an HTTP status 500 message and I get the javax.ejb.EJBException. The error I'm getting is occuring in the OrderManager.java, with the addOrder method. Did a debug session and these are the variables values:

customer = (entity.Customer) entity.Customer[id=null]
order = (entity.CustomerOrder) entity.CustomerOrder[id=null]

What is giving me errors? HELP!
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo