Skip to content

Test native-sql-resultset-mapping fail in Weblogic 12.1.3 #342

Description

@joedayz

Hi, I am trying it first test with web logic 12.1.3.

Step 1: My profile was updated like this:

weblogic-remote-arquillian
        <properties>
            <!-- Default username/password that instructions in README.md ask to use 
                when starting up WebLogic for the first time. Note that WebLogic does not 
                have any default username/password of its own. -->
            <weblogicRemoteArquillian_adminUserName>weblogic</weblogicRemoteArquillian_adminUserName>
            <weblogicRemoteArquillian_adminPassword>welcome1</weblogicRemoteArquillian_adminPassword>

            <!-- Default host and port when running WLS locally -->
            <weblogicRemoteArquillian_adminUrl>t3://localhost:7001</weblogicRemoteArquillian_adminUrl>

            <!-- Default target after having installed developer zip distribution for 
                WebLogic -->
            <weblogicRemoteArquillian_target>myserver</weblogicRemoteArquillian_target>
        </properties>

        <dependencies>
            <dependency>
                <groupId>org.jboss.arquillian.container</groupId>
                <artifactId>arquillian-wls-remote-12.1.2</artifactId>
                <version>1.0.0.Alpha3</version>
                <scope>test</scope>
            </dependency>
        </dependencies>

Step 2: Start Weblogic

Step 3: mvn test -Pweblogic-remote-arquillian -DweblogicRemoteArquillian_wlHome=/Users/josediaz/Tools/wl12210

Error Test:

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.295 sec <<< FAILURE!
testJpaNativeSqlResultSetMapping(org.javaee7.jpa.nativesql.resultset.mapping.JpaNativeSqlResultSetMappingTest) Time elapsed: 0.329 sec <<< ERROR!
java.lang.NullPointerException
at org.javaee7.jpa.nativesql.resultset.mapping.JpaNativeSqlResultSetMappingTest.testJpaNativeSqlResultSetMapping(JpaNativeSqlResultSetMappingTest.java:67)

Error Weblogic:

INFO: BeanManager not found.
<Feb 26, 2016 2:21:26 PM PET> <2016-02-26 14:21:26.705--ServerSession(664831661)--Failed to find MBean Server: javax.naming.NameNotFoundException: remaining name: comp/env/jmx/runtime>
<Feb 26, 2016 2:21:26 PM PET> <2016-02-26 14:21:26.705--ServerSession(664831661)--Unable to unregister MBean [null] because the MBeanServer is null. Verify that your ServerPlatform is JMX enabled.>
<Feb 26, 2016 2:21:26 PM PET> <2016-02-26 14:21:26.706--ServerSession(664831661)--909fa198-0844-4514-b4f9-3df023d60c83file:/Users/josediaz/Tools/wls12130/user_projects/domains/mydomain/servers/myserver/tmp/_WL_user/909fa198-0844-4514-b4f9-3df023d60c83/mh2r7b/war/WEB-INF/lib/_wl_cls_gen.jar_MyPU logout successful>

Jose

Activity

  1. arjantijms commented on Feb 26, 2016

    @arjantijms
    Contributor

    Not every sample runs on every server.

    In general if a sample doesn't run on one server but does run on other ones, it's likely a bug in that server. This is actually the intend of these samples, to point out bugs in servers.

    If you think there's something specifically faulty in the test it can be looked at of course.

  2. joedayz commented on Feb 26, 2016

    @joedayz
    Author

    Yes. The problem was solved adding a META-INF/beans.xml and a DefaultDataSource (I had to create one datasource with similar JNDI name) in persistence.xml.

    I will continue testing in weblogic.

    Jose

  3. arjantijms commented on Feb 26, 2016

    @arjantijms
    Contributor

    DefaultDataSource (I had to create one datasource with similar JNDI name) in persistence.xml.

    Oh, of course. I forgot to mention that WebLogic 12.1.3 is a Java EE 6 server. The samples require Java EE 7 (WebLogic 12.2.1+). Sorry for that.

    The default data source is a new feature in Java EE 7, so that's indeed not available in Java EE 6. The idea there is that there's already a basic/simple data source available without you having to configure anything.

  4. joedayz commented on Feb 26, 2016

    @joedayz
    Author

    In theory, weblogic 12.2.1 has a datasource by default. I downloaded the weblogic 12.2.1 yesterday , I created a new domain with basic wls template and my surprise was that it does not have datasources.

    This was my first error and when added , the next error was BeanManager null. For this reason, I added beans.xml

    Maybe exists some domain template that should install for have a default datasource.

  5. radcortez commented on Feb 27, 2016

    @radcortez
    Contributor

    By the spec, a Java EE 7 should provide you with a default datasource. That's why the samples don't create one and just expect it to be there.

  6. arjantijms commented on Feb 27, 2016

    @arjantijms
    Contributor

    @radcortez
    Indeed, there are unfortunately a few caveats along the lines of that the datasource itself has to be there (in the correct JNDI namespace or, in case of e.g. JPA, by not specifying any namespace), but the database to which that datasource is connected doesn't necessarily have to be there by default.

    This is a really odd omission in the spec. I tried to address it a couple of times but no success yet.

    That said, the release notes of WebLogic explicitly state support for the default datasource. See

  7. radcortez commented on Feb 29, 2016

    @radcortez
    Contributor

    @arjantijms

    I was looking for the spec section about Default Datasources and found this:

    EE.5.19 Default Data Source
    The Java EE Platform requires that a Java EE Product Provider provide a database in the operational environment (see Section EE.2.6, “Database”). The Java EE Product Provider must also provide a preconfigured, default data source for use by the application in accessing this database.
    The Java EE Product Provider must make the default data source accessible to the application under the JNDI name java:comp/DefaultDataSource.
    The Application Component Provider or Deployer may explicitly bind a DataSource resource reference to the default data source using the lookup element of the Resource annotation or the lookup-name element of the resource-ref deployment descriptor element. For example,
    @resource(lookup="java:comp/DefaultDataSource") DataSource myDS;
    In the absence of such a binding, the mapping of the reference will default to the product's default data source.
    For example, the following will map to a preconfigured data source for the product's default database:
    @resource
    DataSource myDS;

    My understanding of the spec is that both ways should work, by stating explicitly the JNDI name or by omitting it. This works fine with other servers.

    Apparently by reading https://docs.oracle.com/middleware/1221/wls/JDBCA/default_datasource.htm#JDBCA729, seems that WebLogic only supports the Default Datasource by stating explicitly the JNDI name. I'm inclined to say that it's a bug on the WebLogic side and they should also support injection without the JNDI name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions