You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Miguel Figueiredo (Created) (JIRA)" <ji...@apache.org> on 2012/04/18 23:30:41 UTC

[jira] [Created] (TAP5-1910) JPA and JBoss 7 datasources

JPA and JBoss 7 datasources
---------------------------

                 Key: TAP5-1910
                 URL: https://issues.apache.org/jira/browse/TAP5-1910
             Project: Tapestry 5
          Issue Type: Bug
          Components: tapestry-jpa
    Affects Versions: 5.3.2
            Reporter: Miguel Figueiredo


Hello,

I am using tapestry 5.3.2 with JBoss 7, and I'm having some problems
when using a JBoss datasource with JPA.

My datasource configuration:

               <datasource jta="false"
jndi-name="java:jboss/myDatasource" pool-name="mysqlDS" enabled="true"
use-java-context="true" use-ccm="true">
                   (...)
               </datasource>

My persistence.xml configuration:

   <persistence-unit name="my-pu"
       transaction-type="RESOURCE_LOCAL">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <non-jta-data-source>java:jboss/myDatasource</non-jta-data-source>
       (...)
   </persistence-unit>

Looking at the code in the PersistenceUnitInfoImpl of tapestry-jpa
5.3.2 I found the following:

   private DataSource lookupDataSource(final String name)
   {
       try
       {
           // TODO: Create InitialContext with environment properties?
           final Context initContext = new InitialContext();

           final Context envContext = (Context) initContext.lookup("java:comp/env");

           return (DataSource) envContext.lookup(name);
       } catch (final NamingException e)
       {
           throw new RuntimeException(e);
       }

   }

In JBoss 7 the env context should be retrieved from java:jboss, e.g.:

           final Context initContext = new InitialContext();
           final Context envContext = (Context)initContext.lookup("java:jboss");
           return (DataSource) envContext.lookup("myDatasource");

Maybe a datasource lookup class could be configured here.

Best regards,
Miguel

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TAP5-1910) JPA and JBoss 7 datasources

Posted by "Igor Drobiazko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13259453#comment-13259453 ] 

Igor Drobiazko commented on TAP5-1910:
--------------------------------------

Is it documented somewhere?
                
> JPA and JBoss 7 datasources
> ---------------------------
>
>                 Key: TAP5-1910
>                 URL: https://issues.apache.org/jira/browse/TAP5-1910
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-jpa
>    Affects Versions: 5.3.2
>            Reporter: Miguel Figueiredo
>
> Hello,
> I am using tapestry 5.3.2 with JBoss 7, and I'm having some problems
> when using a JBoss datasource with JPA.
> My datasource configuration:
>                <datasource jta="false"
> jndi-name="java:jboss/myDatasource" pool-name="mysqlDS" enabled="true"
> use-java-context="true" use-ccm="true">
>                    (...)
>                </datasource>
> My persistence.xml configuration:
>    <persistence-unit name="my-pu"
>        transaction-type="RESOURCE_LOCAL">
>        <provider>org.hibernate.ejb.HibernatePersistence</provider>
>        <non-jta-data-source>java:jboss/myDatasource</non-jta-data-source>
>        (...)
>    </persistence-unit>
> Looking at the code in the PersistenceUnitInfoImpl of tapestry-jpa
> 5.3.2 I found the following:
>    private DataSource lookupDataSource(final String name)
>    {
>        try
>        {
>            // TODO: Create InitialContext with environment properties?
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context) initContext.lookup("java:comp/env");
>            return (DataSource) envContext.lookup(name);
>        } catch (final NamingException e)
>        {
>            throw new RuntimeException(e);
>        }
>    }
> In JBoss 7 the env context should be retrieved from java:jboss, e.g.:
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context)initContext.lookup("java:jboss");
>            return (DataSource) envContext.lookup("myDatasource");
> Maybe a datasource lookup class could be configured here.
> Best regards,
> Miguel

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (TAP5-1910) JPA and JBoss 7 datasources

Posted by "Miguel Figueiredo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13272683#comment-13272683 ] 

Miguel Figueiredo edited comment on TAP5-1910 at 5/10/12 7:45 PM:
------------------------------------------------------------------

Hi,

