thanks Richard,
yes it was poor formatting of the file. But, now I get error regarding datasource:
Code:
[java] Initial SessionFactory creation failed.org.hibernate.HibernateException: Could not find datasource
[java] Exception in thread "main" java.lang.ExceptionInInitializerError
[java] at HibernateUtil.<clinit>(Unknown Source)
[java] at SKUManager.createAndStoreEvent(Unknown Source)
[java] at SKUManager.main(Unknown Source)
[java] Caused by: org.hibernate.HibernateException: Could not find datasource
[java] at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
[java] at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
[java] at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
[java] at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:362)
[java] at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)
[java] at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1502)
[java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1031)
[java] ... 3 more
[java] Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resour
ce file: java.naming.factory.initial
[java] at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
[java] at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
[java] at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
[java] at javax.naming.InitialContext.lookup(InitialContext.java:347)
[java] at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
[java] ... 9 more
[java] Java Result: 1
and here is my cfg.xml file:
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<!-- a SessionFactory instance listed as /jndi/name -->
<session-factory
name="java:hibernate/SessionFactory">
<!-- properties -->
<property name="connection.datasource">java:/mydb</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">false</property>
<property name="transaction.factory_class">
org.hibernate.transaction.JTATransactionFactory
</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>
<!-- mapping files -->
<mapping resource="SKU.hbm.xml"/>
<!-- cache settings -->
</session-factory>
</hibernate-configuration>
I know connection to database works because I tested it straight to JDBC from my own class, so what could be the issue?
thanks again,
webtekie