Results 1 to 10 of 11

Thread: JPA Integration Testing w/ Maven: StackOverflowError

Hybrid View

  1. #1
    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

  2. #2
    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)

  3. #3
    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

  4. #4
    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

  5. #5
    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

  6. #6
    Join Date
    Sep 2006
    Location
    UK
    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.
    Last edited by karldmoore; Aug 29th, 2007 at 11:15 AM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  7. #7

    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 ?

  8. #8

    Default

    It was happening with me too, but I perceived that both librarys was being used by maven. It was happening because two of my libraries has a dependency to this version of xerces. Im my case the problematic libraries was commons-pool and commons-dbcp.
    To solve the problem I changed the version of commons-pool to another more new that donīt have this dependency and I have to make a little change in the pom of commons-dbcp and put the dependecy to xerces as optional. I know that it is a very durty solution, but i actualy need to use these libraries. If somebody knows another solution I will be very apreciate.
    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •