Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-4362

Bug in parsing of JPA uri

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.8.0
    • 2.8.4, 2.9.0
    • camel-jpa
    • None
    • Unknown

    Description

      According to http://camel.apache.org/jpa.html entityName is optional.
      When configuring with the following uri (e.g. w/o entityName):
      <camel:endpoint id="jpaEndpoint" uri="jpa:?persistenceUnit=journalPersistenceUnit&usePersist=true" />
      the following warning will be displayed
      2011-08-21 18:57:11,381 [main][][][][][][][] WARN org.apache.camel.util.ObjectHelper - Cannot find class: persistenceUnitjournalPersistenceUnitusePersisttruepersistenceUnitjournalPersistenceUnitusePersisttrue
      due to the incorrect if test in the JpaComponent:

      // lets interpret the next string as a class
              if (path != null) {
                  // provide the class loader of this component to work in OSGi environments as camel-jpa must be able
                  // to resolve the entity classes
                  Class<?> type = getCamelContext().getClassResolver().resolveClass(path, JpaComponent.class.getClassLoader());
                  if (type != null) {
                      endpoint.setEntityType(type);
                  }
              }
      

      path is not null, but it is the rest of the string and not the entityname. e.g it should not start with ? if it is an entityname - else it is the options.

      Attachments

        Activity

          People

            muellerc Christian Müller
            davidkarlsen@gmail.com David J. M. Karlsen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: