こんにちは私はSpringでJUnitでWebサービスをテストしようとしています。私はこのテストを書かれている:JUnit 4でSpring Webサービスをテストする際のエラー
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:META-INF/applicationContext.xml"})
@TransactionConfiguration
@Transactional
@SuppressWarnings("unused")
public class SiteTest {
@Mock
public IBusiness siteBusiness;
@Autowired
public ManageImpl managesiteI;
List<GeographicSite> sitesJson = null;
@Before
public void init() {
MockitoAnnotations.initMocks(this);
siteApplicationImpl=new ManageSiteImpl(siteApplicationBusiness);
}
@Test
public void testSizeOfSIte() throws ExceptionApiV2 {
try {
when(managesiteI.geographicSitesAPIV2(Mockito.eq((Integer)10), Mockito.eq((Integer)0), Mockito.anyString(), Mockito.anyString(),
Mockito.eq("CI00002384"),Mockito.eq("CI00002394"), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
Mockito.anyString(), Mockito.anyString(), Mockito.anyInt(), Mockito.anyInt(), Mockito.anyString(), Mockito.anyString())).thenReturn(resultat);
} catch (Exception e) {
System.out.println("ERRO MOCKITO: "+e);
}
sitesJson=managesiteI.geographicSitesAPIV2(10, 0, "site.id", null, "CI00002384" , "CI00002394", null, null, null, null, null, null, null, null, null, null);
私はこの種類のログのエラーを得た最初の 、applicationContext.xmlを は私が が必要になりますまだそれが動作していないと思ったすべての依存関係を追加追加しました:
log4j:WARN No appenders could be found for logger (com.mchange.v2.log.MLog).
log4j:WARN Please initialize the log4j system properly.
私は、静的メソッドでそれをスキップするために管理し、しかし、私はいつもこのエラーを持っている:
Destroying singletons in org.s[email protected]7a95626d: defining beans [propertyConfigurer,getActor.proxyFactory,getActor,actorBusinessImpl,manageSiteSoapProxy,manageSiteSoapProxyFactory,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,transactionInterceptor,transactionManager,transactionAttributes,autoProxyTransactionCreator,dataSource,siterefEntityManagerFactory,org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor#0,org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0]; root of factory hierarchy
Caught exception while allowing TestExecutionListener [org.springframewor[email protected]8fb4c62] to prepare test instance [[email protected]]
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157) ~[spring-test-3.1.0.RELEASE.jar:3.1.0.RELEASE]
引き起こされるような、私はこれを持っている:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in class path resource [META-INF/jpaDaoContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'siterefEntityManagerFactory' defined in class path resource [META-INF/jpaDaoContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/resource/spi/XATerminator
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) ~[spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
EDIT
私はこのエラーを持って前にtehの最後の1:私は他の質問と同じ問題を抱えているとは思いません。
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'siterefEntityManagerFactory' defined in class path resource [META-INF/jpaDaoContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/resource/spi/XATerminator
は****編集2 ***
javax.resource の依存関係を追加した後、私はこの/
Bean 'siterefEntityManagerFactory' of type [class org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Pre-instantiating singletons in org.s[email protected]72ee3d51: defining beans [propertyConfigurer,getActor.proxyFactory,getActor,.....]; root of factory hierarchy
FactoryBean threw exception from getObjectType, despite the contract saying that it should return null if the type of its object cannot be determined yet`
いずれかが任意のアイデアを持っていましたか?私は何が欠けていますか?あなたは、私が詳細に何かが私に知らせなければならないと思われる場合 は、あなたの答えをありがとうと
全く関連ない
uがこの点をクリアするために、質問を編集した:) –
が、これは、エラーや警告ですか?それはログにあるはずです。 – randominstanceOfLivingThing
あなたのapplicationContext.xmlも投稿できます。 – randominstanceOfLivingThing