Community   SpringSource   Projects    Downloads    Documentation    Forums    Training   Exchange   Blogs

Go Back   Spring Community Forums > Core Spring Projects > Data Access

Reply
 
Thread Tools Display Modes
  #1  
Old Feb 8th, 2007, 07:20 AM
Vita Rara Vita Rara is offline
Member
 
Join Date: Aug 2006
Location: Troy, NY
Posts: 58
Default JPA Integration Testing w/ Maven: StackOverflowError

I'm trying to add integration tests to my Maven build. I'm using Maven, Spring 2.0. (I just tried moving to 2.0.2, but got an XML parse error from my applicationContext.xml file.), and Hibernate as a JPA provider.

I have tied tests to the integration-test life cycle in Maven. I have a test that attempts to instantiate an ApplicationContext, but it fails when attempting to start my entityManager with a StackOverflowException:

Code:
 Error creating bean with name 'entityManagerFactory' defined in URL [file:/Users/mark/projects/quadran/target/classes/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.StackOverflowError
Caused by: java.lang.StackOverflowError
    at java.lang.String.toLowerCase(String.java:2213)
    at java.lang.String.toLowerCase(String.java:2277)
    at org.apache.xerces.util.URI.setScheme(URI.java:908)
    at org.apache.xerces.util.URI.initializeScheme(URI.java:576)
    at org.apache.xerces.util.URI.initialize(URI.java:400)
    at org.apache.xerces.util.URI.<init>(URI.java:211)
    at org.apache.xerces.util.URI.<init>(URI.java:195)
    at org.apache.xerces.impl.XMLEntityManager.expandSystemId(XMLEntityManager.java:1140)
    at org.apache.xerces.impl.XMLEntityManager.resolveEntity(XMLEntityManager.java:581)
    at org.apache.xerces.impl.xs.XMLSchemaLoader.xsdToXMLInputSource(XMLSchemaLoader.java:625)  
    at org.apache.xerces.impl.xs.XMLSchemaLoader.processJAXPSchemaSource(XMLSchemaLoader.java:580)
    at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:489)
    at org.apache.xerces.impl.xs.XMLSchemaLoader.processJAXPSchemaSource(XMLSchemaLoader.java:588)
    at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:489)
    at org.apache.xerces.impl.xs.XMLSchemaLoader.processJAXPSchemaSource(XMLSchemaLoader.java:588)

these last two lines repeat for a long time.
It looks to me like it can't parse the persistence.xml file. I've tried adding a xerces dependency and changing it to various different versions to see if that would clear up the problem. Then tried setting xerces to scope=test. None of which worked.

Any ideas you might have would be appreciated.

Mark
__________________
Business site: http://www.vitarara.net/
Personal site: http://www.vitarara.org/
Reply With Quote
  #2  
Old Mar 7th, 2007, 07:06 PM
loraxorg loraxorg is offline
Junior Member
 
Join Date: Mar 2007
Posts: 1
Default Get a newer Xerces

This is a known bug in Xerces 2.0.2, which Maven2 includes automatically via some transitive dependency that I didn't track down. You can work around it by explicitly requiring a newer version, e.g.:

Code:
<dependency>
	<groupId>xerces</groupId>
	<artifactId>xercesImpl</artifactId>
	<version>2.8.1</version>
</dependency>
(See also http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16014)
Reply With Quote
  #3  
Old Mar 7th, 2007, 09:35 PM
Vita Rara Vita Rara is offline
Member
 
Join Date: Aug 2006
Location: Troy, NY
Posts: 58
Default

Thank you. Thank you. Thank you.

You dug a ways back to find this post. You're advice worked and now my context starts, initializes and loads my JPA persistence context and I can run my integration tests.

Mark
__________________
Business site: http://www.vitarara.net/
Personal site: http://www.vitarara.org/
Reply With Quote
  #4  
Old Apr 19th, 2007, 01:41 AM
dukha dukha is offline
Junior Member
 
Join Date: Apr 2007
Posts: 7
Default

Hi guys,
I was very happy to find this post. The manifestation matches my problem exactly. StackOverflow with jpa while trying to read persistence.xml. Only trouble is, I'm not using Spring so I don't know how to fix it.

