I have recently installed the latest version of Hibernate tools in Eclipse 3.2 and am having a couple of probs.
I have followed the tutorial at
http://www.hibernate.org/hib_docs/tools ... ugins.html and things are mostly working.
However, when I open my Hibernate Console there are 3 nodes, Configuration, Session Factory and Database
- Database opens fine and shows the schema node and then all the tables in my MYSQL 5.0 db
- when I open the configuration node it has no child nodes
- when I try to open the session factory node i see the text 'pending' appear for half a second and then it disappears. The Eclipse error log shows the warning
"WARN Worker-3 org.hibernate.impl.SessionFactoryObjectFactory - Could not bind factory to JNDI" and the first few lines of the stacktrace are
Code:
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getNameParser(Unknown Source)
Its kind of weird because the code generation tools seem to be working fin in that they are able to connect to the db and generate my domain classes and hbm.xml files OK.
Unfortunately it seems the error I am getting is stopping me from using the Hibernate Entity Model (which is always blank), Hibernate Dynamic SQL Preview or any of the other handy looking plugin tools.
Anyone else had this problem? Anyone know how to solve it?
My hibernate.cfg.xml is below. I have tried to remove and/or specify the hibernate.default_catalog and hibernate.default_schema properties below but it doesnt seem to make a difference.
Thanks.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="cricket-session">
<property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="hibernate.connection.password">cricket</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/cricket</property>
<property name="hibernate.connection.username">cricket</property>
<property name="hibernate.default_catalog">cricket</property>
<property name="hibernate.default_schema">cricket</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
</session-factory>
</hibernate-configuration>
[/code]