I have the same problem, in a sister project to cameroon. 

I have noticed that in the ConfigurableDbUnitTestCase super.tearDown() is
not always called, because of this line: 

protected void tearDown() throws Exception {
                if (!context.containsBean(LOCAL_DATASOURCE)){
                        super.tearDown();
                }
        }

Not sure if that is from Sculptor or if we added it (we do use a
localDataSource for unit tests). However, changing that to always call
super.tearDown() did not make a difference, so I think closing the
ApplicationContext is not the problem. 

Still, that tearDown() method above seems wrong to me. If the goal is to not
drop the tables in the database, shouldn't it rather be handled in the
method

 DatabaseOperation getTearDownOperation()

so that the AppContext would still be closed?

Björn


Patrik Nordwall wrote:
> 
> In Sculptor we close the ClassPathXmlApplicationContext in tearDown and I
> think that works fine. Have a look in your test classes if that is done.
> 
> You might need to cast the context:
> ((ConfigurableApplicationContext) context).close();
> 
> /Patrik
> 
> 
> cameroon wrote:
>> 
>> Hi all fornax gurus,
>> 
>> I'm using in our project fornax with hibenrate, spring-framework and now
>> we have an issue during testing. If I try to run more than unit tests, I
>> got every time I OutOfMemoryError. My solution was to increase the Java
>> heap size like this -Xms256m -Xmx1024m, but this alternative hadn't
>> solved the problem (the same problem also came, when I try to run tests
>> with maven command mvn clean test). May be someone knows this issue and
>> can give me some tips and tricks or some advices, how I can fix that
>> problem.
>> It seems like as if each test reloads the ApplicationContext and tries to
>> recreate an instance of the SessionFactory and I know that Hibernate
>> SessionFactory can be a memory hog.
>> 
>> Thanks for advance.
>> 
>> here is the stack trace:
>> <error>
>> org.springframework.beans.factory.BeanCreationException: Error creating
>> bean with name 'txManager' defined in class path resource
>> [SessionFactory.xml]: Cannot resolve reference to bean 'sessionFactory'
>> while setting bean property 'sessionFactory'; nested exception is
>> org.springframework.beans.factory.BeanCreationException: Error creating
>> bean with name 'sessionFactory' defined in class path resource
>> [SessionFactory.xml]: Invocation of init method failed; nested exception
>> is java.lang.OutOfMemoryError: Java heap space
>> Caused by: org.springframework.beans.factory.BeanCreationException: Error
>> creating bean with name 'sessionFactory' defined in class path resource
>> [SessionFactory.xml]: Invocation of init method failed; nested exception
>> is java.lang.OutOfMemoryError: Java heap space
>> Caused by: java.lang.OutOfMemoryError: Java heap space
>>      at org.apache.xerces.impl.dtd.DTDGrammar.elementDecl(Unknown Source)
>>      at org.apache.xerces.impl.dtd.XMLDTDProcessor.elementDecl(Unknown
>> Source)
>>      at org.apache.xerces.impl.XMLDTDScannerImpl.scanElementDecl(Unknown
>> Source)
>>      at org.apache.xerces.impl.XMLDTDScannerImpl.scanDecls(Unknown Source)
>>      at
>> org.apache.xerces.impl.XMLDTDScannerImpl.scanDTDExternalSubset(Unknown
>> Source)
>>      at
>> org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown
>> Source)
>>      at
>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
>> Source)
>>      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>>      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>>      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>>      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
>>      at org.dom4j.io.SAXReader.read(SAXReader.java:465)
>>      at
>> org.hibernate.cfg.Configuration.addInputStream(Configuration.java:499)
>>      at
>> org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:656)
>>      at
>> org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:134)
>>      at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1198)
>>      at 
>> </error>
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Problem-java.lang.OutOfMemoryError-when-runs-more-than-15-unit-tests-tp17247587s17564p17529955.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Fornax-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Reply via email to