I'm trying my first gwt application using jpa on the server. Compiling with my own ant script via Netbeans5.5 and then running with java1.6, source level 1.5, using toplink essentials for persistence provider. Netbeans seems to have xerces2.8 in ide7/modules directory. Netbeans will run other projects using its own ant script (with the same persistence.xml). Yet I still get the StackOverflowError while trying to create an EntityManagerFactory.

Anyone any idea where I should look for a bad xerces??

regards

Dukha
Reply With Quote
  #5  
Old Apr 19th, 2007, 01:42 AM
dukha dukha is offline
Junior Member
 
Join Date: Apr 2007
Posts: 7
Default Stackoverflwo with Xerces

Hi guys,
I was very happy to find this post. The manifestation matches my problem exactly. StackOverflow with jpa while trying to read persistence.xml. Only trouble is, I'm not using Spring so I don't know how to fix it.

I'm trying my first gwt application using jpa on the server. Compiling with my own ant script via Netbeans5.5 and then running with java1.6, source level 1.5, using toplink essentials for persistence provider. Netbeans seems to have xerces2.8 in ide7/modules directory. Netbeans will run other projects using its own ant script (with the same persistence.xml). Yet I still get the StackOverflowError while trying to create an EntityManagerFactory.

Anyone any idea where I should look for a bad xerces??

regards

Dukha
Reply With Quote
  #6  
Old Apr 19th, 2007, 06:43 AM
karldmoore karldmoore is offline
Senior Member
 
Join Date: Sep 2006
Posts: 8,425
Default

This problem specifically talked about Maven, if you are using it then I would guess the exist answer should tell you. If not then just check the classpath of the application. The lib directory is usually a good starting point.
__________________
Senior Java Developer
http://twitter.com/karldmoore

Last edited by karldmoore; Aug 29th, 2007 at 11:15 AM.
Reply With Quote
  #7  
Old Apr 19th, 2007, 05:46 PM
dukha dukha is offline
Junior Member
 
Join Date: Apr 2007
Posts: 7
Default

Thanks for the help, Karl.
I'm looking at the same Stackoverflow as wtih Maven but the source is probably different. It looks as if Google are using the same old Xerces version packaged in gwt 1.3 (the latest!). I'm going further with a work around using
Code:
-Djava.endorsed.dirs
and
Code:
-javaagent:
as args in the call to java.
I'll post again if it works.

dukha
Reply With Quote
  #8  
Old Apr 19th, 2007, 06:56 PM
dukha dukha is offline
Junior Member
 
Join Date: Apr 2007
Posts: 7
Default gwt and xerces

The problem appears to be solved but not as I proposed above.

Indeed it is so that gwt 1.3.3 (released Feb07) uses a version of Xerces from 2002. I. expanded gwt-dev-linux.jar to a directory, expanded xerces 2.9 to a dir and hand copied from xerces to gwt.

Thanks Google! I hope I don't find out the reason for such weirdness further down the track.

regards

dukha
Reply With Quote
  #9  
Old May 24th, 2007, 06:30 AM
volga volga is offline
Member
 
Join Date: Feb 2007
Posts: 45
Default

Quote:
Originally Posted by dukha View Post

Anyone any idea where I should look for a bad xerces??
I had a similar problem with Castor 1.1.1 which has a dependency on xerces 1.4.0, which, by the way, is incompatible with xsd schemas !

In that case, specifying explicitely a newer version of xerces won't work because xerces has been relocated to xercesimpl. The lightest solution I found was to edit the castor pom in my local repository and make it dependant upon xercesimpl 2.8.1 instead of xerces 1.4.0.

The main problem is that the project is no more portable. Can anyone think about a portable solution to this problem ?
Reply With Quote
  #10  
Old May 24th, 2007, 07:25 PM
dukha dukha is offline
Junior Member
 
Join Date: Apr 2007
Posts: 7
Default Giving up for now

Hi volga,
I've given up for now and wait until GWT supports Java 1.5

dukha
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 08:08 AM.


Contegix provides first-class managed hosting and partial sponsorship of these forums.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.