Announcement Announcement Module
Collapse
No announcement yet.
Problem with 2.0M5/JPA/ToplinkEssentials Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with 2.0M5/JPA/ToplinkEssentials

    I'm using the Glassfish/Toplink JPA implementation in combination with the new JPA code in 2.0M5. Works great when I run my web app from within Maven using the jetty6 maven plugin.

    But, when I deploy my app as a WAR to an application server I get the following exception:

    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: URI scheme is not "file"
    Caused by: java.lang.IllegalArgumentException: URI scheme is not "file"
            at java.io.File.<init>(File.java:338)
            at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.getPersistentClassNamesFromURL(PersistenceUnitProcessor.java:556)
            at oracle.toplink.essentials.ejb.cmp3.persistence.PersistenceUnitProcessor.buildPersistentClassSet(PersistenceUnitProcessor.java:401)
            at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.buildEntityList(EntityManagerSetupImpl.java:159)
            at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:492)
            at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createContainerEntityManagerFactory(EntityManagerFactoryProvider.java:154)
            at org.springframework.orm.jpa.ContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(ContainerEntityManagerFactoryBean.java:181)
            at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:232)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:901)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:870)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:393)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:256)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:167)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:253)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:332)
            at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
            at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
            at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
            at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
            at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4236)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:4760)
            at com.sun.enterprise.web.WebModule.start(WebModule.java:292)
            ....
    This happens with both Glassfish and JBoss.

    I don't really understand the problem. It look like some classpath issue, but it is not clear what Toplink is looking for.

    I know it is probably not a Spring issue but I'm trying anyway since it is difficult to find the right audience for questions like this.

    S.

  • #2
    What's your application context? Try turning on logging on toplink (through some property) and see what's the used persistence.xml.

    Comment


    • #3
      I've seen the same exception a couple of times but haven't yet quite figured out what the exact cause is. I'm currently deploying without problem on both Tomcat and WebLogic using a CVS snapshot build. Try downloading the latest snapshot build of RC1. There was a recent change made to the persistence.xml lookup.

      Comment


      • #4
        Originally posted by trisberg
        I've seen the same exception a couple of times but haven't yet quite figured out what the exact cause is. I'm currently deploying without problem on both Tomcat and WebLogic using a CVS snapshot build. Try downloading the latest snapshot build of RC1. There was a recent change made to the persistence.xml lookup.
        I think my problem is that I am not correctly packaging my persistence.xml and entity classes in a persistence unit. Instead I have simply added them to webapp/WEB-INF/classes/ and webapp/META-INF/persistence.xml.

        Sigh .. I hate complex packaging. Now I can't have a really simple war artifact in Maven and have to start working with a multi module project again.

        S.

        Comment


        • #5
          If you package your app and persistence unit in a war file you should put the persistence.xml in WEB-INF/classes/META-INF directory. This works with the latest Spring nightly builds. I package my app in a war file with no special treatment of the persistence unit and it works fine.

          Comment


          • #6
            Originally posted by trisberg
            If you package your app and persistence unit in a war file you should put the persistence.xml in WEB-INF/classes/META-INF directory. This works with the latest Spring nightly builds. I package my app in a war file with no special treatment of the persistence unit and it works fine.
            It works now! I did have to add spring-tomcat-weaver.jar to my project through.

            Thanks!

            S.

            Comment


            • #7
              spring-tomcat-weaver should be used only when using ContainerEntityManagerFactoryBean. While the code is stable, you are still working against the CVS and the code might suffer some changes in the future.

              Comment

              Working...
              X