facebook

Error using HQL Editor on web application datasource

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #262824 Reply

    Hi, I have a web application with Spring and Hibernate capabilities. I defined the sessionFactory datasource as such in my Spring application context file:

        <bean id="expDatasource"
            class="org.springframework.jndi.JndiObjectFactoryBean">
            <property name="jndiName">
                <value>java:comp/env/jdbc/finance</value>
            </property>
        </bean>
    

    When I click the refresh icon (arrows going in circle) on the HQL Editor I get the following error:

      LocalSessionFactoryBean could not be created.

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’ defined in URL [file:C:/Documents and Settings/mario/workspaces/finance/exp/src/applicationContext.xml]: Cannot resolve reference to bean ‘expDatasource’ while setting bean property ‘dataSource’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘expDatasource’ defined in URL [file:C:/Documents and Settings/mario/workspaces/finance/exp/src/applicationContext.xml]: Initialization of bean failed; nested exception is 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

    Normally when the web application is running the web application server (Tomcat 5.5) provides the jndi resolution but I don’t know how to configure it so it works in the IDE HQL Editor

    I am using MyEclipse 5.1 with MS SQL 2000 JDBC

    #262910 Reply

    Haris Peco
    Member

    MFJASSOCIATES,

    Tomcat’s jndi context can’t be accessed out of container.You have to use other application server (for example JBoss) or make different datastore for hql testing (out of tomcat) and testing in tomcat JVM.

    Regards,

    #262922 Reply

    Peco, why can’t I load the correct jar file or use an eclipse or myeclipse plugin to do that?

    #262924 Reply

    Haris Peco
    Member

    It is not related with Eclipse or MyEclipse.You can’t use Tomcat’s JNIDI with some client out of container.You can set different data sources for hql editor and ‘out of container’ testing (simple jdbc data source) and JDNI for Tomcat.The problem is not library loading, than client can’t access to JNDI on tomcat

    Regards,

    #262925 Reply

    Peco,

    Let me rephrase my question. Tomcat is a JNDI provider when accessing the JNDI API from within Tomcat. I understand that if I an not running inside the Tomcat container I cannot access the Tomcat JNDI provider implemented by Tomcat.

    What I am asking is why can’t I use a MyEclipse or Eclipse JNDI provider to acccess this datasource. It will not be the Tomcat provider that would be running but it would be a JNDI provider none the less and that would allow us to test using HQL. You have to remember that HQL editor will use the Spring application context defined datasource and since this datasource is a JNDI provider, nothing prevents it from using a different provider. My question is: are there Eclipse or MyEclipse JNDI providers?

    #262926 Reply

    Haris Peco
    Member

    My question is: are there Eclipse or MyEclipse JNDI providers?

    There isn’t JNDI provider in MyEclipse and standard Eclipse.I am not sure if exists some external plugin.

    Regards,

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Error using HQL Editor on web application datasource

You must be logged in to post in the forum log in