Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {"error":"unauthorized","error_description":"Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Could not open connection"}curl: (6) Could not resolve host: application
- <?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:context="http://www.springframework.org/schema/context"
- xmlns:util="http://www.springframework.org/schema/util" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
- http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd">
- <!-- @author Nagesh.Chauhan(neel4soft@gmail.com) -->
- <context:annotation-config />
- <context:component-scan base-package="com.example.myproject" >
- <context:exclude-filter type="assignable" expression="com.example.myproject.controller.MyController"/>
- </context:component-scan>
- <mvc:annotation-driven>
- <mvc:message-converters register-defaults="false">
- <bean class="org.springframework.http.converter.StringHttpMessageConverter" />
- <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" />
- </mvc:message-converters>
- </mvc:annotation-driven>
- <!-- in above <bean class="org.springframework.http.converter.FormHttpMessageConverter" />
- <bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter" /> -->
- <bean id="multipartResolver"
- class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
- <!-- one of the properties available; the maximum file size in bytes -->
- <property name="maxUploadSize" value="1000000000" />
- </bean>
- <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
- <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
- <property name="url" value="jdbc:mysql://localhost:3306/SampleDb"/>
- <property name="username" value="root"/>
- <property name="password" value="mypassword"/>
- <property name="validationQuery" value="SELECT 1"/>
- </bean>
- <!-- Hibernate Session Factory -->
- <bean id="mySessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
- <property name="dataSource" ref="myDataSource"/>
- <property name="packagesToScan">
- <array>
- <value>com.example.myproject</value>
- </array>
- </property>
- <property name="hibernateProperties">
- <value>
- hibernate.dialect=org.hibernate.dialect.MySQLDialect
- </value>
- </property>
- </bean>
- <!-- Hibernate Transaction Manager -->
- <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
- <property name="sessionFactory" ref="mySessionFactory"/>
- </bean>
- <!-- Activates annotation based transaction management -->
- <tx:annotation-driven transaction-manager="transactionManager"/>
- </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement