aspose file tools*
The moose likes Glassfish and the fly likes Add items to database using Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Glassfish
Bookmark "Add items to database using Servlet" Watch "Add items to database using Servlet" New topic
Author

Add items to database using Servlet

Brooke Maddox
Ranch Hand

Joined: Nov 23, 2012
Posts: 42
I have a form to add some items on a JSP page whose action is to a servlet which should take the parameters and add them to a database. When I run the code I get an Error: null.
Any help would be greatly appreciated.

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18141
    
    8



This form of logging doesn't give you much information to work with. You have a better form elsewhere in the code you posted, use that here as well:



This will give you a stack trace which tells you exactly which line of code threw the exception, and what the exception is.
Brooke Maddox
Ranch Hand

Joined: Nov 23, 2012
Posts: 42
Okay so I changed it to


When I hit submit on my form I now get a blank screen.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18141
    
    8

Then the next step is to look in your server logs to find if there are any stack traces for you to look at.
Brooke Maddox
Ranch Hand

Joined: Nov 23, 2012
Posts: 42
I have built the application with both Tomcat and Glassfish and I have two different problems with each.

When I run the application using GlassFish I get this Error: Could not connect to admin listener for GlassFish server 3.1.2. Verify that NetBeans can make outbound connections to localhost 4848.

When using TomCat I can get the application to run (with nothing added to my database) but I get this error in the log:

SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.RuntimeException: java.lang.OutOfMemoryError: PermGen space

java.lang.OutOfMemoryError: PermGen space

Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3438
    
  47

The error says you've run out of your Permanent Generation space. There are compiles classes (among other things) stored in this area, so one possibility is that your application is really big, or that your Glassfish configuration sets the PermGen size way too low. Both of these can be fixed by specifying higher MaxPermSize option. Less pleasant possibilities include memory leaks in Permanent Generation, but unfortunately I'm not an expert in this area.

I'll move your thread to the Glassfish forum, which is probably better suited for the question now. Meanwhile, you might perhaps find some answers by google: Glassfish MaxPermSize, java.lang.OutOfMemoryError: PermGen space or permanent generation memory leak.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Add items to database using Servlet
 
Similar Threads
Connecting to a database through servl
Servlet and JDBC.
Getting NullPointerException
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Optional feature not
How to store multiple items into a shopping cart?