[jboss-user] [Datasource Configuration] - Data Not retrieved with JBOSS

Harbir Hundal do-not-reply at jboss.com
Mon Jun 13 10:03:31 EDT 2011


Harbir Hundal [http://community.jboss.org/people/adofo] created the discussion

"Data Not retrieved with JBOSS"

To view the discussion, visit: http://community.jboss.org/message/609901#609901

--------------------------------------------------------------
Hi guys, 
 I am new to using JBOSS (http://www.coderanch.com/forums/f-63/JBoss). 
 
 I am a very simple web application, thats is trying to extract some data from a table form the Database, using hibernate. 
 
 Now, the database connection is running fine when it is deployed with tomcar, and the data is getting retrieved from the Datatbase. 
 When the application is deployed in JBOSS 5.1, there is no data retrieved form the database. 
 
 The following is my JDBC (http://www.coderanch.com/forums/f-3/JDBC) properties file: 


jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.dialect=org.hibernate.dialect.MySQLDialect
jdbc.url=jdbc:mysql://localhost:3306/deccandatabase
jdbc.username=root
jdbc.password=root5



My spring dispatcher is: 



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
        xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
        xmlns:context="http://www.springframework.org/schema/context"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

        <!-- packages that will be scanned for annotations -->
        <context:annotation-config />
        <context:component-scan base-package="au.com.deccan" />  <!-- all packages under this will be scanned -->
        <tx:annotation-driven transaction-manager="transactionManager" />

        <!-- Defining the default annotation AnnotationHandlerMapping -->
        <bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
        
        <!-- Defining the ClassName annotation ClassNameHandlerMapping -->
        <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping">
                <property name="interceptors">
                        <list>
                                <ref bean="measurementInterceptor" />
                        </list>
                </property>
        </bean>

        <!-- Defining the AnnotationHandlerAdapter -->
        <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />

        <!-- Defining the Interceptor -->
        <bean id="measurementInterceptor" class="au.com.deccan.interceptor.MeasurementInterceptor" />

        <!-- Defining the Viewresolver -->
        <bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"
                p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" />
        
        <!-- Defining the JDBC properties -->
        <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
                p:location="/WEB-INF/jdbc.properties" />
        <!-- Defining the DataSource -->
        <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
                destroy-method="close" p:driverClassName="${jdbc.driverClassName}"
                p:url="${jdbc.url}" p:username="${jdbc.username}" p:password="${jdbc.password}" />
        
        <!-- Configuration for Hibernate -->
        <bean id="sessionFactory"
                class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
                <property name="dataSource" ref="dataSource" />
                <property name="configLocation">
                        <value>/WEB-INF/hibernate.cfg.xml</value>
                </property>
                <property name="configurationClass">
                        <value>org.hibernate.cfg.AnnotationConfiguration</value>
                </property>
                <property name="hibernateProperties">
                        <props>
                                <prop key="hibernate.dialect">${jdbc.dialect}</prop>
                                <prop key="hibernate.show_sql">true</prop>
                        </props>
                </property>
        </bean>
        
        <!-- transaction Manager -->
        <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
                <property name="sessionFactory" ref="sessionFactory" />
        </bean>
</beans>


My hibernate config is:


<?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>
    <session-factory>
        <mapping class="au.com.deccan.model.User" />
        </session-factory>
 </hibernate-configuration>



There are no erros or exceptions is the log. 
 Can, someone please let me know what may be causing this behavious. 
 
 Regrads 
 Adofo
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/609901#609901]

Start a new discussion in Datasource Configuration at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110613/1d6e0754/attachment-0001.html 


More information about the jboss-user mailing list