Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2014
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. Server Error Caused by:
  2.  
  3. package connectors;
  4.  
  5. import org.hibernate.Session;
  6. import org.hibernate.SessionFactory;
  7. import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
  8. import org.hibernate.cfg.Configuration;
  9. import org.hibernate.service.ServiceRegistry;
  10.  
  11. public class Connector {
  12.  
  13. private static SessionFactory sessionFactory;
  14.  
  15. private static SessionFactory buildSessionFactory() {
  16. try {
  17. // Create the SessionFactory from hibernate.cfg.xml
  18. Configuration configuration = new Configuration();
  19. configuration.configure("hibernate.cfg.xml");
  20. System.out.println("Hibernate Configuration loaded");
  21.  
  22. //apply configuration property settings to StandardServiceRegistryBuilder
  23. StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());
  24. System.out.println("Hibernate serviceRegistry created");
  25.  
  26. SessionFactory sessionFactory = configuration.buildSessionFactory(ssrb.build());
  27.  
  28.  
  29. return sessionFactory;
  30. }
  31. catch (Throwable ex) {
  32. // Make sure you log the exception, as it might be swallowed
  33. System.err.println("Initial SessionFactory creation failed." + ex);
  34. throw new ExceptionInInitializerError(ex);
  35. }
  36. }
  37.  
  38. public static SessionFactory getSessionFactory() {
  39. if(sessionFactory == null) sessionFactory = buildSessionFactory();
  40. return sessionFactory;
  41. }
  42.  
  43.  
  44.  
  45.  
  46. public static Session getSession(){
  47. return getSessionFactory().openSession();
  48. }
  49. }
  50.  
  51. <artifactId>resqueue-mainproj</artifactId> <dependencies>
  52. <!-- our projects -->
  53.  
  54.  
  55. <dependency>
  56. <groupId>serverside</groupId>
  57. <artifactId>resqueue-dal</artifactId>
  58. <version>1.0</version>
  59. </dependency>
  60.  
  61. <dependency>
  62. <groupId>serverside</groupId>
  63. <artifactId>resqueue-srdlib</artifactId>
  64. <version>1.0</version>
  65. </dependency>
  66. <!-- Jetty -->
  67. <dependency>
  68. <groupId>org.eclipse.jetty</groupId>
  69. <artifactId>jetty-servlet</artifactId>
  70. <version>7.6.0.v20120127</version>
  71. </dependency>
  72. <dependency>
  73. <groupId>org.eclipse.jetty</groupId>
  74. <artifactId>jetty-webapp</artifactId>
  75. <version>7.6.0.v20120127</version>
  76. </dependency>
  77.  
  78. <!-- Nimbus -->
  79. <dependency>
  80. <groupId>com.nimbusds</groupId>
  81. <artifactId>nimbus-jose-jwt</artifactId>
  82. <version>2.9</version>
  83. </dependency>
  84.  
  85. <!-- Jersey -->
  86. <dependency>
  87. <groupId>com.sun.jersey</groupId>
  88. <artifactId>jersey-server</artifactId>
  89. <version>1.8</version>
  90. </dependency>
  91. <dependency>
  92. <groupId>com.sun.jersey</groupId>
  93. <artifactId>jersey-json</artifactId>
  94. <version>1.8</version>
  95. </dependency>
  96.  
  97. <!-- jUnit -->
  98. <dependency>
  99. <groupId>junit</groupId>
  100. <artifactId>junit</artifactId>
  101. <version>4.10</version>
  102. <scope>test</scope>
  103. </dependency>
  104. <!--org.apache.http -->
  105.  
  106. <dependency>
  107. <groupId>org.apache.httpcomponents</groupId>
  108. <artifactId>httpclient</artifactId>
  109. <version>4.3.2</version>
  110. </dependency>
  111.  
  112. <!-- JSON LIB -> added for testing only -->
  113. <dependency>
  114. <groupId>com.google.code.gson</groupId>
  115. <artifactId>gson</artifactId>
  116. <version>2.2.4</version>
  117. </dependency>
  118.  
  119. <!-- Hibernate -->
  120.  
  121. <dependency>
  122. <groupId>mysql</groupId>
  123. <artifactId>mysql-connector-java</artifactId>
  124. <version>5.1.30</version>
  125. </dependency>
  126. <dependency>
  127. <groupId>org.hibernate</groupId>
  128. <artifactId>hibernate-core</artifactId>
  129. <version>4.3.6.Final</version>
  130. </dependency>
  131.  
  132. <!-- for JPA, use hibernate-entitymanager instead of hibernate-core -->
  133. <dependency>
  134. <groupId>org.hibernate</groupId>
  135. <artifactId>hibernate-entitymanager</artifactId>
  136. <version>4.3.6.Final</version>
  137. </dependency>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement