Error getting JDBC connection: Failed to secure transaction while entering metasave object

I am having a problem connecting to JDBC's EJB SessionBean. Error:

org.jboss.util.NestedSQLException: Failed to secure transaction while entering meta-discovery object !; - inested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to attract a resource, see previous warnings.

I thought this was happening because I already have an open connection to another data source, so I configured the XA data source to avoid transaction problems, but it doesn’t work at all, so I don’t know if I am doing something not so in my code. There he is:

  try 
    {
        Properties p = new Properties();
        p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
        p.put(Context.PROVIDER_URL,"jnp://localhost:11099");
        p.put("java.naming.factory.url.pkgs", "org.jboss.naming");

        InitialContext ic = new InitialContext(p);

        DataSource dataSource = (DataSource)ic.lookup("java:/jdbc/etlreportservices");

        return dataSource.getConnection();
    }
    catch(Exception e)
    {
        e.printStackTrace();
    }

An exception is thrown when called dataSource.getConnection().

+3
4

bean -managed, .

-3

, Jboss-es: /server/all/conf/jbossjta -properties.xml

<properties depends="arjuna" name="jta">
   <property name="com.arjuna.ats.jta.allowMultipleLastResources" value="true"/>
</properties>

: standalone\configuration\standalone.xml( , )

<system-properties>
    <property name="com.arjuna.ats.arjuna.allowMultipleLastResources"   value="true"/>
</system-properties>  
+5

, tx. FWIW.

+1

JBoss 6.0.0, :

: org.jboss.resource.JBossResourceException: meta-aware!


:

, XA. JBoss.

, JBoss 6.0.0.


, , XA. bean , . , CodeRanch JBoss .

0

Source: https://habr.com/ru/post/1767280/


All Articles