The documentation states that namespaces should follow this rule for unqualified relative names:

    Unqualified relative names like "DefaultDS" or "jdbc/DefaultDS"
    should be qualified relative to "java:comp/env", "java:module/env", or
    "java:jboss/env", depending on the context.
   (see also https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7)

But in the datasource configuration file (e.g. standalone.xml) I have to use either java:/ or java:jboss/: "JBAS010471: Jndi name have to start with java:/ or java:jboss/"

In order to use unqualified relative names I have to create the file webapp/WEB-INF/jboss-web.xml like this:

<jboss-web>
    <resource-ref>
        <res-ref-name>myDatasource</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>java:jboss/myDatasource</jndi-name>
    </resource-ref>
</jboss-web>

and the persistence unit like this:

<persistence-unit name="my-pu"
       transaction-type="RESOURCE_LOCAL">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <non-jta-data-source>myDatasource</non-jta-data-source>
       (...)
   </persistence-unit> 
   
See also: https://community.jboss.org/message/632844

In conclusion I was able to use tapestry-jpa without any change.

Best regards,
Miguel

                
      was (Author: olliegator):
    Hi,

The documentation states that namespaces should follow this rule for unqualified relative names:

    Unqualified relative names like "DefaultDS" or "jdbc/DefaultDS"
    should be qualified relative to "java:comp/env", "java:module/env", or
    "java:jboss/env", depending on the context.
   (see also https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7)

But in the  configuration file (e.g. standalone.xml) I have to use either java:/ or java:jboss/: "JBAS010471: Jndi name have to start with java:/ or java:jboss/"

In order to use unqualified relative names I have to create the file webapp/WEB-INF/jboss-web.xml like this:

<jboss-web>
    <resource-ref>
        <res-ref-name>myDatasource</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>java:jboss/myDatasource</jndi-name>
    </resource-ref>
</jboss-web>

and the persistence unit like this:

<persistence-unit name="my-pu"
       transaction-type="RESOURCE_LOCAL">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <non-jta-data-source>myDatasource</non-jta-data-source>
       (...)
   </persistence-unit> 
   
See also: https://community.jboss.org/message/632844

In conclusion I was able to use tapestry-jpa without any change.

Best regards,
Miguel

                  
> JPA and JBoss 7 datasources
> ---------------------------
>
>                 Key: TAP5-1910
>                 URL: https://issues.apache.org/jira/browse/TAP5-1910
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-jpa
>    Affects Versions: 5.3.2
>            Reporter: Miguel Figueiredo
>
> Hello,
> I am using tapestry 5.3.2 with JBoss 7, and I'm having some problems
> when using a JBoss datasource with JPA.
> My datasource configuration:
>                <datasource jta="false"
> jndi-name="java:jboss/myDatasource" pool-name="mysqlDS" enabled="true"
> use-java-context="true" use-ccm="true">
>                    (...)
>                </datasource>
> My persistence.xml configuration:
>    <persistence-unit name="my-pu"
>        transaction-type="RESOURCE_LOCAL">
>        <provider>org.hibernate.ejb.HibernatePersistence</provider>
>        <non-jta-data-source>java:jboss/myDatasource</non-jta-data-source>
>        (...)
>    </persistence-unit>
> Looking at the code in the PersistenceUnitInfoImpl of tapestry-jpa
> 5.3.2 I found the following:
>    private DataSource lookupDataSource(final String name)
>    {
>        try
>        {
>            // TODO: Create InitialContext with environment properties?
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context) initContext.lookup("java:comp/env");
>            return (DataSource) envContext.lookup(name);
>        } catch (final NamingException e)
>        {
>            throw new RuntimeException(e);
>        }
>    }
> In JBoss 7 the env context should be retrieved from java:jboss, e.g.:
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context)initContext.lookup("java:jboss");
>            return (DataSource) envContext.lookup("myDatasource");
> Maybe a datasource lookup class could be configured here.
> Best regards,
> Miguel

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TAP5-1910) JPA and JBoss 7 datasources

Posted by "Igor Drobiazko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13259453#comment-13259453 ] 

Igor Drobiazko commented on TAP5-1910:
--------------------------------------

Is it documented somewhere?
                
> JPA and JBoss 7 datasources
> ---------------------------
>
>                 Key: TAP5-1910
>                 URL: https://issues.apache.org/jira/browse/TAP5-1910
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-jpa
>    Affects Versions: 5.3.2
>            Reporter: Miguel Figueiredo
>
> Hello,
> I am using tapestry 5.3.2 with JBoss 7, and I'm having some problems
> when using a JBoss datasource with JPA.
> My datasource configuration:
>                <datasource jta="false"
> jndi-name="java:jboss/myDatasource" pool-name="mysqlDS" enabled="true"
> use-java-context="true" use-ccm="true">
>                    (...)
>                </datasource>
> My persistence.xml configuration:
>    <persistence-unit name="my-pu"
>        transaction-type="RESOURCE_LOCAL">
>        <provider>org.hibernate.ejb.HibernatePersistence</provider>
>        <non-jta-data-source>java:jboss/myDatasource</non-jta-data-source>
>        (...)
>    </persistence-unit>
> Looking at the code in the PersistenceUnitInfoImpl of tapestry-jpa
> 5.3.2 I found the following:
>    private DataSource lookupDataSource(final String name)
>    {
>        try
>        {
>            // TODO: Create InitialContext with environment properties?
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context) initContext.lookup("java:comp/env");
>            return (DataSource) envContext.lookup(name);
>        } catch (final NamingException e)
>        {
>            throw new RuntimeException(e);
>        }
>    }
> In JBoss 7 the env context should be retrieved from java:jboss, e.g.:
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context)initContext.lookup("java:jboss");
>            return (DataSource) envContext.lookup("myDatasource");
> Maybe a datasource lookup class could be configured here.
> Best regards,
> Miguel

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (TAP5-1910) JPA and JBoss 7 datasources

Posted by "Miguel Figueiredo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13272683#comment-13272683 ] 

Miguel Figueiredo edited comment on TAP5-1910 at 5/10/12 7:44 PM:
------------------------------------------------------------------

Hi,

The documentation states that namespaces should follow this rule for unqualified relative names:

    Unqualified relative names like "DefaultDS" or "jdbc/DefaultDS"
    should be qualified relative to "java:comp/env", "java:module/env", or
    "java:jboss/env", depending on the context.
   (see also https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7)

But in the  configuration file (e.g. standalone.xml) I have to use either java:/ or java:jboss/: "JBAS010471: Jndi name have to start with java:/ or java:jboss/"

In order to use unqualified relative names I have to create the file webapp/WEB-INF/jboss-web.xml like this:

<jboss-web>
    <resource-ref>
        <res-ref-name>myDatasource</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>java:jboss/myDatasource</jndi-name>
    </resource-ref>
</jboss-web>

and the persistence unit like this:

<persistence-unit name="my-pu"
       transaction-type="RESOURCE_LOCAL">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <non-jta-data-source>myDatasource</non-jta-data-source>
       (...)
   </persistence-unit> 
   
See also: https://community.jboss.org/message/632844

In conclusion I was able to use tapestry-jpa without any change.

Best regards,
Miguel

                
      was (Author: olliegator):
    Hi,

The documentation states that namespaces should follow this rule for unqualified relative names:

    Unqualified relative names like "DefaultDS" or "jdbc/DefaultDS"
    should be qualified relative to "java:comp/env", "java:module/env", or
    "java:jboss/env", depending on the context.
   (see also https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7)

But in the  configuration file (e.g. standalone.xml) I have to use either java:/ or java:jboss/: "JBAS010471: Jndi name have to start with java:/ or java:jboss/"

In order to use unqualified relative names I have to create the file webapp/WEB-INF/jboss-web.xml like this:

<jboss-web>
    <resource-ref>
        <res-ref-name>myDatasource</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>java:jboss/myDatasource</jndi-name>
    </resource-ref>
</jboss-web>

and the persistence unit like this:

<persistence-unit name="my-pu"
       transaction-type="RESOURCE_LOCAL">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <non-jta-data-source>myDatasource</non-jta-data-source>
       (...)
   </persistence-unit> 
   
See also: https://community.jboss.org/message/632844

In conclusion I was able to use tapestry-jpa without any change.

Best resgards,
Miguel

                  
> JPA and JBoss 7 datasources
> ---------------------------
>
>                 Key: TAP5-1910
>                 URL: https://issues.apache.org/jira/browse/TAP5-1910
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-jpa
>    Affects Versions: 5.3.2
>            Reporter: Miguel Figueiredo
>
> Hello,
> I am using tapestry 5.3.2 with JBoss 7, and I'm having some problems
> when using a JBoss datasource with JPA.
> My datasource configuration:
>                <datasource jta="false"
> jndi-name="java:jboss/myDatasource" pool-name="mysqlDS" enabled="true"
> use-java-context="true" use-ccm="true">
>                    (...)
>                </datasource>
> My persistence.xml configuration:
>    <persistence-unit name="my-pu"
>        transaction-type="RESOURCE_LOCAL">
>        <provider>org.hibernate.ejb.HibernatePersistence</provider>
>        <non-jta-data-source>java:jboss/myDatasource</non-jta-data-source>
>        (...)
>    </persistence-unit>
> Looking at the code in the PersistenceUnitInfoImpl of tapestry-jpa
> 5.3.2 I found the following:
>    private DataSource lookupDataSource(final String name)
>    {
>        try
>        {
>            // TODO: Create InitialContext with environment properties?
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context) initContext.lookup("java:comp/env");
>            return (DataSource) envContext.lookup(name);
>        } catch (final NamingException e)
>        {
>            throw new RuntimeException(e);
>        }
>    }
> In JBoss 7 the env context should be retrieved from java:jboss, e.g.:
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context)initContext.lookup("java:jboss");
>            return (DataSource) envContext.lookup("myDatasource");
> Maybe a datasource lookup class could be configured here.
> Best regards,
> Miguel

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (TAP5-1910) JPA and JBoss 7 datasources

Posted by "Miguel Figueiredo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13272683#comment-13272683 ] 

Miguel Figueiredo edited comment on TAP5-1910 at 5/10/12 7:45 PM:
------------------------------------------------------------------

Hi,

The documentation states that namespaces should follow this rule for unqualified relative names:

    Unqualified relative names like "DefaultDS" or "jdbc/DefaultDS"
    should be qualified relative to "java:comp/env", "java:module/env", or
    "java:jboss/env", depending on the context.
   (see also https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7)

But in the datasource configuration file (e.g. standalone.xml) I have to use either java:/ or java:jboss/: "JBAS010471: Jndi name have to start with java:/ or java:jboss/"

In order to use unqualified relative names I have to create the file webapp/WEB-INF/jboss-web.xml like this:

<jboss-web>
    <resource-ref>
        <res-ref-name>myDatasource</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>java:jboss/myDatasource</jndi-name>
    </resource-ref>
</jboss-web>

and the persistence unit like this:

<persistence-unit name="my-pu"
       transaction-type="RESOURCE_LOCAL">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <non-jta-data-source>myDatasource</non-jta-data-source>
       (...)
   </persistence-unit> 
   
See also: https://community.jboss.org/message/632844

In conclusion I was able to use tapestry-jpa without any change.

Best regards,
Miguel

                
      was (Author: olliegator):
    Hi,

The documentation states that namespaces should follow this rule for unqualified relative names:

    Unqualified relative names like "DefaultDS" or "jdbc/DefaultDS"
    should be qualified relative to "java:comp/env", "java:module/env", or
    "java:jboss/env", depending on the context.
   (see also https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7)

But in the  configuration file (e.g. standalone.xml) I have to use either java:/ or java:jboss/: "JBAS010471: Jndi name have to start with java:/ or java:jboss/"

In order to use unqualified relative names I have to create the file webapp/WEB-INF/jboss-web.xml like this:

<jboss-web>
    <resource-ref>
        <res-ref-name>myDatasource</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>java:jboss/myDatasource</jndi-name>
    </resource-ref>
</jboss-web>

and the persistence unit like this:

<persistence-unit name="my-pu"
       transaction-type="RESOURCE_LOCAL">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <non-jta-data-source>myDatasource</non-jta-data-source>
       (...)
   </persistence-unit> 
   
See also: https://community.jboss.org/message/632844

In conclusion I was able to use tapestry-jpa without any change.

