繁体   English   中英

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

[英]Spring Roo JPA MS SQL Server Could not open JPA EntityManager org.hibernate.exception.GenericJDBCException: Could not open connection

我正在尝试使用Spring Roo获取代码。 我正在关注以下教程:Roo文档中包含spring-roo-1.3.1.RC1 / docs / html / beginning.html。 MS SQL Server TCP IP已启用。 实例正在运行,我尝试使用IP与MS SQL Management Studio 127.0.0.1 \\ sqlserverinstance一起工作进行登录

在此处输入图片说明 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

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

跑

这场噩梦发生了

    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 github上的代码

我错过了什么?

最后...

我遵循这个建议

database.properties:

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

网址末尾的实例

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM