-->
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.  [ 8 posts ] 
Author Message
 Post subject: action class problems (struts and hibernate)
PostPosted: Fri Mar 05, 2004 2:51 am 
Newbie

Joined: Tue Feb 10, 2004 2:11 pm
Posts: 15
Hello,

I am running Hibernate 2.1.1, Struts, and MySQL 1.4 database for my web application.

Here is a little piece of the Struts-config.xml file:
<action
path="/login"
type="com.tjgrp.guava.timesheet.LoginAction"
scope="request"
name="loginForm"
input="/login.jsp">
<forward name="success" path="/Welcome.jsp" redirect="true" />
<forward name="failure" path="/login.jsp" redirect="true" />
</action>

The problem I am having is that somehow 'success' never happens. (I deployed the application and checked). It also seems that in the Action class (loginAction) , something is not working as it should. Could you tell me what I am doing wrong?


public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
ActionForward forward = null;
LoginForm loginform = (LoginForm) form;

String password = loginform.getPassword();
String identifier = loginform.getIdentifier();

try {
Context ctx = new InitialContext();
SessionFactory sf = (SessionFactory) ctx.lookup(
"guava:/hibernate/SessionFactory");
Session session = sessionFactory.openSession();

String query =
"select guavauser from com.tjgrp.guava.data.GuavaUser guavauser " +
"where guavauser.password = :password and " +
"guavauser.identifier = :identifier";

Query q = session.createQuery(query);
q.setParameter("identifier", identifier, Hibernate.STRING);
q.setParameter("password", password, Hibernate.STRING);

GuavaUser gUser = (GuavaUser) q.uniqueResult();

request.setAttribute("objId", gUser);
forward = mapping.findForward("success");
loginform.clear();
session.close();

} catch (NamingException e) {
System.err.println("Naming Exception" + e.getMessage());
throw new RuntimeException(e);

} catch (HibernateException e) {
System.err.println("Hibernate Exception" + e.getMessage());
throw new RuntimeException(e);

} finally {
return forward;
}
}

Here is the stack trace:
----------------------------
INFO: Installing web application at context path /build from URL file:C:\Apache Software\Tomcat 5.0\webapps\build
14:30:03,171 INFO Environment:432 - Hibernate 2.1.1
14:30:03,187 INFO Environment:461 - hibernate.properties not found
14:30:03,187 INFO Environment:481 - using CGLIB reflection optimizer
14:30:03,203 INFO Configuration:843 - configuring from resource: /hibernate.cfg.xml
14:30:03,203 INFO Configuration:815 - Configuration resource: /hibernate.cfg.xml
14:30:03,343 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibern ... on-2.0.dtd in classpath under net/sf/hibernate/
14:30:03,468 DEBUG DTDEntityResolver:29 - found http://hibernate.sourceforge.net/hibern ... on-2.0.dtd in classpath
14:30:03,562 DEBUG Configuration:801 - dialect=net.sf.hibernate.dialect.MySQLDialect
14:30:03,578 DEBUG Configuration:801 - connection.username=root
14:30:03,578 DEBUG Configuration:801 - connection.password=
14:30:03,578 DEBUG Configuration:801 - connection.url=jdbc:mysql:///guava
14:30:03,578 DEBUG Configuration:801 - connection.driver_class=com.mysql.jdbc.Driver
14:30:03,578 DEBUG Configuration:801 - show_sql=true
14:30:03,578 DEBUG Configuration:801 - use_outer_join=true
14:30:03,578 DEBUG Configuration:801 - transaction.factory_class=net.sf.hibernate.transaction.JDBCTransactionFactory
14:30:03,593 DEBUG Configuration:801 - dbcp.minIdle=1
14:30:03,593 DEBUG Configuration:801 - cache.use_query_cache=true
14:30:03,593 DEBUG Configuration:952 - guava:/hibernate/SessionFactory<-org.dom4j.tree.DefaultAttribute@873723 [Attribute: name resource value "com/tjgrp/guava/data/GuavaUser.hbm.xml"]
14:30:03,593 INFO Configuration:300 - Mapping resource: com/tjgrp/guava/data/GuavaUser.hbm.xml
14:30:03,640 DEBUG DTDEntityResolver:20 - trying to locate http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
14:30:03,640 DEBUG DTDEntityResolver:29 - found http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
14:30:03,828 INFO Binder:225 - Mapping class: com.tjgrp.guava.data.GuavaUser -> guavauser
14:30:04,015 DEBUG Binder:449 - Mapped property: objId -> objId, type: long
14:30:04,062 DEBUG Binder:449 - Mapped property: identifier -> identifier, type: string
14:30:04,062 DEBUG Binder:449 - Mapped property: password -> password, type: string
14:30:04,062 DEBUG Binder:449 - Mapped property: firstName -> firstName, type: string
14:30:04,062 DEBUG Binder:449 - Mapped property: lastName -> lastName, type: string
14:30:04,062 INFO Configuration:998 - Configured SessionFactory: guava:/hibernate/SessionFactory
14:30:04,078 DEBUG Configuration:999 - properties: {show_sql=true, java.vendor=Sun Microsystems Inc., catalina.base=C:\Apache Software\Tomcat 5.0, hibernate.connection.url=jdbc:mysql:///guava, catalina.useNaming=true, os.name=Windows XP, sun.boot.class.path=C:\Apache Software\Tomcat 5.0\common\endorsed\xercesImpl.jar;C:\Apache Software\Tomcat 5.0\common\endorsed\xmlParserAPIs.jar;C:\Program Files\Java\j2re1.4.2_03\lib\rt.jar;C:\Program Files\Java\j2re1.4.2_03\lib\i18n.jar;C:\Program Files\Java\j2re1.4.2_03\lib\sunrsasign.jar;C:\Program Files\Java\j2re1.4.2_03\lib\jsse.jar;C:\Program Files\Java\j2re1.4.2_03\lib\jce.jar;C:\Program Files\Java\j2re1.4.2_03\lib\charsets.jar;C:\Program Files\Java\j2re1.4.2_03\classes, sun.java2d.fontpath=, java.vm.specification.vendor=Sun Microsystems Inc., java.runtime.version=1.4.2_03-b02, user.name=SYSTEM, shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar, hibernate.session_factory_name=guava:/hibernate/SessionFactory, connection.driver_class=com.mysql.jdbc.Driver, user.language=en, java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory, sun.boot.library.path=C:\Program Files\Java\j2re1.4.2_03\bin, dialect=net.sf.hibernate.dialect.MySQLDialect, java.version=1.4.2_03, user.timezone=America/New_York, sun.arch.data.model=32, hibernate.use_outer_join=true, java.endorsed.dirs=C:\Apache Software\Tomcat 5.0\common\endorsed, sun.cpu.isalist=pentium i486 i386, file.encoding.pkg=sun.io, cache.use_query_cache=true, 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=48.0, hibernate.dbcp.minIdle=1, user.country=US, connection.url=jdbc:mysql:///guava, java.home=C:\Program Files\Java\j2re1.4.2_03, java.vm.info=mixed mode, os.version=5.1, transaction.factory_class=net.sf.hibernate.transaction.JDBCTransactionFactory, hibernate.transaction.factory_class=net.sf.hibernate.transaction.JDBCTransactionFactory, path.separator=;, connection.password=, java.vm.version=1.4.2_03-b02, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, hibernate.connection.password=, user.variant=, java.awt.printerjob=sun.awt.windows.WPrinterJob, sun.io.unicode.encoding=UnicodeLittle, awt.toolkit=sun.awt.windows.WToolkit, hibernate.connection.username=root, 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=C:\WINDOWS\system32\config\systemprofile, java.specification.vendor=Sun Microsystems Inc., java.library.path=C:\Program Files\Java\j2re1.4.2_03\bin;.;C:\WINDOWS\System32;C:\WINDOWS;C:\WINDOWS\System32;C:\j2sdk1.4.2_03\bin, java.vendor.url=http://java.sun.com/, hibernate.connection.driver_class=com.mysql.jdbc.Driver, connection.username=root, 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=C:\Apache Software\Tomcat 5.0\bin\bootstrap.jar, use_outer_join=true, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.0, catalina.home=C:\Apache Software\Tomcat 5.0, hibernate.cache.use_query_cache=true, sun.cpu.endian=little, sun.os.patch.level=Service Pack 1, java.io.tmpdir=C:\WINDOWS\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=x86, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.ext.dirs=C:\Program Files\Java\j2re1.4.2_03\lib\ext, user.dir=C:\Apache Software\Tomcat 5.0, dbcp.minIdle=1, line.separator=
, java.vm.name=Java HotSpot(TM) Client VM, file.encoding=Cp1252, java.specification.version=1.4, hibernate.show_sql=true}
14:30:04,078 INFO Configuration:584 - processing one-to-many association mappings
14:30:04,093 INFO Configuration:593 - processing one-to-one association property references
14:30:04,093 INFO Configuration:618 - processing foreign key constraints
14:30:04,156 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.MySQLDialect
14:30:04,156 INFO SettingsFactory:62 - Use outer join fetching: true
14:30:04,171 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
14:30:04,171 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 20
14:30:04,187 INFO DriverManagerConnectionProvider:71 - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql:///guava
14:30:04,187 INFO DriverManagerConnectionProvider:72 - connection properties: {user=root, password=}
14:30:04,203 INFO TransactionFactoryFactory:31 - Transaction strategy: net.sf.hibernate.transaction.JDBCTransactionFactory
14:30:04,218 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
14:30:04,218 DEBUG DriverManagerConnectionProvider:78 - total checked-out connections: 0
14:30:04,218 DEBUG DriverManagerConnectionProvider:94 - opening new JDBC connection
14:30:04,515 DEBUG DriverManagerConnectionProvider:100 - created connection to: jdbc:mysql:///guava, Isolation Level: 4
14:30:04,515 DEBUG DriverManagerConnectionProvider:114 - returning connection to pool, pool size: 1
14:30:04,531 INFO SettingsFactory:89 - Use scrollable result sets: true
14:30:04,531 INFO SettingsFactory:90 - JDBC 2 max batch size: 15
14:30:04,531 INFO SettingsFactory:96 - echoing all SQL to stdout
14:30:04,531 INFO SettingsFactory:99 - Query language substitutions: {}
14:30:04,531 INFO SettingsFactory:110 - cache provider: net.sf.ehcache.hibernate.Provider
14:30:04,546 INFO Configuration:1057 - instantiating and configuring caches
14:30:04,890 INFO SessionFactoryImpl:119 - building session factory
14:30:04,890 DEBUG SessionFactoryImpl:125 - instantiating session factory with properties: {show_sql=true, java.vendor=Sun Microsystems Inc., catalina.base=C:\Apache Software\Tomcat 5.0, hibernate.connection.url=jdbc:mysql:///guava, catalina.useNaming=true, os.name=Windows XP, sun.boot.class.path=C:\Apache Software\Tomcat 5.0\common\endorsed\xercesImpl.jar;C:\Apache Software\Tomcat 5.0\common\endorsed\xmlParserAPIs.jar;C:\Program Files\Java\j2re1.4.2_03\lib\rt.jar;C:\Program Files\Java\j2re1.4.2_03\lib\i18n.jar;C:\Program Files\Java\j2re1.4.2_03\lib\sunrsasign.jar;C:\Program Files\Java\j2re1.4.2_03\lib\jsse.jar;C:\Program Files\Java\j2re1.4.2_03\lib\jce.jar;C:\Program Files\Java\j2re1.4.2_03\lib\charsets.jar;C:\Program Files\Java\j2re1.4.2_03\classes, sun.java2d.fontpath=, java.vm.specification.vendor=Sun Microsystems Inc., java.runtime.version=1.4.2_03-b02, user.name=SYSTEM, shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar, hibernate.session_factory_name=guava:/hibernate/SessionFactory, connection.driver_class=com.mysql.jdbc.Driver, user.language=en, java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory, sun.boot.library.path=C:\Program Files\Java\j2re1.4.2_03\bin, dialect=net.sf.hibernate.dialect.MySQLDialect, java.version=1.4.2_03, user.timezone=America/New_York, sun.arch.data.model=32, hibernate.use_outer_join=true, java.endorsed.dirs=C:\Apache Software\Tomcat 5.0\common\endorsed, sun.cpu.isalist=pentium i486 i386, file.encoding.pkg=sun.io, cache.use_query_cache=true, 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=48.0, hibernate.dbcp.minIdle=1, user.country=US, connection.url=jdbc:mysql:///guava, java.home=C:\Program Files\Java\j2re1.4.2_03, java.vm.info=mixed mode, os.version=5.1, transaction.factory_class=net.sf.hibernate.transaction.JDBCTransactionFactory, hibernate.transaction.factory_class=net.sf.hibernate.transaction.JDBCTransactionFactory, path.separator=;, connection.password=, java.vm.version=1.4.2_03-b02, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, hibernate.connection.password=, user.variant=, java.awt.printerjob=sun.awt.windows.WPrinterJob, sun.io.unicode.encoding=UnicodeLittle, awt.toolkit=sun.awt.windows.WToolkit, hibernate.connection.username=root, 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=C:\WINDOWS\system32\config\systemprofile, java.specification.vendor=Sun Microsystems Inc., java.library.path=C:\Program Files\Java\j2re1.4.2_03\bin;.;C:\WINDOWS\System32;C:\WINDOWS;C:\WINDOWS\System32;C:\j2sdk1.4.2_03\bin, java.vendor.url=http://java.sun.com/, hibernate.connection.driver_class=com.mysql.jdbc.Driver, connection.username=root, 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=C:\Apache Software\Tomcat 5.0\bin\bootstrap.jar, use_outer_join=true, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.0, catalina.home=C:\Apache Software\Tomcat 5.0, hibernate.cache.use_query_cache=true, sun.cpu.endian=little, sun.os.patch.level=Service Pack 1, java.io.tmpdir=C:\WINDOWS\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=x86, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.ext.dirs=C:\Program Files\Java\j2re1.4.2_03\lib\ext, user.dir=C:\Apache Software\Tomcat 5.0, dbcp.minIdle=1, line.separator=
, java.vm.name=Java HotSpot(TM) Client VM, file.encoding=Cp1252, java.specification.version=1.4, hibernate.show_sql=true}
14:30:06,265 DEBUG SessionFactoryObjectFactory:39 - initializing class SessionFactoryObjectFactory
14:30:06,281 DEBUG SessionFactoryObjectFactory:76 - registered: 981cb4a1fb175a9800fb175a9f2a0000 (guava:/hibernate/SessionFactory)
14:30:06,281 INFO SessionFactoryObjectFactory:86 - Factory name: guava:/hibernate/SessionFactory
14:30:06,281 INFO NamingHelper:26 - JNDI InitialContext properties:{}
14:30:06,281 DEBUG NamingHelper:48 - binding: guava:/hibernate/SessionFactory
14:30:06,296 DEBUG NamingHelper:58 - lookup: guava:
14:30:06,296 INFO NamingHelper:68 - Creating subcontext: guava:
14:30:06,296 DEBUG NamingHelper:58 - lookup: hibernate
14:30:06,296 INFO NamingHelper:68 - Creating subcontext: hibernate
14:30:06,296 DEBUG NamingHelper:73 - binding: SessionFactory
14:30:06,296 DEBUG SessionFactoryImpl:381 - Returning a Reference to the SessionFactory
14:30:06,312 DEBUG NamingHelper:76 - Bound name: guava:/hibernate/SessionFactory
14:30:06,312 INFO SessionFactoryObjectFactory:91 - Bound factory to JNDI name: guava:/hibernate/SessionFactory
14:30:06,312 WARN SessionFactoryObjectFactory:101 - InitialContext did not implement EventContext
14:30:06,312 DEBUG SessionFactoryImpl:196 - instantiated session factory
14:30:06,312 INFO UpdateTimestampsCache:35 - starting update timestamps cache at region: net.sf.hibernate.cache.UpdateTimestampsCache
14:30:06,406 WARN Configurator:123 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: file:/C:/Apache Software/Tomcat 5.0/work/Catalina/localhost/build/loader/ehcache-failsafe.xml
14:30:06,421 WARN Plugin:95 - Could not find configuration for net.sf.hibernate.cache.UpdateTimestampsCache. Configuring using the defaultCache settings.
14:30:06,718 INFO QueryCache:39 - starting query cache at region: net.sf.hibernate.cache.QueryCache
14:30:06,718 WARN Plugin:95 - Could not find configuration for net.sf.hibernate.cache.QueryCache. Configuring using the defaultCache settings.


