Announcement Announcement Module
Collapse
No announcement yet.
Getting message "could not bind factory to jndi". what to do? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting message "could not bind factory to jndi". what to do?

    Hello!

    I am well into the software project. I have to say that many aspects of the software work very well with spring framework, except for just one error message the is repeated twice. As much as I read the documentation, I don't know exactly what to write into my spring xml definition file to resolve it. Instead of guessing, I would rather ask the experts.

    I am using spring framework-3.0.3 (slightly older but working) in combination with hibernate-3.6.4 orm (again slightly older but working). I don't update these software in the middle of a development cycle.

    My problem has to do jndi. I don't use it in my project, but I get error messages from it. I know what jndi is but how to use it effectively in the context of spring xml definitions. Below is my error message and followed by listing for hibernate xml definition.

    *** Error messages
    22:07:31,925 INFO SessionFactoryObjectFactory: 109 - Factory name: SQL Azure
    22:07:31,926 INFO NamingHelper: 49 - JNDI InitialContext properties:{}
    22:07:31,929 WARN SessionFactoryObjectFactory: 121 - Could not bind factory to JNDI
    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(N amingManager.java:645)
    at javax.naming.InitialContext.getDefaultInitCtx(Init ialContext.java:288)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx (InitialContext.java:325)
    at javax.naming.InitialContext.getNameParser(InitialC ontext.java:480)


    *** Hibernate xml defintions (taken directly from reference manual's example
    <bean id="Windows_SQL_Azure" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDrive r"/>
    <property name="url" value="...."/>
    <property name="username" value="...."/>
    <property name="password" value="...."/>
    <property name="connectionProperties" value="databaseName=....;"/>
    </bean>

    <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
    <!--
    <property name="dataSource" ref="WindowsSqlAzure"/>
    -->
    <property name="dataSource" ref="Windows_SQL_Azure"/>
    <property name="configLocation" value="classpath:hibernate.cfg.xml" />
    <!--
    <property name="schemaUpdate" value="true"/>
    -->
    </bean>
    <bean id="txManager" class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
    <property name="sessionFactory" ref="mySessionFactory" />
    </bean>
Working...
X