-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: org.apache.struts.action.RequestProcessor.processException
PostPosted: Wed Jun 01, 2005 12:21 am 
Newbie

Joined: Mon Feb 21, 2005 3:49 am
Posts: 15
Dear All

I had count problem as " WARN RequestProcessor:509 - Unhandled Exception thrown: class java.lang.NullPointerException"

Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
Hibernate 2.1.8
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping package="com.cfreecom.dating.hib2">
<class name="Cat" table="cat">
<id
column="cat_id"
name="id"
type="string"
>
<generator class="vm" />
</id>
<property
column="sex"
length="1"
name="sex"
not-null="false"
type="string"
/>
<property
column="name"
length="16"
name="name"
not-null="true"
type="string"
/>
<property
column="weight"
length="10"
name="weight"
not-null="false"
type="big_decimal"
/>
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
BaseHibUtilAction.java

package com.cfreecom.dating.actions;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.Action;

import net.sf.hibernate.cfg.Configuration;
import net.sf.hibernate.*;

public class BaseHibUtilAction extends Action {

// ----------------------------------------------------- Instance Variables

/**
* The <code>Log</code> instance for this application.
*/
protected Log log = LogFactory.getLog(BaseHibUtilAction.class);

// ----------------------------------------------------- Static Variables & Methods

private static final SessionFactory sessionFactory;

static {
try {
System.out.println("BaseHibUtilAction ... static ... try ");
sessionFactory = new Configuration().configure().buildSessionFactory();
System.out.println("BaseHibUtilAction ... static ... try ... sessionFactory->"+sessionFactory.toString());
} catch (HibernateException ex) {
throw new RuntimeException("Exception building SessionFactory: " + ex.getMessage(), ex);
}
}

public static final ThreadLocal session = new ThreadLocal();

public static Session getSession() throws HibernateException {

Session s = (Session) session.get();
System.out.println("BaseHibUtilAction ... static ... getSession() ... thread-local->"+s.toString());
// Open a new Session, if this Thread has none yet
if (s == null) {
s = sessionFactory.openSession();
System.out.println("BaseHibUtilAction ... static ... getSession() ... openSession() ");
session.set(s);
System.out.println("BaseHibUtilAction ... static ... getSession() ... set(session) "+session.toString());
System.out.println("BaseHibUtilAction ... static ... getSession() ... set(session) "+s.toString());
}
return s;
}

public static void closeSession() throws HibernateException {
Session s = (Session) session.get();
session.set(null);
if (s != null)
s.close();
System.out.println("BaseHibUtilAction ... static ... closeSession() ... close() ");
}
}

CatAction.java
package com.cfreecom.dating.actions;

import java.util.Iterator;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*;

import com.cfreecom.dating.hib2.*;
import com.cfreecom.dating.hib2.dao.*;

public class CatAction extends BaseHibUtilAction {

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {

System.out.println("Hibernate - CatAction ...");

Session s = null;
Transaction tx = null;

try {
System.out.println("ActAction ... try ");
// get singleton session reference from base class
s = getSession();
System.out.println("session: "+s.toString());

tx = s.beginTransaction();
System.out.println("trans: "+tx.toString());
// do your job here ...
Cat cat = new Cat();
cat.setId("Cat1");
cat.setName("Cat1");
cat.setWeight(new java.math.BigDecimal(7.4f));

s.save(cat, s);
System.out.println("session save ");
tx.commit();
System.out.println("trans commit ");

} catch (HibernateException e) {
System.out.println("HibernateException: "+e.getMessage());
e.printStackTrace();
} finally {
if(s != null) {
try {
closeSession();
System.out.println("session close ");
} catch (HibernateException e) {
System.out.println("HibernateException: "+e.getMessage());
e.printStackTrace();
}
}
}

return (mapping.getInputForward());
}

public void printCol(String str) {
System.out.print(str);
System.out.print(" | ");
}

}

Full stack trace of any exception that occurs:
Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:516)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:423)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.NullPointerException
com.cfreecom.dating.actions.BaseHibUtilAction.getSession(BaseHibUtilAction.java:38)
com.cfreecom.dating.actions.CatAction.execute(CatAction.java:33)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:
BaseHibUtilAction ... static ... try
12:06:55,535 INFO Environment:483 - Hibernate 2.1.8
12:06:55,536 INFO Environment:512 - hibernate.properties not found
12:06:55,538 INFO Environment:543 - using CGLIB reflection optimizer
12:06:55,539 INFO Environment:572 - using JDK 1.4 java.sql.Timestamp handling
12:06:55,547 INFO Configuration:909 - configuring from resource: /hibernate.cfg.xml
12:06:55,547 INFO Configuration:881 - Configuration resource: /hibernate.cfg.xml
12:06:55,592 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibern ... on-2.0.dtd in classpath under net/sf/hibernate/
12:06:55,602 DEBUG DTDEntityResolver:32 - found http://hibernate.sourceforge.net/hibern ... on-2.0.dtd in classpath
12:06:55,723 DEBUG Configuration:867 - hibernate.connection.url=jdbc:mysql://localhost:3306/dating
12:06:55,723 DEBUG Configuration:867 - hibernate.connection.driver_class=com.mysql.jdbc.Driver
12:06:55,724 DEBUG Configuration:867 - hibernate.connection.username=dating
12:06:55,725 DEBUG Configuration:867 - hibernate.connection.password=dating
12:06:55,725 DEBUG Configuration:867 - hibernate.connection.pool_size=2
12:06:55,726 DEBUG Configuration:867 - dialect=net.sf.hibernate.dialect.MySQLDialect
12:06:55,726 DEBUG Configuration:867 - hibernate.show_sql=true
12:06:55,727 DEBUG Configuration:867 - hibernate.use_outer_join=true
12:06:55,727 DEBUG Configuration:867 - c3p0.min_size=2
12:06:55,733 DEBUG Configuration:867 - c3p0.max_size=5
12:06:55,733 DEBUG Configuration:867 - c3p0.timeout=900
12:06:55,735 DEBUG Configuration:1026 - null<-org.dom4j.tree.DefaultAttribute@fa21a4 [Attribute: name resource value "com/cfreecom/dating/hib2/Cat.hbm.xml"]
12:06:55,735 INFO Configuration:332 - Mapping resource: com/cfreecom/dating/hib2/Cat.hbm.xml
12:06:55,738 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
12:06:55,741 DEBUG DTDEntityResolver:32 - found http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
12:06:55,816 INFO Binder:229 - Mapping class: com.cfreecom.dating.hib2.Cat -> cat
12:06:55,884 DEBUG Binder:486 - Mapped property: id -> cat_id, type: string
12:06:55,900 DEBUG Binder:486 - Mapped property: sex -> sex, type: string
12:06:55,901 DEBUG Binder:486 - Mapped property: name -> name, type: string
12:06:55,901 DEBUG Binder:486 - Mapped property: weight -> weight, type: big_decimal
12:06:55,902 DEBUG Configuration:1026 - null<-org.dom4j.tree.DefaultAttribute@1368c5d [Attribute: name resource value "com/cfreecom/dating/hib2/Photo.hbm.xml"]
12:06:55,903 INFO Configuration:332 - Mapping resource: com/cfreecom/dating/hib2/Photo.hbm.xml
12:06:55,905 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
12:06:55,906 DEBUG DTDEntityResolver:32 - found http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
12:06:55,918 INFO Binder:229 - Mapping class: com.cfreecom.dating.hib2.Photo -> photo
12:06:55,935 DEBUG Binder:486 - Mapped property: user -> user_id, type: com.cfreecom.dating.hib2.User
12:06:55,936 DEBUG Binder:486 - Mapped property: id -> id, type: integer
Jun 1, 2005 12:06:56 PM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already (the eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact)
Jun 1, 2005 12:06:56 PM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already (the eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact)
12:06:56,524 DEBUG Binder:486 - Mapped property: id -> user_id, id, type: com.cfreecom.dating.hib2.PhotoPK
12:06:56,527 DEBUG Binder:486 - Mapped property: image -> image, type: binary
12:06:56,528 DEBUG Configuration:1026 - null<-org.dom4j.tree.DefaultAttribute@119549e [Attribute: name resource value "com/cfreecom/dating/hib2/Role.hbm.xml"]
12:06:56,528 INFO Configuration:332 - Mapping resource: com/cfreecom/dating/hib2/Role.hbm.xml
12:06:56,531 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
12:06:56,532 DEBUG DTDEntityResolver:32 - found http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
12:06:56,536 INFO Binder:229 - Mapping class: com.cfreecom.dating.hib2.Role -> role
12:06:56,541 DEBUG Binder:486 - Mapped property: id -> id, type: integer
12:06:56,542 DEBUG Binder:486 - Mapped property: name -> name, type: string
12:06:56,552 DEBUG Binder:486 - Mapped property: userSet, type: java.util.Set
12:06:56,552 DEBUG Configuration:1026 - null<-org.dom4j.tree.DefaultAttribute@1f327e [Attribute: name resource value "com/cfreecom/dating/hib2/User.hbm.xml"]
12:06:56,553 INFO Configuration:332 - Mapping resource: com/cfreecom/dating/hib2/User.hbm.xml
12:06:56,556 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
12:06:56,557 DEBUG DTDEntityResolver:32 - found http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
12:06:56,563 INFO Binder:229 - Mapping class: com.cfreecom.dating.hib2.User -> user
12:06:56,563 DEBUG Binder:486 - Mapped property: id -> id, type: integer
12:06:56,565 DEBUG Binder:486 - Mapped property: gender -> gender, type: string
12:06:56,566 DEBUG Binder:486 - Mapped property: password -> password, type: string
12:06:56,571 DEBUG Binder:486 - Mapped property: mstatus -> mstatus, type: string
12:06:56,571 DEBUG Binder:486 - Mapped property: kids -> kids, type: integer
12:06:56,572 DEBUG Binder:486 - Mapped property: addr -> addr, type: string
12:06:56,573 DEBUG Binder:486 - Mapped property: house -> house, type: string
12:06:56,573 DEBUG Binder:486 - Mapped property: selfdesc -> selfdesc, type: string
12:06:56,574 DEBUG Binder:486 - Mapped property: edu -> edu, type: string
12:06:56,575 DEBUG Binder:486 - Mapped property: cdate -> cdate, type: date
12:06:56,576 DEBUG Binder:486 - Mapped property: country -> country, type: string
12:06:56,577 DEBUG Binder:486 - Mapped property: dob -> dob, type: date
12:06:56,577 DEBUG Binder:486 - Mapped property: email -> email, type: string
12:06:56,578 DEBUG Binder:486 - Mapped property: state -> state, type: string
12:06:56,579 DEBUG Binder:486 - Mapped property: request -> request, type: string
12:06:56,579 DEBUG Binder:486 - Mapped property: name -> name, type: string
12:06:56,580 DEBUG Binder:486 - Mapped property: city -> city, type: string
12:06:56,581 DEBUG Binder:486 - Mapped property: zipcode -> zipcode, type: string
12:06:56,582 DEBUG Binder:486 - Mapped property: role -> role_id, type: com.cfreecom.dating.hib2.Role
12:06:56,583 DEBUG Binder:486 - Mapped property: photoSet, type: java.util.Set
12:06:56,588 INFO Configuration:1067 - Configured SessionFactory: null
12:06:56,588 DEBUG Configuration:1068 - properties: {java.vendor=Sun Microsystems Inc., catalina.base=/usr/local/jakarta-tomcat-5.0.28, hibernate.connection.url=jdbc:mysql://localhost:3306/dating, sun.management.compiler=HotSpot Client Compiler, c3p0.min_size=2, catalina.useNaming=true, os.name=Linux, sun.boot.class.path=/usr/local/jakarta-tomcat-5.0.28/common/endorsed/xercesImpl.jar:/usr/local/jakarta-tomcat-5.0.28/common/endorsed/xml-apis.jar:/usr/local/jdk1.5.0_03/jre/lib/rt.jar:/usr/local/jdk1.5.0_03/jre/lib/i18n.jar:/usr/local/jdk1.5.0_03/jre/lib/sunrsasign.jar:/usr/local/jdk1.5.0_03/jre/lib/jsse.jar:/usr/local/jdk1.5.0_03/jre/lib/jce.jar:/usr/local/jdk1.5.0_03/jre/lib/charsets.jar:/usr/local/jdk1.5.0_03/jre/classes, sun.desktop=gnome, hibernate.c3p0.max_size=5, java.vm.specification.vendor=Sun Microsystems Inc., c3p0.max_size=5, java.runtime.version=1.5.0_03-b07, hibernate.c3p0.min_size=2, user.name=root, shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar, hibernate.c3p0.timeout=900, user.language=en, java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory, sun.boot.library.path=/usr/local/jdk1.5.0_03/jre/lib/i386, dialect=net.sf.hibernate.dialect.MySQLDialect, java.version=1.5.0_03, user.timezone=Asia/Shanghai, sun.arch.data.model=32, hibernate.use_outer_join=true, java.endorsed.dirs=/usr/local/jakarta-tomcat-5.0.28/common/endorsed, sun.cpu.isalist=, sun.jnu.encoding=UTF-8, file.encoding.pkg=sun.io, package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.,sun.beans., file.separator=/, java.specification.name=Java Platform API Specification, hibernate.cglib.use_reflection_optimizer=true, java.class.version=49.0, user.country=US, java.home=/usr/local/jdk1.5.0_03/jre, java.vm.info=mixed mode, os.version=2.4.27-2-386, path.separator=:, java.vm.version=1.5.0_03-b07, hibernate.connection.password=dating, java.awt.printerjob=sun.print.PSPrinterJob, sun.io.unicode.encoding=UnicodeLittle, hibernate.connection.username=dating, package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper., java.naming.factory.url.pkgs=org.apache.naming, user.home=/root, java.specification.vendor=Sun Microsystems Inc., java.library.path=/usr/local/jdk1.5.0_03/jre/lib/i386/client:/usr/local/jdk1.5.0_03/jre/lib/i386:/usr/local/jdk1.5.0_03/jre/../lib/i386, java.vendor.url=http://java.sun.com/, hibernate.connection.driver_class=com.mysql.jdbc.Driver, java.vm.vendor=Sun Microsystems Inc., hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, common.loader=${catalina.home}/common/classes,${catalina.home}/common/endorsed/*.jar,${catalina.home}/common/lib/*.jar, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, java.class.path=/usr/local/jdk1.5.0_03/lib/tools.jar:/usr/local/jakarta-tomcat-5.0.28/bin/bootstrap.jar:/usr/local/jakarta-tomcat-5.0.28/bin/commons-logging-api.jar, c3p0.timeout=900, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.0, catalina.home=/usr/local/jakarta-tomcat-5.0.28, sun.cpu.endian=little, sun.os.patch.level=unknown, java.io.tmpdir=/usr/local/jakarta-tomcat-5.0.28/temp, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, server.loader=${catalina.home}/server/classes,${catalina.home}/server/lib/*.jar, os.arch=i386, java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment, java.ext.dirs=/usr/local/jdk1.5.0_03/jre/lib/ext, user.dir=/usr/local/jakarta-tomcat-5.0.28, line.separator=
, java.vm.name=Java HotSpot(TM) Client VM, file.encoding=UTF-8, java.specification.version=1.5, hibernate.show_sql=true, hibernate.connection.pool_size=2}
12:06:56,589 INFO Configuration:641 - processing one-to-many association mappings
12:06:56,590 DEBUG Binder:1353 - Second pass for collection: com.cfreecom.dating.hib2.Role.userSet
12:06:56,590 INFO Binder:1181 - Mapping collection: com.cfreecom.dating.hib2.Role.userSet -> user
12:06:56,591 DEBUG Binder:1368 - Mapped collection key: role_id, one-to-many: com.cfreecom.dating.hib2.User
12:06:56,591 DEBUG Binder:1353 - Second pass for collection: com.cfreecom.dating.hib2.User.photoSet
12:06:56,592 INFO Binder:1181 - Mapping collection: com.cfreecom.dating.hib2.User.photoSet -> photo
12:06:56,593 DEBUG Binder:1368 - Mapped collection key: user_id, one-to-many: com.cfreecom.dating.hib2.Photo
12:06:56,593 INFO Configuration:650 - processing one-to-one association property references
12:06:56,594 INFO Configuration:675 - processing foreign key constraints
12:06:56,594 DEBUG Configuration:692 - resolving reference to class: com.cfreecom.dating.hib2.Role
12:06:56,597 DEBUG Configuration:692 - resolving reference to class: com.cfreecom.dating.hib2.User
12:06:56,638 INFO Dialect:86 - Using dialect: net.sf.hibernate.dialect.MySQLDialect
12:06:56,641 DEBUG SQLExceptionConverterFactory:49 - Using dialect defined converter
12:06:56,649 INFO SettingsFactory:70 - Maximim outer join fetch depth: 2
12:06:56,650 INFO SettingsFactory:74 - Use outer join fetching: true
12:06:56,654 INFO C3P0ConnectionProvider:48 - C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/dating
12:06:56,655 INFO C3P0ConnectionProvider:49 - Connection properties: {user=dating, password=dating}
12:06:56,696 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@12342ed [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@bcc8f4 [ acquireIncrement -> 1, autoCommitOnClose -> false, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, idleConnectionTestPeriod -> 0, initialPoolSize -> 2, maxIdleTime -> 900, maxPoolSize -> 5, maxStatements -> 0, minPoolSize -> 2, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@1fef80a [ description -> null, driverClass -> null, factoryClassLocation -> null, jdbcUrl -> jdbc:mysql://localhost:3306/dating, properties -> {user=dating, password=dating} ] , propertyCycle -> 300, testConnectionOnCheckout -> false ] , factoryClassLocation -> null, numHelperThreads -> 3 ]
12:06:56,998 INFO SettingsFactory:114 - Use scrollable result sets: true
12:06:56,999 INFO SettingsFactory:117 - Use JDBC3 getGeneratedKeys(): true
12:06:57,000 INFO SettingsFactory:120 - Optimize cache for minimal puts: false
12:06:57,000 INFO SettingsFactory:126 - echoing all SQL to stdout
12:06:57,001 INFO SettingsFactory:129 - Query language substitutions: {}
12:06:57,001 INFO SettingsFactory:140 - cache provider: net.sf.hibernate.cache.EhCacheProvider
12:06:57,007 DEBUG SettingsFactory:173 - Wrap result sets enabled? : false
12:06:57,008 INFO Configuration:1130 - instantiating and configuring caches
12:06:57,024 WARN Configurator:125 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: file:/usr/local/jakarta-tomcat-5.0.28/work/Catalina/localhost/dating/loader/ehcache-failsafe.xml
12:06:57,057 INFO SessionFactoryImpl:119 - building session factory
12:06:57,058 DEBUG SessionFactoryImpl:125 - instantiating session factory with properties: {java.vendor=Sun Microsystems Inc., catalina.base=/usr/local/jakarta-tomcat-5.0.28, hibernate.connection.url=jdbc:mysql://localhost:3306/dating, sun.management.compiler=HotSpot Client Compiler, c3p0.min_size=2, catalina.useNaming=true, os.name=Linux, sun.boot.class.path=/usr/local/jakarta-tomcat-5.0.28/common/endorsed/xercesImpl.jar:/usr/local/jakarta-tomcat-5.0.28/common/endorsed/xml-apis.jar:/usr/local/jdk1.5.0_03/jre/lib/rt.jar:/usr/local/jdk1.5.0_03/jre/lib/i18n.jar:/usr/local/jdk1.5.0_03/jre/lib/sunrsasign.jar:/usr/local/jdk1.5.0_03/jre/lib/jsse.jar:/usr/local/jdk1.5.0_03/jre/lib/jce.jar:/usr/local/jdk1.5.0_03/jre/lib/charsets.jar:/usr/local/jdk1.5.0_03/jre/classes, sun.desktop=gnome, hibernate.c3p0.max_size=5, java.vm.specification.vendor=Sun Microsystems Inc., c3p0.max_size=5, java.runtime.version=1.5.0_03-b07, hibernate.c3p0.min_size=2, user.name=root, shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar, hibernate.c3p0.timeout=900, user.language=en, java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory, sun.boot.library.path=/usr/local/jdk1.5.0_03/jre/lib/i386, dialect=net.sf.hibernate.dialect.MySQLDialect, java.version=1.5.0_03, user.timezone=Asia/Shanghai, sun.arch.data.model=32, hibernate.use_outer_join=true, java.endorsed.dirs=/usr/local/jakarta-tomcat-5.0.28/common/endorsed, sun.cpu.isalist=, sun.jnu.encoding=UTF-8, file.encoding.pkg=sun.io, package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.,sun.beans., file.separator=/, java.specification.name=Java Platform API Specification, hibernate.cglib.use_reflection_optimizer=true, java.class.version=49.0, user.country=US, java.home=/usr/local/jdk1.5.0_03/jre, java.vm.info=mixed mode, os.version=2.4.27-2-386, path.separator=:, java.vm.version=1.5.0_03-b07, hibernate.connection.password=dating, java.awt.printerjob=sun.print.PSPrinterJob, sun.io.unicode.encoding=UnicodeLittle, hibernate.connection.username=dating, package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper., java.naming.factory.url.pkgs=org.apache.naming, user.home=/root, java.specification.vendor=Sun Microsystems Inc., java.library.path=/usr/local/jdk1.5.0_03/jre/lib/i386/client:/usr/local/jdk1.5.0_03/jre/lib/i386:/usr/local/jdk1.5.0_03/jre/../lib/i386, java.vendor.url=http://java.sun.com/, hibernate.connection.driver_class=com.mysql.jdbc.Driver, java.vm.vendor=Sun Microsystems Inc., hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, common.loader=${catalina.home}/common/classes,${catalina.home}/common/endorsed/*.jar,${catalina.home}/common/lib/*.jar, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, java.class.path=/usr/local/jdk1.5.0_03/lib/tools.jar:/usr/local/jakarta-tomcat-5.0.28/bin/bootstrap.jar:/usr/local/jakarta-tomcat-5.0.28/bin/commons-logging-api.jar, c3p0.timeout=900, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.0, catalina.home=/usr/local/jakarta-tomcat-5.0.28, sun.cpu.endian=little, sun.os.patch.level=unknown, java.io.tmpdir=/usr/local/jakarta-tomcat-5.0.28/temp, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, server.loader=${catalina.home}/server/classes,${catalina.home}/server/lib/*.jar, os.arch=i386, java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment, java.ext.dirs=/usr/local/jdk1.5.0_03/jre/lib/ext, user.dir=/usr/local/jakarta-tomcat-5.0.28, line.separator=
, java.vm.name=Java HotSpot(TM) Client VM, file.encoding=UTF-8, java.specification.version=1.5, hibernate.show_sql=true, hibernate.connection.pool_size=2}
12:06:57,360 WARN XMLDatabinder:261 - no XSLT implementation found - databinding disabled
12:06:57,363 DEBUG SessionFactoryObjectFactory:39 - initializing class SessionFactoryObjectFactory
12:06:57,366 DEBUG SessionFactoryObjectFactory:76 - registered: ff8080810436149b010436149c510000 (unnamed)
12:06:57,367 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
12:06:57,368 DEBUG SessionFactoryImpl:196 - instantiated session factory
BaseHibUtilAction ... static ... try ... sessionFactory->net.sf.hibernate.impl.SessionFactoryImpl@7023f
Hibernate - CatAction ...
ActAction ... try
12:06:57,370 WARN RequestProcessor:509 - Unhandled Exception thrown: class java.lang.NullPointerException
Jun 1, 2005 12:09:20 PM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already (the eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact)

great appreciated for your value comments

max


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 01, 2005 12:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Quote:
java.lang.NullPointerException
com.cfreecom.dating.actions.BaseHibUtilAction.getSession(BaseHibUtilAction.java:38)
com.cfreecom.dating.actions.CatAction.execute(CatAction.java:33)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


Yes, reading stack traces is an art form, but come-on...

You have a class named BaseHibUtilAction with a method named getSession. In that method (at line 38) you have a NPE. You have not shown us the code for BaseHibUtilAction.getSession(), so hard to help you track down your bug any more than that...


Top
 Profile  
 
 Post subject: thx steve. code for methods of getSession()
PostPosted: Wed Jun 01, 2005 12:46 am 
Newbie

Joined: Mon Feb 21, 2005 3:49 am
Posts: 15
actually the code of method of getSession is included, but I post it again

thx steve

max

public static Session getSession() throws HibernateException {

Session s = (Session) session.get();

// Open a new Session, if this Thread has none yet
if (s == null) {
s = sessionFactory.openSession();
session.set(s);
}
return s;
}



steve wrote:
Quote:
java.lang.NullPointerException
com.cfreecom.dating.actions.BaseHibUtilAction.getSession(BaseHibUtilAction.java:38)
com.cfreecom.dating.actions.CatAction.execute(CatAction.java:33)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


Yes, reading stack traces is an art form, but come-on...

You have a class named BaseHibUtilAction with a method named getSession. In that method (at line 38) you have a NPE. You have not shown us the code for BaseHibUtilAction.getSession(), so hard to help you track down your bug any more than that...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


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

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.