Need Help with Hibernate - "Not binding factory to JNDI, no JNDI name configured"

M

Mike S

Hello,

I am experimenting wtih Hibernate and after working out all of the
dependency issues and constructing my configuration/class files I am
getting the below error. I am using WS 5.1. My code and printouts
are below. Your help is appreciated.

Mike

App Server Console
------------------
*** Starting the server ***
************ Start Display Current Environment ************
WebSphere Platform 5.1 [BASE 5.1.0 b0344.02] running with process
name localhost\localhost\server1 and process id 512
Host Operating System is Windows XP, version 5.1
Java version = J2RE 1.4.1 IBM Windows 32 build cn1411-20031011 (JIT
enabled: jitc), Java Compiler = jitc, Java VM name = Classic VM
was.install.root = C:\Program Files\IBM\WebSphere
Studio\runtimes\base_v51
user.install.root = C:\Program Files\IBM\WebSphere
Studio\runtimes\base_v51
Java Home = C:\Program Files\IBM\WebSphere
Studio\runtimes\base_v51\java\jre
ws.ext.dirs = C:\Program Files\IBM\WebSphere
Studio\runtimes\base_v51/java/lib;C:\Program Files\IBM\WebSphere
Studio\runtimes\base_v51/classes;C:\Program Files\IBM\WebSphere
Studio\runtimes\base_v51/classes;C:\Program Files\IBM\WebSphere
Studio\runtimes\base_v51/lib;C:\Program Files\IBM\WebSphere
Studio\runtimes\base_v51/lib/ext;C:\Program Files\IBM\WebSphere
Studio\runtimes\base_v51/web/help;C:\Program Files\IBM\WebSphere
Studio\runtimes\base_v51/deploytool/itp/plugins/com.ibm.etools.ejbdeploy/runtime;C:/Program
Files/SQLLIB/java/db2java.zip;C:/Program Files/IBM/WebSphere
Studio/wstools/eclipse/plugins/com.ibm.etools.webservice_5.1.1/runtime/worf.jar
Classpath = C:\Program Files\IBM\WebSphere
Studio\runtimes\base_v51/properties;C:\Program Files\IBM\WebSphere
Studio\runtimes\base_v51/properties;C:\Program Files\IBM\WebSphere
Studio\runtimes\base_v51/lib/bootstrap.jar;C:\Program
Files\IBM\WebSphere Studio\runtimes\base_v51/lib/j2ee.jar;C:\Program
Files\IBM\WebSphere Studio\runtimes\base_v51/lib/lmproxy.jar;C:\Program
Files\IBM\WebSphere Studio\runtimes\base_v51/lib/urlprotocols.jar;C:\Program
Files\SQLLIB\java12\db2java.zip;C:\Development_Tools\hibernate-2.1\hibernate2.jar;C:\WSAD_5\external.jars\log4j-1.2.8.jar;C:\Development_Tools\commons-logging-1.0.4\commons-logging.jar;C:\Development_Tools\commons-collections-3.1\commons-collections-3.1.jar;C:\Development_Tools\dom4j-1.5.jar;C:\Development_Tools\odmg-3.0.jar;C:\Development_Tools\cglib-full-2.0.2.jar;C:/Program
Files/IBM/WebSphere Studio/wstools/eclipse/plugins/com.ibm.etools.websphere.tools.common_5.1.1/runtime/wteServers.jar;C:/Program
Files/IBM/WebSphere Studio/wstools/eclipse/plugins/com.ibm.etools.websphere.tools.common_5.1.1/runtime/wasToolsCommon.jar
Java Library path = C:\Program Files\IBM\WebSphere
Studio\runtimes\base_v51/bin;C:\Program Files\IBM\WebSphere
Studio\runtimes\base_v51/java/bin;C:\Program Files\IBM\WebSphere
Studio\runtimes\base_v51/java/jre/bin;C:\Program Files\IBM\WebSphere
Studio\eclipse\jre\bin;.;C:\Program Files\IBM\WebSphere
Studio\eclipse\jre\bin;C:\Perl\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
Files\PC-Doctor for Windows\services;C:\PROGRA~1\MICROS~2\Office;C:\PROGRA~1\IBM\IMNNQ;C:\Program
Files\IBM\Trace Facility;C:\Program Files\Personal
Communications\;C:\Program Files\SQLLIB\BIN;C:\Program
Files\SQLLIB\FUNCTION;C:\Program Files\SQLLIB\SAMPLES\REPL;C:\Program
Files\SQLLIB\HELP;C:\Program Files\IBM\IBM CICS Transaction
Gateway\BIN;%WSEDPath%;C:\Program Files\ObjREXX;C:\Program
Files\ObjREXX\OODIALOG;C:\Program Files\IBM\WebSphere
Studio\extras\bin;C:\Program Files\IBM\WebSphere Studio\bin;C:\Program
Files\IBM\WebSphere Studio\runtimes\base_v51\java\bin;C:\Program
Files\IBM\WebSphere Studio\runtimes\base_v51\java\jre\bin;C:\Program
Files\IBM\WebSphere Studio\runtimes\base_v51\java\jre\bin\classic;C:\Program
Files\Hummingbird\Connectivity\7.11\Accessories\;C:\Blazix;C:\mqclient\bin;C:\mqclient\tools\c\samples\bin;C:\CCCHarvest\Bin
************* End Display Current Environment *************
[9/16/04 17:33:18:704 EDT] 3cd386b5 ManagerAdmin I TRAS0017I: The
startup trace state is *=all=disabled.
[9/16/04 17:33:19:657 EDT] 3cd386b5 AdminInitiali A ADMN0015I:
AdminService initialized
[9/16/04 17:33:21:017 EDT] 3cd386b5 Configuration A SECJ0215I:
Successfully set JAAS login provider configuration class to
com.ibm.ws.security.auth.login.Configuration.
[9/16/04 17:33:21:079 EDT] 3cd386b5 SecurityDM I SECJ0231I: The
Security component's FFDC Diagnostic Module
com.ibm.ws.security.core.SecurityDM registered successfully: true.
[9/16/04 17:33:21:470 EDT] 3cd386b5 SecurityCompo I SECJ0309I: Java 2
Security is disabled.
[9/16/04 17:33:21:470 EDT] 3cd386b5 SecurityCompo I SECJ0212I: WCCM
JAAS configuration information successfully pushed to login provider
class.
[9/16/04 17:33:21:485 EDT] 3cd386b5 SecurityCompo I SECJ0240I:
Security service initialization completed successfully
[9/16/04 17:33:21:485 EDT] 3cd386b5 JMSRegistrati A MSGS0602I:
WebSphere Embedded Messaging Client only has been installed
[9/16/04 17:33:25:017 EDT] 3cd386b5 ResourceMgrIm I WSVR0049I: Binding
MVSDB2_CF as eis/jdbc/mvsdb2_CMP
[9/16/04 17:33:25:126 EDT] 3cd386b5 ResourceMgrIm I WSVR0049I: Binding
mvsdb2 as jdbc/mvsdb2
[9/16/04 17:33:25:783 EDT] 3cd386b5 CacheServiceI I DYNA0048I:
WebSphere Dynamic Cache initialized successfully.
[9/16/04 17:33:27:767 EDT] 3cd386b5 JMXSoapAdapte A ADMC0013I: SOAP
connector available at port 8880
[9/16/04 17:33:27:783 EDT] 3cd386b5 SecurityCompo I SECJ0243I:
Security service started successfully
[9/16/04 17:33:27:783 EDT] 3cd386b5 SecurityCompo I SECJ0210I:
Security enabled false
[9/16/04 17:33:28:861 EDT] 3cd386b5 ApplicationMg A WSVR0200I:
Starting application: IBMUTC
[9/16/04 17:33:29:017 EDT] 3cd386b5 WebContainer A SRVE0161I: IBM
WebSphere Application Server - Web Container. Copyright IBM Corp.
1998-2002
[9/16/04 17:33:29:033 EDT] 3cd386b5 WebContainer A SRVE0162I: Servlet
Specification Level: 2.3
[9/16/04 17:33:29:048 EDT] 3cd386b5 WebContainer A SRVE0163I:
Supported JSP Specification Level: 1.2
[9/16/04 17:33:29:189 EDT] 3cd386b5 WebContainer A SRVE0169I: Loading
Web Module: IBM Universal Test Client.
[9/16/04 17:33:29:486 EDT] 3cd386b5 WebGroup I SRVE0180I: [IBM
Universal Test Client] [/UTC] [Servlet.LOG]: JSP 1.2 Processor: init
[9/16/04 17:33:29:658 EDT] 3cd386b5 WebGroup I SRVE0180I: [IBM
Universal Test Client] [/UTC] [Servlet.LOG]: SimpleFileServlet: init
[9/16/04 17:33:29:752 EDT] 3cd386b5 ApplicationMg A WSVR0221I:
Application started: IBMUTC
[9/16/04 17:33:29:752 EDT] 3cd386b5 ApplicationMg A WSVR0200I:
Starting application: jdoplayEAR
[9/16/04 17:33:29:767 EDT] 3cd386b5 WebContainer A SRVE0169I: Loading
Web Module: JDO_Play_Project.
[9/16/04 17:33:29:814 EDT] 3cd386b5 WebGroup I SRVE0180I:
[JDO_Play_Project] [/JDO_Play_Project] [Servlet.LOG]: JSP 1.2
Processor: init
[9/16/04 17:33:29:845 EDT] 3cd386b5 WebGroup I SRVE0180I:
[JDO_Play_Project] [/JDO_Play_Project] [Servlet.LOG]:
SimpleFileServlet: init
[9/16/04 17:33:29:845 EDT] 3cd386b5 WebGroup I SRVE0180I:
[JDO_Play_Project] [/JDO_Play_Project] [Servlet.LOG]: InvokerServlet:
init
[9/16/04 17:33:29:877 EDT] 3cd386b5 ApplicationMg A WSVR0221I:
Application started: jdoplayEAR
[9/16/04 17:33:30:017 EDT] 3cd386b5 HttpTransport A SRVE0171I:
Transport http is listening on port 9,080.
[9/16/04 17:33:32:080 EDT] 3cd386b5 HttpTransport A SRVE0171I:
Transport https is listening on port 9,443.
[9/16/04 17:33:32:127 EDT] 3cd386b5 RMIConnectorC A ADMC0026I: RMI
Connector available at port 2809
[9/16/04 17:33:32:221 EDT] 3cd386b5 WsServer A WSVR0001I: Server
server1 open for e-business
[9/16/04 17:33:36:643 EDT] 5645c6b7 WebGroup I SRVE0180I:
[JDO_Play_Project] [/JDO_Play_Project] [Servlet.LOG]: /hibernate.jsp:
init
[9/16/04 17:33:36:736 EDT] 5645c6b7 Environment I
net.sf.hibernate.cfg.Environment Hibernate 2.1.6
[9/16/04 17:33:36:736 EDT] 5645c6b7 Environment I
net.sf.hibernate.cfg.Environment hibernate.properties not found
[9/16/04 17:33:36:736 EDT] 5645c6b7 Environment I
net.sf.hibernate.cfg.Environment using CGLIB reflection optimizer
[9/16/04 17:33:36:752 EDT] 5645c6b7 Configuration I
net.sf.hibernate.cfg.Configuration Mapping resource:
sandbox/hibernate/Message.hbm.xml
[9/16/04 17:33:37:283 EDT] 5645c6b7 Binder I
net.sf.hibernate.cfg.Binder Mapping class: sandbox.hibernate.Message
-> db2admin.MESSAGES
[9/16/04 17:33:37:377 EDT] 5645c6b7 Configuration I
net.sf.hibernate.cfg.Configuration processing one-to-many association
mappings
[9/16/04 17:33:37:377 EDT] 5645c6b7 Configuration I
net.sf.hibernate.cfg.Configuration processing one-to-one association
property references
[9/16/04 17:33:37:393 EDT] 5645c6b7 Configuration I
net.sf.hibernate.cfg.Configuration processing foreign key constraints
[9/16/04 17:33:37:408 EDT] 5645c6b7 SettingsFacto W
net.sf.hibernate.cfg.SettingsFactory No dialect set - using
GenericDialect: The dialect was not set. Set the property
hibernate.dialect.
[9/16/04 17:33:37:408 EDT] 5645c6b7 Dialect I
net.sf.hibernate.dialect.Dialect Using dialect:
net.sf.hibernate.dialect.GenericDialect
[9/16/04 17:33:37:424 EDT] 5645c6b7 SettingsFacto I
net.sf.hibernate.cfg.SettingsFactory Use outer join fetching: true
[9/16/04 17:33:37:424 EDT] 5645c6b7 UserSuppliedC W
net.sf.hibernate.connection.UserSuppliedConnectionProvider No
connection properties specified - the user must supply JDBC
connections
[9/16/04 17:33:37:424 EDT] 5645c6b7 TransactionMa I
net.sf.hibernate.transaction.TransactionManagerLookupFactory No
TransactionManagerLookup configured (in JTA environment, use of
process level read-write cache is not recommended)
[9/16/04 17:33:37:424 EDT] 5645c6b7 SettingsFacto I
net.sf.hibernate.cfg.SettingsFactory Use scrollable result sets:
false
[9/16/04 17:33:37:424 EDT] 5645c6b7 SettingsFacto I
net.sf.hibernate.cfg.SettingsFactory Use JDBC3 getGeneratedKeys():
false
[9/16/04 17:33:37:440 EDT] 5645c6b7 SettingsFacto I
net.sf.hibernate.cfg.SettingsFactory Optimize cache for minimal puts:
false
[9/16/04 17:33:37:440 EDT] 5645c6b7 SettingsFacto I
net.sf.hibernate.cfg.SettingsFactory Query language substitutions: {}
[9/16/04 17:33:37:440 EDT] 5645c6b7 SettingsFacto I
net.sf.hibernate.cfg.SettingsFactory cache provider:
net.sf.hibernate.cache.EhCacheProvider
[9/16/04 17:33:37:440 EDT] 5645c6b7 Configuration I
net.sf.hibernate.cfg.Configuration instantiating and configuring
caches
[9/16/04 17:33:37:580 EDT] 5645c6b7 SessionFactor I
net.sf.hibernate.impl.SessionFactoryImpl building session factory
[9/16/04 17:33:37:737 EDT] 5645c6b7 ReflectHelper I
net.sf.hibernate.util.ReflectHelper reflection optimizer disabled
for: sandbox.hibernate.Message, IllegalArgumentException: Cannot find
matching method/constructor
[9/16/04 17:33:38:080 EDT] 5645c6b7 SessionFactor I
net.sf.hibernate.impl.SessionFactoryObjectFactory Not binding factory
to JNDI, no JNDI name configured



My Hibernate Config
-------------------

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>

<session-factory>

<property name="connection.datasource">jdbc/mvsdb2</property>
<property name="show_sql">false</property>
<property name="dialect">net.sf.hibernate.dialect.DB2Dialect</property>

<!-- Mapping files -->
<mapping resource="Message.hbm.xml"/>

</session-factory>

</hibernate-configuration>



WS Datasource
-------------
Name: mvsdb2
JNDI: jdbc/mvsdb2



My Class
--------

package sandbox.hibernate;

public class Message {

private Long id;
private String text;
private Message nextMessage;
private Message() {}
public Message(String text) {
this.text = text;
}
public Long getId() {
return id;
}
private void setId(Long id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}

public Message getNextMessage() {
return nextMessage;
}
public void setNextMessage(Message nextMessage) {
this.nextMessage = nextMessage;
}
}



My Mapping Config
-----------------

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

<hibernate-mapping>
<class
name="sandbox.hibernate.Message"
table="db2admin.MESSAGES">
<id
name="id"
column="MESSAGE_ID">
<generator class="increment" />
</id>
<property
name="text"
column="MESSAGE_TEXT" />
<many-to-one
name="nextMessage"
cascade="all"
column="NEXT_MESSAGE_ID" />
</class>
</hibernate-mapping>



My Test JSP
-----------
<%@page import="sandbox.hibernate.TestHibernate"%>
<%

TestHibernate test = new TestHibernate();
test.testHibernate("Hello World");

%>



My Hibernate Driver Class
-------------------------
package sandbox.hibernate;

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

public class TestHibernate {

public String testHibernate(String textMessage) {

try {

Session session = getSessionFactory().openSession();
Transaction tx = session.beginTransaction();
Message message = new Message(textMessage);
session.save(message);
tx.commit();
session.close();

} catch (Exception e) {

}

return "";
}

public SessionFactory getSessionFactory() {
try {
return new Configuration().addClass(sandbox.hibernate.Message.class).setProperties(System.getProperties()).buildSessionFactory();
} catch (MappingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (HibernateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top