내가 사람을 배치하여 EJB 3, 두 번째 버전을 읽는 중간에있어 및최대 절전 모드
시험 인 IntelliJ에서 소스에 대한 테스트를 실행 힘든 시간을 보내고 있어요와 Arquillian IN_CONTAINER 모드 테스트를 실행하는 방법입니다 : 전체 소스는 here 찾을 수 있습니다
@RunWith(Arquillian.class)
@Run(RunModeType.IN_CONTAINER)
....
.....
@Deployment
public static Archive<?> createDeployment() {
return ShrinkWrap.create(JavaArchive.class, "foo.jar").addClasses(OrderProcessor.class,
OrderProcessorBean.class,
ItemService.class,
ItemServiceBean.class, Bid.class, Bidder.class, Item.class).addManifestResource("test-persistence.xml", ArchivePaths.create("persistence.xml"));
}
의 persistence.xml은 다음과 같습니다
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="users" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/chapter2</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect" />
</properties>
</persistence-unit>
</persistence>
,451,515,는
오류 테스트를 실행하는 동안 :
domain.xml의이 here 위치한
WARNING: Could not obtain connection to query metadata
java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused.
at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:112)
at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:71)
UPDATE :이 데이터베이스 연결을 설정할 수 없습니다 것 같다 오류에서
. 그러나 왜 메모리 더비 데이터베이스에 연결할 수 있는지 확실하지 않습니다. domain.xml에는 create=true
속성이 있으므로 db를 간단히 만들어야합니다.
감사합니다. 그러면 문제가 해결됩니다. 나는'domain.xml'을 보지 못했습니다. 그러나 네임 스페이스를 추가하는 것과 같은 에러가 나옵니다. – Omnipresent