Could the warning I am getting at the end be the problem?

Some feedback is really appreciated..


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 05, 2004 3:59 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
try to comment some lines or debug (the best way) if you're using eclipse or jbuilder.


pretty sure forward = mapping.findForward("success"); is not reached


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 05, 2004 10:24 am 
Newbie

Joined: Tue Feb 10, 2004 2:11 pm
Posts: 15
"pretty sure forward = mapping.findForward("success"); is not reached"


Yes I know it is not reached.... I debugged the code but I don't know why it is never reached..... Bottom line: I want to know whether I am writing the LoginAction class in the correct way to handle Hibernate. There is something not functioning inside the try-catch block..
Could it be something in the HibernatePlugIn.java file perhaps? Here it is for reference. Thank again.

package edu.arbor.util.plugin;

import java.net.URL;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import net.sf.hibernate.SessionFactory;
import net.sf.hibernate.cfg.Configuration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.action.PlugIn;
import org.apache.struts.config.ModuleConfig;


/**
* Implements the <code>PlugIn</code> interface to configure the Hibernate
* data persistence library. A configured
* <code>net.sf.hibernate.SessionFactory</code> is stored in the
* <code>ServletContext</code> of the web application unless the property
* <code>storedInServletContext</code> is set to <code>false</code>.
*
* <p>
* &lt;plugin class=&quot;net.sf.hibernate.plugins.struts.HibernatePlugIn&quot;&gt;
* &lt;set-property name=&quot;configFilePath&quot"
* value=&quot;path-to-config-file&quot;/&gt;
* &lt;set-property name=&quot;storedInServletContext&quot"
* value=&quot;true-or-false&quot;/&gt;
* &lt;/plugin&gt;
*/
public class HibernatePlugIn implements PlugIn {
/**
* the key under which the <code>SessionFactory</code> instance is stored
* in the <code>ServletContext</code>.
*/
public static final String SESSION_FACTORY_KEY = SessionFactory.class.getName();
private static Log _log = LogFactory.getLog(HibernatePlugIn.class);

/**
* indicates whether the <code>SessionFactory</code> instance will be stored
* in the <code>ServletContext</code>, or not.
*/
private boolean _storedInServletContext = true;

/**
* the path to the xml configuration file. the path should start with a
* '/' character and be relative to the root of the class path.
* (DEFAULT: "/hibernate.cfg.xml")
*/
private String _configFilePath = "/hibernate.cfg.xml";
private ActionServlet _servlet = null;
private ModuleConfig _config = null;
private SessionFactory _factory = null;

/**
* Destroys the <code>SessionFactory</code> instance.
*/
public void destroy() {
_servlet = null;
_config = null;

try {
_log.debug("Destroying SessionFactory...");

_factory.close();

_log.debug("SessionFactory destroyed...");
} catch (Exception e) {
_log.error("Unable to destroy SessionFactory...(exception ignored)",
e);
}
}

/**
* Initializes the <code>SessionFactory</code>.
* @param servlet the <code>ActionServlet</code> instance under which the
* plugin will run.
* @param config the <code>ModuleConfig</code> for the module under which
* the plugin will run.
*/
public void init(ActionServlet servlet, ModuleConfig config)
throws ServletException {
_servlet = servlet;
_config = config;

initHibernate();
}

/**
* Initializes Hibernate with the config file found at
* <code>configFilePath</code>.
*/
private void initHibernate() throws ServletException {
Configuration configuration = null;
URL configFileURL = null;
ServletContext context = null;

try {
configFileURL = HibernatePlugIn.class.getResource(_configFilePath);
context = _servlet.getServletContext();

if (_log.isDebugEnabled()) {
_log.debug("Initializing Hibernate from " + _configFilePath +
"...");
}

configuration = (new Configuration()).configure(
"/hibernate.cfg.xml");

_factory = configuration.buildSessionFactory();

if (_storedInServletContext) {
_log.debug("Storing SessionFactory in ServletContext...");

context.setAttribute(SESSION_FACTORY_KEY, _factory);
}
} catch (Throwable t) {
_log.error("Exception while initializing Hibernate.");
_log.error("Rethrowing exception...", t);

throw (new ServletException(t));
}
}

/**
* Setter for property configFilePath.
* @param configFilePath New value of property configFilePath.
*/
public void setConfigFilePath(String configFilePath) {
if ((configFilePath == null) || (configFilePath.trim().length() == 0)) {
throw new IllegalArgumentException(
"configFilePath cannot be blank or null.");
}

if (_log.isDebugEnabled()) {
_log.debug("Setting 'configFilePath' to '" + configFilePath +
"'...");
}

_configFilePath = configFilePath;
}

/**
* Setter for property storedInServletContext.
* @param storedInServletContext New value of property storedInServletContext.
*/
public void setStoredInServletContext(String storedInServletContext) {
if ((storedInServletContext == null) ||
(storedInServletContext.trim().length() == 0)) {
storedInServletContext = "false";
}

if (_log.isDebugEnabled()) {
_log.debug("Setting 'storedInServletContext' to '" +
storedInServletContext + "'...");
}

_storedInServletContext = new Boolean(storedInServletContext).booleanValue();
}
}


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 05, 2004 1:49 pm 
Newbie

Joined: Tue Feb 10, 2004 2:11 pm
Posts: 15
Please disregard my question... I figured out where I was going wrong ;-)

Thanks for your help


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 05, 2004 3:13 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
tell where was the error, it could be usefull for other users


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 05, 2004 3:33 pm 
Newbie

Joined: Tue Feb 10, 2004 2:11 pm
Posts: 15
Well.. its too embarrasing to say :D


Instead of writing
SessionFactory sessionFactory = (SessionFactory) ctx.lookup(
"blah:/hibernate/SessionFactory");
Session session = sessionFactory.openSession();


I did:
SessionFactory sf = (SessionFactory) ctx.lookup(
"blah:/hibernate/SessionFactory");
Session session = sessionFactory.openSession();

hmm... so you see... its a no brainer ...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 05, 2004 3:37 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
:)


Top
 Profile  
 
 Post subject: Where is the solution?
PostPosted: Fri Jul 09, 2004 5:40 pm 
Newbie

Joined: Thu Jul 08, 2004 5:03 pm
Posts: 1
Where is the solution?

Except You are using undeclared variable (how that works?) i can not see how this could solve Your problem?

sf!=sessionFactory


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.