Best regards,
Miguel

                  
> JPA and JBoss 7 datasources
> ---------------------------
>
>                 Key: TAP5-1910
>                 URL: https://issues.apache.org/jira/browse/TAP5-1910
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-jpa
>    Affects Versions: 5.3.2
>            Reporter: Miguel Figueiredo
>
> Hello,
> I am using tapestry 5.3.2 with JBoss 7, and I'm having some problems
> when using a JBoss datasource with JPA.
> My datasource configuration:
>                <datasource jta="false"
> jndi-name="java:jboss/myDatasource" pool-name="mysqlDS" enabled="true"
> use-java-context="true" use-ccm="true">
>                    (...)
>                </datasource>
> My persistence.xml configuration:
>    <persistence-unit name="my-pu"
>        transaction-type="RESOURCE_LOCAL">
>        <provider>org.hibernate.ejb.HibernatePersistence</provider>
>        <non-jta-data-source>java:jboss/myDatasource</non-jta-data-source>
>        (...)
>    </persistence-unit>
> Looking at the code in the PersistenceUnitInfoImpl of tapestry-jpa
> 5.3.2 I found the following:
>    private DataSource lookupDataSource(final String name)
>    {
>        try
>        {
>            // TODO: Create InitialContext with environment properties?
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context) initContext.lookup("java:comp/env");
>            return (DataSource) envContext.lookup(name);
>        } catch (final NamingException e)
>        {
>            throw new RuntimeException(e);
>        }
>    }
> In JBoss 7 the env context should be retrieved from java:jboss, e.g.:
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context)initContext.lookup("java:jboss");
>            return (DataSource) envContext.lookup("myDatasource");
> Maybe a datasource lookup class could be configured here.
> Best regards,
> Miguel

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TAP5-1910) JPA and JBoss 7 datasources

Posted by "Miguel Figueiredo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13272683#comment-13272683 ] 

Miguel Figueiredo commented on TAP5-1910:
-----------------------------------------

Hi,

The documentation states that namespaces should follow this rule for unqualified relative names:

    Unqualified relative names like "DefaultDS" or "jdbc/DefaultDS"
    should be qualified relative to "java:comp/env", "java:module/env", or
    "java:jboss/env", depending on the context.
   (see also https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7)

But in the  configuration file (e.g. standalone.xml) I have to use either java:/ or java:jboss/: "JBAS010471: Jndi name have to start with java:/ or java:jboss/"

In order to use unqualified relative names I have to create the file webapp/WEB-INF/jboss-web.xml like this:

<jboss-web>
    <resource-ref>
        <res-ref-name>myDatasource</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>java:jboss/myDatasource</jndi-name>
    </resource-ref>
</jboss-web>

and the persistence unit like this:

<persistence-unit name="my-pu"
       transaction-type="RESOURCE_LOCAL">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <non-jta-data-source>myDatasource</non-jta-data-source>
       (...)
   </persistence-unit> 
   
See also: https://community.jboss.org/message/632844

In conclusion I was able to use tapestry-jpa without any change.

Best resgards,
Miguel

                
> JPA and JBoss 7 datasources
> ---------------------------
>
>                 Key: TAP5-1910
>                 URL: https://issues.apache.org/jira/browse/TAP5-1910
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-jpa
>    Affects Versions: 5.3.2
>            Reporter: Miguel Figueiredo
>
> Hello,
> I am using tapestry 5.3.2 with JBoss 7, and I'm having some problems
> when using a JBoss datasource with JPA.
> My datasource configuration:
>                <datasource jta="false"
> jndi-name="java:jboss/myDatasource" pool-name="mysqlDS" enabled="true"
> use-java-context="true" use-ccm="true">
>                    (...)
>                </datasource>
> My persistence.xml configuration:
>    <persistence-unit name="my-pu"
>        transaction-type="RESOURCE_LOCAL">
>        <provider>org.hibernate.ejb.HibernatePersistence</provider>
>        <non-jta-data-source>java:jboss/myDatasource</non-jta-data-source>
>        (...)
>    </persistence-unit>
> Looking at the code in the PersistenceUnitInfoImpl of tapestry-jpa
> 5.3.2 I found the following:
>    private DataSource lookupDataSource(final String name)
>    {
>        try
>        {
>            // TODO: Create InitialContext with environment properties?
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context) initContext.lookup("java:comp/env");
>            return (DataSource) envContext.lookup(name);
>        } catch (final NamingException e)
>        {
>            throw new RuntimeException(e);
>        }
>    }
> In JBoss 7 the env context should be retrieved from java:jboss, e.g.:
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context)initContext.lookup("java:jboss");
>            return (DataSource) envContext.lookup("myDatasource");
> Maybe a datasource lookup class could be configured here.
> Best regards,
> Miguel

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TAP5-1910) JPA and JBoss 7 datasources

Posted by "Miguel Figueiredo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13280416#comment-13280416 ] 

Miguel Figueiredo commented on TAP5-1910:
-----------------------------------------

Hi again,

I guess I fiddled too much with this and made a mistake in the previous post.

Apparently I can't use the datasource definition as I described. I get the following error in JBoss:

20:47:43,900 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015863: Replacement of deployment myapp.ear" by deployment "myapp.ear" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"myapp.ear/myapp.war#my-pu\"jboss.naming.context.java.myDataSourceMissing[jboss.persistenceunit.\"myapp.ear/myapp.war#my-pu\"jboss.naming.context.java.myDataSource]"]}

As described in the JBoss documentation I need to use the qualified name.

Best regards,
Miguel
                
> JPA and JBoss 7 datasources
> ---------------------------
>
>                 Key: TAP5-1910
>                 URL: https://issues.apache.org/jira/browse/TAP5-1910
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-jpa
>    Affects Versions: 5.3.2
>            Reporter: Miguel Figueiredo
>
> Hello,
> I am using tapestry 5.3.2 with JBoss 7, and I'm having some problems
> when using a JBoss datasource with JPA.
> My datasource configuration:
>                <datasource jta="false"
> jndi-name="java:jboss/myDatasource" pool-name="mysqlDS" enabled="true"
> use-java-context="true" use-ccm="true">
>                    (...)
>                </datasource>
> My persistence.xml configuration:
>    <persistence-unit name="my-pu"
>        transaction-type="RESOURCE_LOCAL">
>        <provider>org.hibernate.ejb.HibernatePersistence</provider>
>        <non-jta-data-source>java:jboss/myDatasource</non-jta-data-source>
>        (...)
>    </persistence-unit>
> Looking at the code in the PersistenceUnitInfoImpl of tapestry-jpa
> 5.3.2 I found the following:
>    private DataSource lookupDataSource(final String name)
>    {
>        try
>        {
>            // TODO: Create InitialContext with environment properties?
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context) initContext.lookup("java:comp/env");
>            return (DataSource) envContext.lookup(name);
>        } catch (final NamingException e)
>        {
>            throw new RuntimeException(e);
>        }
>    }
> In JBoss 7 the env context should be retrieved from java:jboss, e.g.:
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context)initContext.lookup("java:jboss");
>            return (DataSource) envContext.lookup("myDatasource");
> Maybe a datasource lookup class could be configured here.
> Best regards,
> Miguel

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TAP5-1910) JPA and JBoss 7 datasources

Posted by "Miguel Figueiredo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13272683#comment-13272683 ] 

Miguel Figueiredo commented on TAP5-1910:
-----------------------------------------

Hi,

The documentation states that namespaces should follow this rule for unqualified relative names:

    Unqualified relative names like "DefaultDS" or "jdbc/DefaultDS"
    should be qualified relative to "java:comp/env", "java:module/env", or
    "java:jboss/env", depending on the context.
   (see also https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7)

But in the  configuration file (e.g. standalone.xml) I have to use either java:/ or java:jboss/: "JBAS010471: Jndi name have to start with java:/ or java:jboss/"

In order to use unqualified relative names I have to create the file webapp/WEB-INF/jboss-web.xml like this:

<jboss-web>
    <resource-ref>
        <res-ref-name>myDatasource</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>java:jboss/myDatasource</jndi-name>
    </resource-ref>
</jboss-web>

and the persistence unit like this:

<persistence-unit name="my-pu"
       transaction-type="RESOURCE_LOCAL">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <non-jta-data-source>myDatasource</non-jta-data-source>
       (...)
   </persistence-unit> 
   
See also: https://community.jboss.org/message/632844

In conclusion I was able to use tapestry-jpa without any change.

