When i run my spring junit test i got this error message :
Caused by:
java.lang.NoSuchMethodError: org/slf4j/impl/StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;
....
java.lang.ClassFormatError: JVMCFRE074 no Code attribute specified; class=javax/persistence/PersistenceException, method=<init>()V, pc=0
Could you help me to find a reason for that error message ? Seems i have some problems with dependencies of slf4j - but i have them in the project.
Test class :
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"/businessApplicationContextTest.xml"})
@TransactionConfiguration(transactionManager="transactionManager", defaultRollback=true)
@Transactional
public class LogicHandlerTest {
@SessionFactory
SessionFactory sessionFactory;
@Before
public void setup() {System.out.println("@Before");}
@Test
public void testDummy() {
System.out.println("testDummy");
assert(true);
}
}
Spring test context configuration :
<!-- DATASOURCE -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
<property name="url" value="jdbc:hsqldb:mem:test"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</bean>
<!-- SESSION FACTORY -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="com.test.dummyproject.entity"/>
<property name="hibernateProperties">
<props>
<prop key="hibernate.jdbc.batch_size">100</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.connection.autocommit">true</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
</props>
</property>
</bean>
<!-- TRANSACTION MANAGER -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
DEPENDENCIES (versions from POM.XML) :
hibernate 3.2.3.ga
hibernate-annotations 3.3.1.GA
hibernate-commons-annotations 3.2.0.Final
javaee-api 6.0
slf4j-api 1.6.4
slf4j-log4j12 1.6.4
Reason for that error message was mess in maven dependencies - i ve removed javaee 6 dependency from my project and everything works fine now. (Because websphere server already contain javaee 6 library).