-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: could not obtain connection to query metadata : no suitable
PostPosted: Wed Jul 01, 2015 4:56 pm 
Newbie

Joined: Wed Jun 24, 2015 7:00 pm
Posts: 2
I wonder if anyone can explain to me why a Spring and Hibernate webapp works perfectly well in one environment but fails to compile in another? I'm using NetBeans 8.0.X with Tomcat 8.0.3.0 and Apache Derby 10.X.

My application's `dispatcherservlet` is as follows:

Code:
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:tx="http://www.springframework.org/schema/tx"       
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
                           http://www.springframework.org/schema/context
                           http://www.springframework.org/schema/context/spring-context-4.0.xsd
                           http://www.springframework.org/schema/mvc                           
                           http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd                           
                           http://www.springframework.org/schema/tx   
                           http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
   
    <!-- Uses annotations in classes for JavaBeans. XML is an alternative. -->
    <mvc:annotation-driven />   
   
    <!-- Base package. -->
    <context:component-scan base-package="library" />   
   
    <!-- Model. -->
    <bean id="person" class="library.model.Person" />
    <bean id="book" class="library.model.Book" />       
       
    <!-- Spring Controllers. -->
    <bean id="adminController" class="library.controller.admin.AdminController" />   
    <bean id="personController" class="library.controller.PersonController" />     
    <bean id="bookController" class="library.controller.BookController" />
    <bean id="exceptionController" class="library.controller.ExceptionController" />     
   
    <!-- Spring Interceptors. -->
    <mvc:interceptors>
        <bean id="clientInterceptor" class="library.interceptor.ClientInterceptor" />
    </mvc:interceptors>
         
    <!-- Spring Services. -->
    <bean id="personServiceImpl" class="library.service.PersonServiceImpl" />   
    <bean id="bookServiceImpl" class="library.service.BookServiceImpl" />     
                   
    <!-- Spring Repositories. -->
    <bean id="personDAOImpl" class="library.dao.PersonDAOImpl" />   
    <bean id="bookDAOImpl" class="library.dao.BookDAOImpl" />       
   
    <!-- Spring Validators. -->
    <bean id="personValidator" class="library.validator.PersonValidator" />   
    <bean id="bookValidator" class="library.validator.BookValidator" />     
         
    <!-- Spring ViewResolver. -->               
    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix">
             <value>/WEB-INF/jsp/</value>
        </property>
        <property name="suffix">
            <value>.jsp</value>
        </property>
    </bean>   
   
    <!-- Spring MesssageSource. -->         
    <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
        <property name="basename">
            <value>/WEB-INF/classes/messages</value>   
        </property>   
    </bean>
   
    <!-- Spring Properties file for Library. -->     
    <bean id="propertiesFactory" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="location"> 
             <value>classpath:library.properties</value>             
        </property>
    </bean>     
     
    <!-- Hibernate DataSource. -->
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">   
        <property name="driverClassName" value="org.apache.derby.jdbc.ClientDriver" />       
        <!--property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver" /-->
        <property name="url" value="jdbc:derby://localhost:1527/Library" />
        <property name="username" value="username" />
        <property name="password" value="password" />           
    </bean>   
   
    <!-- Hibernate Interceptors. -->
    <bean id="serverInterceptor" class="library.interceptor.ServerInterceptor" />
                       
    <!-- Hibernate SessionFactory. -->   
    <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">   
        <property name="dataSource" ref="dataSource"></property>                 
        <property name="hibernateProperties">
            <props>   
               <prop key="hibernate.dialect">org.hibernate.dialect.DerbyDialect</prop>                     
               <!--prop key="hibernate.dialect">org.hibernate.dialect.DerbyTenSixDialect</prop-->
               <prop key="hibernate.show_sql">false</prop>               
               
               <!-- What to do with the database schema. -->
               <prop key="hbm2ddl.auto">validate</prop>   
               <!-- validate:    validate the schema, makes no changes to the database.
                    update:      update the schema.
                    create:      creates the schema, destroying previous data.
                    create-drop: drop the schema at the end of the session. -->                 
            </props>           
        </property>                                                                                                                               
        <property name="entityInterceptor">
            <ref bean="serverInterceptor" />           
        </property>                                                                                                                                             
        <property name="packagesToScan">
            <list>
                <value>library.model</value>               
            </list>
        </property>         
    </bean>
   
    <!-- Hibernate TransactionManagment. -->
    <tx:annotation-driven />               
    <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
       <property name="sessionFactory" ref="sessionFactory" />
    </bean> 
                                                                                                                                           
</beans>


And the error given when the application fails to build in the one environment is:

Code:
WARN|01 07 2015|16 26 31|http-nio-8080-exec-73|org.hibernate.engine.jdbc.internal.JdbcServicesImpl| - HHH000342: Could not obtain connection to query metadata : No suitable driver found for jdbc:derby://localhost:1527/Library
    INFO|01 07 2015|16 26 31|http-nio-8080-exec-73|org.hibernate.dialect.Dialect| - HHH000400: Using dialect: org.hibernate.dialect.DerbyTenSixDialect
    INFO|01 07 2015|16 26 34|http-nio-8080-exec-73|org.hibernate.engine.jdbc.internal.LobCreatorBuilder| - HHH000422: Disabling contextual LOB creation as connection was null
    ERROR|01 07 2015|16 26 41|http-nio-8080-exec-73|org.springframework.web.context.ContextLoader| - Context initialization failed


Which is then causing the wiring of the dependencies to fail.

What do these messages mean?

The application is using Spring 4.0.2 and hibernate-core-4.3.10.jar. All dependencies are identical between where the application works and where it doesn't.

The error occurs regardless of which Derby driver I try.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.