Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2017
560
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. {"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
  2.  
  3. <?xml version="1.0" encoding="UTF-8"?>
  4. <beans xmlns="http://www.springframework.org/schema/beans"
  5. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
  6. xmlns:util="http://www.springframework.org/schema/util" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
  7. xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
  8. http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  9. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
  10. http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd
  11. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd">
  12. <!-- @author Nagesh.Chauhan(neel4soft@gmail.com) -->
  13. <context:annotation-config />
  14. <context:component-scan base-package="com.example.myproject" >
  15. <context:exclude-filter type="assignable" expression="com.example.myproject.controller.MyController"/>
  16. </context:component-scan>
  17. <mvc:annotation-driven>
  18. <mvc:message-converters register-defaults="false">
  19. <bean class="org.springframework.http.converter.StringHttpMessageConverter" />
  20. <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" />
  21. </mvc:message-converters>
  22. </mvc:annotation-driven>
  23. <!-- in above <bean class="org.springframework.http.converter.FormHttpMessageConverter" />
  24. <bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter" /> -->
  25.  
  26. <bean id="multipartResolver"
  27. class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
  28.  
  29. <!-- one of the properties available; the maximum file size in bytes -->
  30. <property name="maxUploadSize" value="1000000000" />
  31. </bean>
  32.  
  33. <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
  34. <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
  35. <property name="url" value="jdbc:mysql://localhost:3306/SampleDb"/>
  36. <property name="username" value="root"/>
  37. <property name="password" value="mypassword"/>
  38. <property name="validationQuery" value="SELECT 1"/>
  39. </bean>
  40.  
  41. <!-- Hibernate Session Factory -->
  42. <bean id="mySessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
  43. <property name="dataSource" ref="myDataSource"/>
  44. <property name="packagesToScan">
  45. <array>
  46. <value>com.example.myproject</value>
  47. </array>
  48. </property>
  49. <property name="hibernateProperties">
  50. <value>
  51. hibernate.dialect=org.hibernate.dialect.MySQLDialect
  52. </value>
  53. </property>
  54. </bean>
  55. <!-- Hibernate Transaction Manager -->
  56. <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
  57. <property name="sessionFactory" ref="mySessionFactory"/>
  58. </bean>
  59.  
  60. <!-- Activates annotation based transaction management -->
  61. <tx:annotation-driven transaction-manager="transactionManager"/>
  62. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement