Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-1783

Can't use NamedQuery under OSGi

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 2.0.1
    • None
    • competitive, kernel, osgi, samples
    • None
    • equinox
    • Patch Available

    Description

      I tried to run named query under equinox osgi, but got this:

      osgi> start 157
      ble2
      Init JPA ok.
      85 openjpa WARN [OSGi Console] openjpa.MetaData - The class "openjpa_example.Person" listed in the openjpa.MetaDataFactory configuration property could not be loaded by org.apache.openjpa.lib.util.MultiClassLoader@81b4ab2; ignoring.
      93 openjpa WARN [OSGi Console] openjpa.MetaData - The class "openjpa_example.Person" listed in the openjpa.MetaDataFactory configuration property could not be loaded by org.apache.openjpa.lib.util.MultiClassLoader@3695640; ignoring.
      109 openjpa WARN [OSGi Console] openjpa.MetaData - The class "openjpa_example.Person" listed in the openjpa.MetaDataFactory configuration property could not be loaded by org.apache.openjpa.lib.util.MultiClassLoader@81b4ab2; ignoring.
      2010-09-04 22:31:49,047 DEBUG [o.s.o.e.i.s.NamespacePlugins] [ OSGi Console] Removing handler Openjpa-example (openjpa-example)
      org.osgi.framework.BundleException: Exception in openjpa_example.Activator.start() of bundle openjpa-example.
      at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:806)
      at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
      at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
      at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:279)
      at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:271)
      at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:252)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:155)
      at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:157)
      at org.eclipse.osgi.framework.internal.core.FrameworkConsole.runConsole(FrameworkConsole.java:142)
      at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:106)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: <openjpa-2.0.1-r422266:989424 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "select p from Person p". Error message: The name "Person" is not a recognized entity or identifier. Perhaps you meant Person, which is a close match. Known entity names: [Person]
      at org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(AbstractExpressionBuilder.java:119)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:194)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:167)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:242)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:212)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java:205)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$200(JPQLExpressionBuilder.java:81)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:2387)
      at org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:61)
      at org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:154)
      at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:671)
      at org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:652)
      at org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:618)
      at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:680)
      at org.apache.openjpa.kernel.QueryImpl.compile(QueryImpl.java:587)
      at org.apache.openjpa.persistence.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:1028)
      at org.apache.openjpa.persistence.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:100)
      at openjpa_example.PersonPersistenceImpl.list(PersonPersistenceImpl.java:38)
      at openjpa_example.Activator.start(Activator.java:21)
      at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
      ... 14 more
      Nested Exception:
      <openjpa-2.0.1-r422266:989424 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "select p from Person p". Error message: The name "Person" is not a recognized entity or identifier. Perhaps you meant Person, which is a close match. Known entity names: [Person]
      at org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(AbstractExpressionBuilder.java:119)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:194)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:167)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:242)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:212)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java:205)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$200(JPQLExpressionBuilder.java:81)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:2387)
      at org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:61)
      at org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:154)
      at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:671)
      at org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:652)
      at org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:618)
      at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:680)
      at org.apache.openjpa.kernel.QueryImpl.compile(QueryImpl.java:587)
      at org.apache.openjpa.persistence.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:1028)
      at org.apache.openjpa.persistence.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:100)
      at openjpa_example.PersonPersistenceImpl.list(PersonPersistenceImpl.java:38)
      at openjpa_example.Activator.start(Activator.java:21)
      at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
      at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
      at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
      at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:279)
      at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:271)
      at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:252)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:155)
      at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:157)
      at org.eclipse.osgi.framework.internal.core.FrameworkConsole.runConsole(FrameworkConsole.java:142)
      at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:106)
      at java.lang.Thread.run(Thread.java:619)
      Nested Exception:
      <openjpa-2.0.1-r422266:989424 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query filter "select p from Person p". Error message: The name "Person" is not a recognized entity or identifier. Perhaps you meant Person, which is a close match. Known entity names: [Person]
      at org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(AbstractExpressionBuilder.java:119)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:194)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:167)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:242)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:212)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java:205)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$200(JPQLExpressionBuilder.java:81)
      at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:2387)
      at org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:61)
      at org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:154)
      at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:671)
      at org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:652)
      at org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:618)
      at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:680)
      at org.apache.openjpa.kernel.QueryImpl.compile(QueryImpl.java:587)
      at org.apache.openjpa.persistence.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:1028)
      at org.apache.openjpa.persistence.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:100)
      at openjpa_example.PersonPersistenceImpl.list(PersonPersistenceImpl.java:38)
      at openjpa_example.Activator.start(Activator.java:21)
      at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
      at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
      at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
      at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:279)
      at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:271)
      at org.eclipse.osgi.framework.internal.core.FrameworkCommandProvider._start(FrameworkCommandProvider.java:252)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.eclipse.osgi.framework.internal.core.FrameworkCommandInterpreter.execute(FrameworkCommandInterpreter.java:155)
      at org.eclipse.osgi.framework.internal.core.FrameworkConsole.docommand(FrameworkConsole.java:157)
      at org.eclipse.osgi.framework.internal.core.FrameworkConsole.runConsole(FrameworkConsole.java:142)
      at org.eclipse.osgi.framework.internal.core.FrameworkConsole.run(FrameworkConsole.java:106)
      at java.lang.Thread.run(Thread.java:619)

      Attachments

        1. ClassloaderEntityManager.java
          12 kB
          Rafal Rusin
        2. openjpa-example_1.0.0.201009042055.jar
          9 kB
          Rafal Rusin
        3. openjpa-example.tar
          40 kB
          Rafal Rusin

        Activity

          People

            Unassigned Unassigned
            rrusin Rafal Rusin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: