IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Wildfly/JBoss Java Discussion :

Jboss 4.2.0GA / EJB2Entities / MySQL 4


Sujet :

Wildfly/JBoss Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    104
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2007
    Messages : 104
    Par défaut Jboss 4.2.0GA / EJB2Entities / MySQL 4
    Mon application fonctionne correctement avec la datasource mysql suivante sous JBoss 4.0.0 mais génère l'erreur suivante sous JBoss 4.2.0GA :
    <<
    Caused by: org.jboss.util.NestedSQLException: Could not enlist in transaction on
    entering meta-aware object!; - nested throwable: (javax.transaction.SystemExcep
    tion: java.lang.Throwable: Unabled to enlist resource, see the previous warnings
    . tx=TransactionImple < ac, BasicAction: ae10719:12c2:4666ed28:4b status: Action
    Status.ABORT_ONLY >); - nested throwable: (org.jboss.resource.JBossResourceExcep
    tion: Could not enlist in transaction on entering meta-aware object!; - nested t
    hrowable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to en
    list resource, see the previous warnings. tx=TransactionImple < ac, BasicAction:
    ae10719:12c2:4666ed28:4b status: ActionStatus.ABORT_ONLY >))
    at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(Wrapp
    erDataSource.java:94)
    at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadRelationCommand.execute(JDBCLo
    adRelationCommand.java:96)
    ... 194 more
    Caused by: org.jboss.resource.JBossResourceException: Could not enlist in transa
    ction on entering meta-aware object!; - nested throwable: (javax.transaction.Sys
    temException: java.lang.Throwable: Unabled to enlist resource, see the previous
    warnings. tx=TransactionImple < ac, BasicAction: ae10719:12c2:4666ed28:4b status
    : ActionStatus.ABORT_ONLY >)
    at org.jboss.resource.connectionmanager.TxConnectionManager.managedConne

    >>

    Ceci se produit lors de l'accès à via EJB Entité à la DB MySQL.

    myapp-ds.xml
    ---
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- ==================================================================== -->
    <!-- Datasource config for MyApp -->
    <!-- ==================================================================== -->
    <datasources>
    <local-tx-datasource>
    <jndi-name>MyApp_RW_DS</jndi-name>
    <connection-url>jdbc:mysql://localhost/myApp</connection-url>
    <driver-class>org.gjt.mm.mysql.Driver</driver-class>
    <transaction-isolation>TRANSACTION_REPEATABLE_READ</transaction-isolation>
    <user-name>root</user-name>
    <password></password>
    <min-pool-size>20</min-pool-size>
    <max-pool-size>500</max-pool-size>
    </local-tx-datasource>

    <local-tx-datasource>
    <jndi-name>MyApp_RO_DS</jndi-name>
    <connection-url>jdbc:mysql://localhost/myApp</connection-url>
    <driver-class>org.gjt.mm.mysql.Driver</driver-class>
    <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
    <user-name>root</user-name>
    <password></password>
    <min-pool-size>20</min-pool-size>
    <max-pool-size>500</max-pool-size>
    </local-tx-datasource>
    </datasources>
    ---

    Ajout effectué dans standardjboss.xml du répertoire conf de jboss :
    <<

    <!-- begin myapp-j2ee specific -->
    <container-configuration>
    <container-name>MyApp CMP 2.x READ-ONLY ETB</container-name>
    <call-logging>false</call-logging>
    <invoker-proxy-binding-name>entity-rmi-invoker</invoker-proxy-binding-name>
    <sync-on-commit-only>false</sync-on-commit-only>
    <container-interceptors>
    <interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.SecurityInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
    <interceptor metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.EntityLockInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.EntityInstanceInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.EntityReentranceInterceptor</interceptor>
    <interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.EntitySynchronizationInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor</interceptor>
    </container-interceptors>
    <instance-pool>org.jboss.ejb.plugins.EntityInstancePool</instance-pool>
    <instance-cache>org.jboss.ejb.plugins.InvalidableEntityInstanceCache</instance-cache>
    <persistence-manager>org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager</persistence-manager>
    <locking-policy>org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock</locking-policy>
    <container-cache-conf>
    <cache-policy>org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy</cache-policy>
    <cache-policy-conf>
    <min-capacity>100</min-capacity>
    <max-capacity>1000000</max-capacity>
    <overager-period>300</overager-period>
    <max-bean-age>600</max-bean-age>
    <resizer-period>400</resizer-period>
    <max-cache-miss-period>60</max-cache-miss-period>
    <min-cache-miss-period>1</min-cache-miss-period>
    <cache-load-factor>0.75</cache-load-factor>
    </cache-policy-conf>
    </container-cache-conf>
    <container-pool-conf>
    <MaximumSize>100</MaximumSize>
    </container-pool-conf>
    <commit-option>A</commit-option>
    </container-configuration>

    <container-configuration>
    <container-name>MyApp CMP 2.x EntityBean with cache invalidation and IPT</container-name>
    <call-logging>false</call-logging>
    <invoker-proxy-binding-name>entity-rmi-invoker</invoker-proxy-binding-name>
    <container-interceptors>
    <interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.SecurityInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
    <interceptor metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.EntityCreationInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.EntityLockInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.EntityInstanceInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.EntityReentranceInterceptor</interceptor>
    <interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.EntitySynchronizationInterceptor</interceptor>
    <!--interceptor>org.jboss.ejb.plugins.EntityMultiInstanceSynchronizationInterceptor</interceptor-->
    <interceptor>org.jboss.cache.invalidation.triggers.EntityBeanCacheBatchInvalidatorInterceptor</interceptor>
    <interceptor>org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor</interceptor>
    </container-interceptors>
    <instance-pool>org.jboss.ejb.plugins.EntityInstancePool</instance-pool>
    <instance-cache>org.jboss.ejb.plugins.PerTxEntityInstanceCache</instance-cache>
    <persistence-manager>org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager</persistence-manager>
    <!--locking-policy>org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock</locking-policy-->
    <locking-policy>org.jboss.ejb.plugins.lock.NoLock</locking-policy>
    <container-cache-conf/>
    <container-pool-conf>
    <MaximumSize>100</MaximumSize>
    </container-pool-conf>
    <commit-option>C</commit-option>
    </container-configuration>
    <!-- end myapp-j2ee specific -->

    >>

    La base de donnée étant du MySQL 4 et celle-ci ne fonctionnant pas à priori en mode XA, y a t il un moyen de contournement ?

  2. #2
    Membre émérite Avatar de XmasRock
    Inscrit en
    Janvier 2007
    Messages
    729
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 729
    Par défaut
    Quel utilisation fais-tu de tes datasources ?
    Montres-nous le code et dis nous plus généralement le genre de décisions d'archi prises.

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    104
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2007
    Messages : 104
    Par défaut
    La datasource est utilisé directement via les EJB entités de mon application.

    Extrait jboss.xml d'un des fichiers jar des ejbs
    <<
    <entity>
    <ejb-name>Codifications</ejb-name>
    <local-jndi-name>com/myapp/CodificationsLocal/ReadOnly</local-jndi-name>
    <read-only>true</read-only>
    <configuration-name>MyApp CMP 2.x READ-ONLY ETB</configuration-name>

    <method-attributes>
    </method-attributes>

    <cache-invalidation>true</cache-invalidation>
    </entity>
    >>

    Extrait jbosscmp.xml du même fichier jar
    <<
    <enterprise-beans>

    <!--
    To add beans that you have deployment descriptor info for, add
    a file to your XDoclet merge directory called jbosscmp-jdbc-beans.xml
    that contains the <entity></entity> markup for those beans.
    -->

    <entity>
    <ejb-name>Codifications</ejb-name>
    <datasource>java:/myApp_RO_DS</datasource>
    <datasource-mapping>mySQL</datasource-mapping>
    <create-table>true</create-table>
    <remove-table>false</remove-table>

    <read-only>true</read-only>
    <table-name>CODIFICATIONS</table-name>

    <cmp-field>
    <field-name>id</field-name>
    <column-name>ID</column-name>

    <jdbc-type>BIGINT</jdbc-type>
    <sql-type>BIGINT</sql-type>

    <auto-increment/>
    </cmp-field>
    <cmp-field>
    <field-name>language</field-name>
    <column-name>LANGUAGE</column-name>

    <jdbc-type>VARCHAR</jdbc-type>
    <sql-type>TEXT</sql-type>

    </cmp-field>
    <cmp-field>
    <field-name>source</field-name>
    <column-name>SOURCE</column-name>

    <jdbc-type>VARCHAR</jdbc-type>
    <sql-type>TEXT</sql-type>

    </cmp-field>

    <unknown-pk>
    <unknown-pk-class>java.lang.Long</unknown-pk-class>
    <column-name>ID</column-name>
    <auto-increment/>
    </unknown-pk>
    <entity-command name="mysql-get-generated-keys">
    </entity-command>
    <!-- jboss 3.2 features -->
    <!-- optimistic locking does not express the exclusions needed -->
    </entity>
    >>
    Au démarrage du serveur les ejbs sont correctements déployés, l'application charge une servlet qui appelle un EJB Session statless (transaction de type required) et ce session effectue un finder sur un ejb entité afin de retourner une collection, c'est ce finder qui pose problème et qui génère l'erreur sous jboss 4.2.0 GA.


    Avez-vous besoin de plus d'infos ?

  4. #4
    Membre émérite Avatar de XmasRock
    Inscrit en
    Janvier 2007
    Messages
    729
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 729
    Par défaut
    Si tu utilises deux datasources pour augmenter la concurrence, il faut que tu fasses bien attention à séparer les utilisations (methodes en lecture exclusivement, et methodes en lecture/ecriture avec un nouveau jeu de composants) pour ne pas faire de transactions qui mixent les deux.

  5. #5
    Membre confirmé
    Profil pro
    Inscrit en
    Mai 2007
    Messages
    104
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2007
    Messages : 104
    Par défaut
    Le code utilisé justement au démarrage ne mixe pas les 2 types d'accès. On utilise du R/O exclusivement dans ce session.

  6. #6
    Membre émérite Avatar de XmasRock
    Inscrit en
    Janvier 2007
    Messages
    729
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 729
    Par défaut
    at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadRelationCommand.execute(JDBCLo
    adRelationCommand.java:96)
    Même dans tous les beans en relation ?

Discussions similaires

  1. JBoss EJB3 avec une DB Mysql
    Par omoumnia dans le forum Wildfly/JBoss
    Réponses: 2
    Dernier message: 08/03/2011, 15h14
  2. Myface 1.2.x(x=6 àx=8) JBoss 5.1.0GA
    Par AmFaye dans le forum JSF
    Réponses: 0
    Dernier message: 21/04/2010, 13h00
  3. JBoss 5.1.0GA et Myface1.2.x
    Par AmFaye dans le forum Wildfly/JBoss
    Réponses: 1
    Dernier message: 20/04/2010, 19h47
  4. ClassCastException avec JBoss 5.1.0GA
    Par krum dans le forum Wildfly/JBoss
    Réponses: 0
    Dernier message: 31/07/2009, 10h10
  5. [Jboss][ mysql] : Comment configurer ?
    Par PeteMitchell dans le forum Wildfly/JBoss
    Réponses: 3
    Dernier message: 02/03/2004, 14h21

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo