Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javax.naming.NoInitialContextException

Status
Not open for further replies.

klwong

Programmer
Dec 7, 2001
14
0
0
HK
I am new to Hibernate and I am using Hibernate 3.0, Eclipse 3.1 and Sybase as database.

I've created a test program to try to insert a value into a table... However, it prompts the following error ...

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(NamingManager.java:640)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
at javax.naming.InitialContext.getNameParser(InitialContext.java:429)
at org.hibernate.util.NamingHelper.bind(NamingHelper.java:52)
at org.hibernate.impl.SessionFactoryObjectFactory.addInstance(SessionFactoryObjectFactory.java:90)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:306)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1218)
at CMPP.hibernate.util.HibernateUtil.<clinit>(HibernateUtil.java:13)
at CMPP.hibernate.test.FirstExample.createAndStore(FirstExample.java:23)
at CMPP.hibernate.test.FirstExample.main(FirstExample.java:17)
2006-11-15 16:34:16,786 INFO [main] hbm2ddl.SchemaUpdate (SchemaUpdate.java:115) - Running hbm2ddl schema update
2006-11-15 16:34:16,786 INFO [main] hbm2ddl.SchemaUpdate (SchemaUpdate.java:126) - fetching database metadata
2006-11-15 16:34:16,801 INFO [main] hbm2ddl.SchemaUpdate (SchemaUpdate.java:138) - updating schema
2006-11-15 16:34:17,395 INFO [main] hbm2ddl.TableMetadata (TableMetadata.java:40) - table found: icms.dbo.eric1
2006-11-15 16:34:17,395 INFO [main] hbm2ddl.TableMetadata (TableMetadata.java:41) - columns: [bal, acct_num]
2006-11-15 16:34:17,395 INFO [main] hbm2ddl.TableMetadata (TableMetadata.java:43) - foreign keys: []
2006-11-15 16:34:17,395 INFO [main] hbm2ddl.TableMetadata (TableMetadata.java:44) - indexes: []
2006-11-15 16:34:17,395 INFO [main] hbm2ddl.SchemaUpdate (SchemaUpdate.java:160) - schema update complete
Hibernate: insert into eric1 (bal, acct_num) values (?, ?)
2006-11-15 16:34:17,629 INFO [main] impl.SessionFactoryImpl (SessionFactoryImpl.java:767) - closing
2006-11-15 16:34:17,629 INFO [main] connection.DriverManagerConnectionProvider (DriverManagerConnectionProvider.java:147) - cleaning up connection pool: jdbc:sybase:Tds:janus.i-cable.com:4100/icms
2006-11-15 16:34:17,629 INFO [main] impl.SessionFactoryObjectFactory (SessionFactoryObjectFactory.java:112) - Unbinding factory from JNDI name: foo
2006-11-15 16:34:17,629 INFO [main] util.NamingHelper (NamingHelper.java:26) - JNDI InitialContext properties:{}
2006-11-15 16:34:17,629 WARN [main] impl.SessionFactoryObjectFactory (SessionFactoryObjectFactory.java:123) - Could not unbind factory from JNDI


Anyone can help me? Thanks a lot.
 
It's a good practice to post yout solutions so other people can use them.

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top