This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 194787 - Error with WebLogic 10.3.4, OpenJPA and JPA 2.0
Summary: Error with WebLogic 10.3.4, OpenJPA and JPA 2.0
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 7.0
Hardware: All All
: P2 normal (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-27 19:17 UTC by Petr Jiricka
Modified: 2011-02-19 10:33 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Stack trace from the WebLogic log (21.11 KB, text/plain)
2011-01-27 19:18 UTC, Petr Jiricka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Jiricka 2011-01-27 19:17:13 UTC
1. Register WebLogic 10.3.4 in the IDE
2. Enable JPA 2.0 on this instance and make sure the default JPA provider is set to Kodo
3. Create a EE 5 Web Application
4. Create a persistence unit, use OpenJPA (JPA 2.0), which is the default option
5. Write some code that accesses JPA (e.g. JPA from DB + JSF from JPA)
6. Run the application and display a page that accesses the JPA code

The application will fail with the following exception:

Caused by: <openjpa-1.1.1-SNAPSHOT-r422266:965591 fatal user error> org.apache.openjpa.persistence.ArgumentException: A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property.
        at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:72)
        at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:776)
        at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:553)

Full stack trace in the attachment. 
The question is whether OpenJPA should be enabled as a possibility at all, if JPA 2.0 is enabled.
Comment 1 Petr Jiricka 2011-01-27 19:18:51 UTC
Created attachment 105417 [details]
Stack trace from the WebLogic log
Comment 2 Sergey Petrov 2011-01-28 13:14:54 UTC
it doesn't look related to jpa2.0, but if it works with disabled jpa2.0 support it worth to investigate.
Comment 3 Sergey Petrov 2011-02-01 17:40:12 UTC
can't deploy on weblogic because of issue 194966
Comment 4 Sergey Petrov 2011-02-02 13:20:32 UTC
Tried both - first create pu and use one created by entities from db and I have next exception:
 
java.lang.AbstractMethodError: org.apache.openjpa.persistence.EntityManagerImpl.getCriteriaBuilder()Ljavax/persistence/criteria/CriteriaBuilder;
	at p.DiscountCodeJpaController.findDiscountCodeEntities(DiscountCodeJpaController.java:129)

instead of initially reported. it looks like initial error is related with some datasource configuration issues.
it still an issue, may be we should handle somehow default openjpa with enabled jpa2.0 either on persistence side or server plugin shouldn't provide jpa2.0 api.
Comment 5 Petr Jiricka 2011-02-16 09:45:36 UTC
Yes, I am now getting the same error (the previous error is resolved, I don't see it any more). I think this is an important scenario (as OpenJPA is the default provider), and should work out of the box for 7.0. Changing priority to P2.
Comment 6 Sergey Petrov 2011-02-16 12:11:56 UTC
ok, will look, if openjpa on weblogic support jpa 1.0 only it should be handled and only OpenJPA(1.0) should be available instead of openJPA(2.0).
Comment 7 Petr Jiricka 2011-02-16 12:22:22 UTC
Thanks. Also, EclipseLink (JPA 2.0) should be selected by default (even if OpenJPA is the default on the server), because honoring the user's choice of JPA 2 is more important than honoring his choice of the provider, IMO.
Comment 8 Sergey Petrov 2011-02-16 13:13:26 UTC
yes, it may be good, not sure yet, but as a special case it's likely will be coded as some hack instead of good design, at least at first iteration.
Comment 9 Quality Engineering 2011-02-18 10:33:15 UTC
Integrated into 'main-golden', will be available in build *201102180501* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/805201c63a0b
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: fix #194787 - separate default openjpa 1.0 and 2.0
Comment 10 Sergey Petrov 2011-02-18 14:57:15 UTC
now openjpa 1.0 is shown as default and persistence.xml version 1.0 is created by new pu and entities from db wizards with this default.
Comment 11 Petr Jiricka 2011-02-18 16:13:10 UTC
Thanks, this fixes the worst part, but I would still prefer:
- If JPA 2 is enabled, always use EclipseLink (JPA 2.0) as the default (regardless of the default provider setting in admin console)
- If JPA 2 is disabled, honor the setting in the admin console (i.e. OpenJPA by default, or EclipseLink if the user switched to EL in the admin console).

Is this doable for 7.0, even if it requires some small hack? Thanks.
Comment 12 Sergey Petrov 2011-02-18 16:19:04 UTC
yes, I'm looking to select eclipselink as 'prefered' if jpa2.0 is supported and default is not jpa2.0 provider.
Also it's good because there is an issue (isn't filed) with openjpa and controllers generated by jsf from entities (it may be an issue with openjpa also).
Comment 13 Sergey Petrov 2011-02-18 18:11:07 UTC
should be fixed now, if jpa2.0 is supported eclipselink is selected by default, also server default is openjpa 1.0.
Comment 14 Quality Engineering 2011-02-19 10:33:03 UTC
Integrated into 'main-golden', will be available in build *201102190501* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/0719020352fd
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: fix #194787 - fix issue with provider version isn't used in pu wizard