Best resgards,
Miguel

                
> JPA and JBoss 7 datasources
> ---------------------------
>
>                 Key: TAP5-1910
>                 URL: https://issues.apache.org/jira/browse/TAP5-1910
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-jpa
>    Affects Versions: 5.3.2
>            Reporter: Miguel Figueiredo
>
> Hello,
> I am using tapestry 5.3.2 with JBoss 7, and I'm having some problems
> when using a JBoss datasource with JPA.
> My datasource configuration:
>                <datasource jta="false"
> jndi-name="java:jboss/myDatasource" pool-name="mysqlDS" enabled="true"
> use-java-context="true" use-ccm="true">
>                    (...)
>                </datasource>
> My persistence.xml configuration:
>    <persistence-unit name="my-pu"
>        transaction-type="RESOURCE_LOCAL">
>        <provider>org.hibernate.ejb.HibernatePersistence</provider>
>        <non-jta-data-source>java:jboss/myDatasource</non-jta-data-source>
>        (...)
>    </persistence-unit>
> Looking at the code in the PersistenceUnitInfoImpl of tapestry-jpa
> 5.3.2 I found the following:
>    private DataSource lookupDataSource(final String name)
>    {
>        try
>        {
>            // TODO: Create InitialContext with environment properties?
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context) initContext.lookup("java:comp/env");
>            return (DataSource) envContext.lookup(name);
>        } catch (final NamingException e)
>        {
>            throw new RuntimeException(e);
>        }
>    }
> In JBoss 7 the env context should be retrieved from java:jboss, e.g.:
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context)initContext.lookup("java:jboss");
>            return (DataSource) envContext.lookup("myDatasource");
> Maybe a datasource lookup class could be configured here.
> Best regards,
> Miguel

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (TAP5-1910) JPA and JBoss 7 datasources

Posted by "Miguel Figueiredo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13280416#comment-13280416 ] 

Miguel Figueiredo commented on TAP5-1910:
-----------------------------------------

Hi again,

I guess I fiddled too much with this and made a mistake in the previous post.

Apparently I can't use the datasource definition as I described. I get the following error in JBoss:

20:47:43,900 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015863: Replacement of deployment myapp.ear" by deployment "myapp.ear" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"myapp.ear/myapp.war#my-pu\"jboss.naming.context.java.myDataSourceMissing[jboss.persistenceunit.\"myapp.ear/myapp.war#my-pu\"jboss.naming.context.java.myDataSource]"]}

As described in the JBoss documentation I need to use the qualified name.

Best regards,
Miguel
                
> JPA and JBoss 7 datasources
> ---------------------------
>
>                 Key: TAP5-1910
>                 URL: https://issues.apache.org/jira/browse/TAP5-1910
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-jpa
>    Affects Versions: 5.3.2
>            Reporter: Miguel Figueiredo
>
> Hello,
> I am using tapestry 5.3.2 with JBoss 7, and I'm having some problems
> when using a JBoss datasource with JPA.
> My datasource configuration:
>                <datasource jta="false"
> jndi-name="java:jboss/myDatasource" pool-name="mysqlDS" enabled="true"
> use-java-context="true" use-ccm="true">
>                    (...)
>                </datasource>
> My persistence.xml configuration:
>    <persistence-unit name="my-pu"
>        transaction-type="RESOURCE_LOCAL">
>        <provider>org.hibernate.ejb.HibernatePersistence</provider>
>        <non-jta-data-source>java:jboss/myDatasource</non-jta-data-source>
>        (...)
>    </persistence-unit>
> Looking at the code in the PersistenceUnitInfoImpl of tapestry-jpa
> 5.3.2 I found the following:
>    private DataSource lookupDataSource(final String name)
>    {
>        try
>        {
>            // TODO: Create InitialContext with environment properties?
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context) initContext.lookup("java:comp/env");
>            return (DataSource) envContext.lookup(name);
>        } catch (final NamingException e)
>        {
>            throw new RuntimeException(e);
>        }
>    }
> In JBoss 7 the env context should be retrieved from java:jboss, e.g.:
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context)initContext.lookup("java:jboss");
>            return (DataSource) envContext.lookup("myDatasource");
> Maybe a datasource lookup class could be configured here.
> Best regards,
> Miguel

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (TAP5-1910) JPA and JBoss 7 datasources

Posted by "Miguel Figueiredo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13272683#comment-13272683 ] 

Miguel Figueiredo edited comment on TAP5-1910 at 5/10/12 7:44 PM:
------------------------------------------------------------------

Hi,

The documentation states that namespaces should follow this rule for unqualified relative names:

    Unqualified relative names like "DefaultDS" or "jdbc/DefaultDS"
    should be qualified relative to "java:comp/env", "java:module/env", or
    "java:jboss/env", depending on the context.
   (see also https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7)

But in the  configuration file (e.g. standalone.xml) I have to use either java:/ or java:jboss/: "JBAS010471: Jndi name have to start with java:/ or java:jboss/"

In order to use unqualified relative names I have to create the file webapp/WEB-INF/jboss-web.xml like this:

<jboss-web>
    <resource-ref>
        <res-ref-name>myDatasource</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>java:jboss/myDatasource</jndi-name>
    </resource-ref>
</jboss-web>

and the persistence unit like this:

<persistence-unit name="my-pu"
       transaction-type="RESOURCE_LOCAL">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <non-jta-data-source>myDatasource</non-jta-data-source>
       (...)
   </persistence-unit> 
   
See also: https://community.jboss.org/message/632844

In conclusion I was able to use tapestry-jpa without any change.

Best regards,
Miguel

                
      was (Author: olliegator):
    Hi,

The documentation states that namespaces should follow this rule for unqualified relative names:

    Unqualified relative names like "DefaultDS" or "jdbc/DefaultDS"
    should be qualified relative to "java:comp/env", "java:module/env", or
    "java:jboss/env", depending on the context.
   (see also https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7)

But in the  configuration file (e.g. standalone.xml) I have to use either java:/ or java:jboss/: "JBAS010471: Jndi name have to start with java:/ or java:jboss/"

In order to use unqualified relative names I have to create the file webapp/WEB-INF/jboss-web.xml like this:

<jboss-web>
    <resource-ref>
        <res-ref-name>myDatasource</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <jndi-name>java:jboss/myDatasource</jndi-name>
    </resource-ref>
</jboss-web>

and the persistence unit like this:

<persistence-unit name="my-pu"
       transaction-type="RESOURCE_LOCAL">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <non-jta-data-source>myDatasource</non-jta-data-source>
       (...)
   </persistence-unit> 
   
See also: https://community.jboss.org/message/632844

In conclusion I was able to use tapestry-jpa without any change.

Best resgards,
Miguel

                  
> JPA and JBoss 7 datasources
> ---------------------------
>
>                 Key: TAP5-1910
>                 URL: https://issues.apache.org/jira/browse/TAP5-1910
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-jpa
>    Affects Versions: 5.3.2
>            Reporter: Miguel Figueiredo
>
> Hello,
> I am using tapestry 5.3.2 with JBoss 7, and I'm having some problems
> when using a JBoss datasource with JPA.
> My datasource configuration:
>                <datasource jta="false"
> jndi-name="java:jboss/myDatasource" pool-name="mysqlDS" enabled="true"
> use-java-context="true" use-ccm="true">
>                    (...)
>                </datasource>
> My persistence.xml configuration:
>    <persistence-unit name="my-pu"
>        transaction-type="RESOURCE_LOCAL">
>        <provider>org.hibernate.ejb.HibernatePersistence</provider>
>        <non-jta-data-source>java:jboss/myDatasource</non-jta-data-source>
>        (...)
>    </persistence-unit>
> Looking at the code in the PersistenceUnitInfoImpl of tapestry-jpa
> 5.3.2 I found the following:
>    private DataSource lookupDataSource(final String name)
>    {
>        try
>        {
>            // TODO: Create InitialContext with environment properties?
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context) initContext.lookup("java:comp/env");
>            return (DataSource) envContext.lookup(name);
>        } catch (final NamingException e)
>        {
>            throw new RuntimeException(e);
>        }
>    }
> In JBoss 7 the env context should be retrieved from java:jboss, e.g.:
>            final Context initContext = new InitialContext();
>            final Context envContext = (Context)initContext.lookup("java:jboss");
>            return (DataSource) envContext.lookup("myDatasource");
> Maybe a datasource lookup class could be configured here.
> Best regards,
> Miguel

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira