Spring Roo JPA MS SQL Server无法打开JPA EntityManager org.hibernate.exception.GenericJDBCException:无法打开连接

时间:2015-10-28 02:21:54

标签: java sql-server spring hibernate jpa

我正在尝试使用Spring Roo获取代码。 我正在按照教程: 弹簧袋鼠-1.3.1.RC1 /文档/ HTML / beginning.html 包含在Roo docs中。 MS SQL Server TCP IP已启用。 该实例正在运行 我尝试使用IP与MS SQL Management studio 127.0.0.1 \ sqlserverinstance working

进行登录

enter image description here database.properties包含:

#Updated at Tue Oct 27 15:43:39 ICT 2015
#Tue Oct 27 15:43:39 ICT 2015 PFS-015-PC\SQL2012
database.driverClassName=net.sourceforge.jtds.jdbc.Driver
database.url=jdbc\:jtds\:sqlserver\://PFS-015-PC\SQL2012\:1433/restful
database.username=sa
database.password=sql2012

我尝试右键单击项目并运行

RUN

这场噩梦发生了

    cd C:\Users\mtoha\restful; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.8.0_60" cmd /c "\"\"C:\\Program Files\\NetBeans 8.0.2\\java\\maven\\bin\\mvn.bat\" -Dmaven.ext.class.path=\"C:\\Program Files\\NetBeans 8.0.2\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 clean install\""
Scanning for projects...

------------------------------------------------------------------------
Building restful 0.1.0.BUILD-SNAPSHOT
------------------------------------------------------------------------

--- maven-clean-plugin:2.4.1:clean (default-clean) @ restful ---
Deleting C:\Users\mtoha\restful\target

--- aspectj-maven-plugin:1.4:compile (default) @ restful ---
advice defined in org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl has not been applied [Xlint:adviceDidNotMatch]
advice defined in org.springframework.mock.staticmock.AbstractMethodMockingControl has not been applied [Xlint:adviceDidNotMatch]
advice defined in org.springframework.scheduling.aspectj.AbstractAsyncExecutionAspect has not been applied [Xlint:adviceDidNotMatch]

--- aspectj-maven-plugin:1.4:test-compile (default) @ restful ---
this affected type is not exposed to the weaver: com.pfs.restful.domain.Faktur [Xlint:typeNotExposedToWeaver]
this affected type is not exposed to the weaver: com.pfs.restful.domain.FakturItem [Xlint:typeNotExposedToWeaver]
this affected type is not exposed to the weaver: com.pfs.restful.domain.Merchandise [Xlint:typeNotExposedToWeaver]
this affected type is not exposed to the weaver: com.pfs.restful.domain.PfsUser [Xlint:typeNotExposedToWeaver]
advice defined in org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect has not been applied [Xlint:adviceDidNotMatch]
advice defined in org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl has not been applied [Xlint:adviceDidNotMatch]
advice defined in org.springframework.mock.staticmock.AbstractMethodMockingControl has not been applied [Xlint:adviceDidNotMatch]
advice defined in org.springframework.mock.staticmock.AbstractMethodMockingControl has not been applied [Xlint:adviceDidNotMatch]
advice defined in org.springframework.scheduling.aspectj.AbstractAsyncExecutionAspect has not been applied [Xlint:adviceDidNotMatch]

--- maven-resources-plugin:2.6:resources (default-resources) @ restful ---
Using 'UTF-8' encoding to copy filtered resources.
Copying 4 resources

--- maven-compiler-plugin:2.5.1:compile (default-compile) @ restful ---
Nothing to compile - all classes are up to date

--- maven-resources-plugin:2.6:testResources (default-testResources) @ restful ---
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory C:\Users\mtoha\restful\src\test\resources

--- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ restful ---
Nothing to compile - all classes are up to date

--- maven-surefire-plugin:2.12:test (default-test) @ restful ---
Surefire report directory: C:\Users\mtoha\restful\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests in error: 
  testFindAllFakturs(com.pfs.restful.domain.FakturIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testFlush(com.pfs.restful.domain.FakturIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testPersist(com.pfs.restful.domain.FakturIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testMarkerMethod(com.pfs.restful.domain.FakturIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testFindFaktur(com.pfs.restful.domain.FakturIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testMergeUpdate(com.pfs.restful.domain.FakturIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testFindFakturEntries(com.pfs.restful.domain.FakturIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testCountFakturs(com.pfs.restful.domain.FakturIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testRemove(com.pfs.restful.domain.FakturIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testFindAllFakturItems(com.pfs.restful.domain.FakturItemIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testFlush(com.pfs.restful.domain.FakturItemIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testPersist(com.pfs.restful.domain.FakturItemIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testMarkerMethod(com.pfs.restful.domain.FakturItemIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testMergeUpdate(com.pfs.restful.domain.FakturItemIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testFindFakturItemEntries(com.pfs.restful.domain.FakturItemIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testFindFakturItem(com.pfs.restful.domain.FakturItemIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testRemove(com.pfs.restful.domain.FakturItemIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testCountFakturItems(com.pfs.restful.domain.FakturItemIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testFlush(com.pfs.restful.domain.MerchandiseIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testPersist(com.pfs.restful.domain.MerchandiseIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testMarkerMethod(com.pfs.restful.domain.MerchandiseIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testCountMerchandises(com.pfs.restful.domain.MerchandiseIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testFindAllMerchandises(com.pfs.restful.domain.MerchandiseIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testMergeUpdate(com.pfs.restful.domain.MerchandiseIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testFindMerchandiseEntries(com.pfs.restful.domain.MerchandiseIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testRemove(com.pfs.restful.domain.MerchandiseIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testFindMerchandise(com.pfs.restful.domain.MerchandiseIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testCountPfsUsers(com.pfs.restful.domain.PfsUserIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testFindAllPfsUsers(com.pfs.restful.domain.PfsUserIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testFlush(com.pfs.restful.domain.PfsUserIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testPersist(com.pfs.restful.domain.PfsUserIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testMarkerMethod(com.pfs.restful.domain.PfsUserIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testFindPfsUser(com.pfs.restful.domain.PfsUserIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testMergeUpdate(com.pfs.restful.domain.PfsUserIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testFindPfsUserEntries(com.pfs.restful.domain.PfsUserIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
  testRemove(com.pfs.restful.domain.PfsUserIntegrationTest): Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection

Tests run: 36, Failures: 0, Errors: 36, Skipped: 0

------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 8.153s
Finished at: Wed Oct 28 08:58:43 ICT 2015
Final Memory: 14M/278M
------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project restful: There are test failures.

Please refer to C:\Users\mtoha\restful\target\surefire-reports for the individual test results.
-> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

TCP IP Enabled the code at github

我错过了什么?

1 个答案:

答案 0 :(得分:0)

...最后

我关注this suggestion

database.properties:

database.url=jdbc\:jtds\:sqlserver\://PFS-015-PC\:1433/restful;instance=SQL2012

url末尾的实例