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

Hibernate Java Discussion :

connection pool size


Sujet :

Hibernate Java

  1. #1
    Membre éclairé
    Avatar de natoine
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Décembre 2007
    Messages
    393
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Chercheur en informatique

    Informations forums :
    Inscription : Décembre 2007
    Messages : 393
    Par défaut connection pool size
    J'ai testé mon appli vendredi dernier avec 30 utilisateurs en même temps.
    Je fais de la persistence via hibernate mais dans des portlets (pour ceux qui ne connaissent pas les portlets, c'est très proche des servlets).
    Donc en gros, j'ai eu 30 utilisateurs qui ont utilisé en même temps la même instance de portlet avec chacun une session différente.
    Du coup, j'ai eu à peu prés 30 connections en même temps à ma base de données mysql.
    Et il y a eu un probléme.
    C'était trés lent dés que une requête hibernate était envoyée et au bout d'un moment, à peu prés 30 minutes, la connection à la base de données est devenue impossible.

    Donc je regardais la doc d'hibernate et je me suis dit que ça devait être l'option connection.pool_size dans mon hibernate.cfg.xml qui était mal définie.
    Lors de l'expérimentation, la valeur était définie à 1.
    Je pense donc la passer à plus de 30 pour la suite.

    Est-ce bien ce qu'il faut faire ?
    Est-ce que 100 est une trop grosse valeur (est-ce qu'il y a une valeur limite en gros) ?
    Quelles sont les conséquences de l'augmentation de cette valeur ?
    www.natoine.fr
    natoine.developpez.com
    Principalement du Java avec un soupçon de réseaux sociaux.

  2. #2
    Expert confirmé
    Avatar de sinok
    Profil pro
    Inscrit en
    Août 2004
    Messages
    8 765
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Août 2004
    Messages : 8 765
    Par défaut
    Le mieux est de définir la pool size au niveau du serveur via le pool de connexions de la data source.
    En effet cela permet de s'abstraire de la configuration de l'application.

    Ensuite, le pool size dépend des capacités de ton serveur mysql. Un bon nombre de paramètre entrent en considération, OS, type de CPU, nombre de CPU/Core, mémoire allouée.

    Le mieux est d'y aller par méthode empirique à partir d'une valeur de base dans les 10-20.

    Toutefois, allouer un grand nombre de connections dans le pool (une centaine ou plus) a tendance à donner de mauvais résultats en général, en effet ça a tendance à saturer le SGBD au lieu du serveur java, ce qui revient au même.

    La solution idéale étant d'équilibrer la charge entre les deux.

    Pour le moment contente toi de commencer vers 15/20, si tu vois que ça déroule sans le moindre accroc sur la charge standard attentue, essaie de descendre ce nombre au fur et à mesure pour estimer le nombre minimal de connections à maintenir dans le pool. Si ça rame à 15/20, il faut à ce moment déterminer où se trouve la charge, ie sur le serveur d'appli ou sur le serveur SGBD. Suivant le cas il faudra augmenter ou diminuer le nombre de connexions qui sont dans le pool.

  3. #3
    Rédacteur

    Homme Profil pro
    Consultant informatique
    Inscrit en
    Août 2002
    Messages
    359
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Consultant informatique

    Informations forums :
    Inscription : Août 2002
    Messages : 359
    Par défaut
    Citation Envoyé par sinok Voir le message
    Le mieux est de définir la pool size au niveau du serveur via le pool de connexions de la data source.
    En effet cela permet de s'abstraire de la configuration de l'application.

    Ensuite, le pool size dépend des capacités de ton serveur mysql. Un bon nombre de paramètre entrent en considération, OS, type de CPU, nombre de CPU/Core, mémoire allouée.
    Je confirme, il vaut mieux utiliser le pool de connexion du serveur d'application si tu en a un.

    D'ailleur red hat/Jboss le confirme aussi

    Hibernate's own connection pooling algorithm is, however, quite rudimentary. It is intended to help you get started and is not intended for use in a production system, or even for performance testing. You should use a third party pool for best performance and stability
    .

  4. #4
    Membre éclairé
    Avatar de natoine
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Décembre 2007
    Messages
    393
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Chercheur en informatique

    Informations forums :
    Inscription : Décembre 2007
    Messages : 393
    Par défaut
    Merci pour vos réponses.
    Je passe à 15 pour l'instant.

    Par contre, pour utiliser le pool de connection du serveur, il faut mettre quoi dans hibernate.cfg.xml du coup ?
    www.natoine.fr
    natoine.developpez.com
    Principalement du Java avec un soupçon de réseaux sociaux.

  5. #5
    Membre Expert
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 276
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 276
    Par défaut
    Rien, c'est ton serveur d'application qu'il faut paramétrer.

  6. #6
    Expert confirmé
    Avatar de sinok
    Profil pro
    Inscrit en
    Août 2004
    Messages
    8 765
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Août 2004
    Messages : 8 765
    Par défaut
    C'est le serveur qui gère tout ça via la datasource, il te faut juste pointer sur la datasource au niveau du hibernate.cfg.xml

    La doc sur le pooling jdbc de mysql: http://dev.mysql.com/tech-resources/...onnectorj.html

    Ensuite ton pool se configure différemment suivant les serveurs d'appli.

    Sous quoi tournes tu?

  7. #7
    Membre éclairé
    Avatar de natoine
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Décembre 2007
    Messages
    393
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Chercheur en informatique

    Informations forums :
    Inscription : Décembre 2007
    Messages : 393
    Par défaut
    J'ai déployé mes portlets dans un jboss portal sur une machine linux.
    La distrib je crois que c'est une Red Hat.
    C'est pas moi le responsable du serveur ^^
    www.natoine.fr
    natoine.developpez.com
    Principalement du Java avec un soupçon de réseaux sociaux.

  8. #8
    Expert confirmé
    Avatar de sinok
    Profil pro
    Inscrit en
    Août 2004
    Messages
    8 765
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Août 2004
    Messages : 8 765
    Par défaut
    La configuration du pool size se fait dans JBoss dans ce cas.

    Cadeau: http://community.jboss.org/wiki/configdatasources

    Par défaut le pool size est configuré à 20 pour une datasource standard sous JBoss.

    Utilises tu une datasource à l'heure actuelle?

  9. #9
    Membre éclairé
    Avatar de natoine
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Décembre 2007
    Messages
    393
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Chercheur en informatique

    Informations forums :
    Inscription : Décembre 2007
    Messages : 393
    Par défaut
    Arf non pas encore.
    Je viens à peine d'en entendre parler
    Je vais éplucher les liens que vous m'avez filé et je reviendrai dire ce que j'en ai compris.
    Merci.
    www.natoine.fr
    natoine.developpez.com
    Principalement du Java avec un soupçon de réseaux sociaux.

  10. #10
    Membre éclairé
    Avatar de natoine
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Décembre 2007
    Messages
    393
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Chercheur en informatique

    Informations forums :
    Inscription : Décembre 2007
    Messages : 393
    Par défaut
    Bon ben j'ai lu.
    Je comprends pas tout.
    Déjà à cette url http://community.jboss.org/wiki/SetUpAMysqlDatasource
    ils parlent d'éditer un fichier mysql-ds.xml file
    Sauf que je n'ai pas de tel fichier dans mon install de JBoss (dernière version de JBoss Portal mais pas Gatein).
    Par contre j'ai un fichier hsqldb-ds.xml qui ressemble à ce que je m'attends à trouver dans mysql-ds.xml et qui est dans /server/default/deploy. Donc je vais tenter d'éditer ce fichier...
    www.natoine.fr
    natoine.developpez.com
    Principalement du Java avec un soupçon de réseaux sociaux.

  11. #11
    Expert confirmé
    Avatar de sinok
    Profil pro
    Inscrit en
    Août 2004
    Messages
    8 765
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Août 2004
    Messages : 8 765
    Par défaut
    Ouais sauf que tu utilises Portal, donc les instructions diffèrent légèrement en fait

    http://docs.jboss.org/jbportal/v2.6....on.html#d0e739

  12. #12
    Membre éclairé
    Avatar de natoine
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Décembre 2007
    Messages
    393
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Chercheur en informatique

    Informations forums :
    Inscription : Décembre 2007
    Messages : 393
    Par défaut
    Arf j'avais zappé une info.
    Donc j'ai bien un fichier mysql-ds.xml dans /JBOSS_HOME/docs/examples/jca
    J'édite ce fichier et je le copie colle dans /JBOSS_HOME/server/default/deploy

    Voilà le contenu de mon fichier mysql-ds.xml :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
     
    <?xml version="1.0" encoding="UTF-8"?>
     
    <!-- $Id: mysql-ds.xml 71535 2008-04-01 07:05:03Z adrian@jboss.org $ -->
    <!--  Datasource config for MySQL using 3.0.9 available from:
    http://www.mysql.com/downloads/api-jdbc-stable.html
    -->
     
    <datasources>
      <local-tx-datasource>
        <jndi-name>natoine_annotations</jndi-name>
        <connection-url>jdbc:mysql://localhost/jboss_natoine_db</connection-url>
        <driver-class>com.mysql.jdbc.Driver</driver-class>
        <user-name>jboss_user</user-name>
         <password>jboss_pwd</password>
        <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
        <connection-property name="autoReconnect">true</connection-property>
       <!--pooling parameters-->
        <min-pool-size>5</min-pool-size>
        <max-pool-size>100</max-pool-size>
        <!-- should only be used on drivers after 3.22.1 with "ping" support
        <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
        -->
        <!-- sql to call when connection is created
        <new-connection-sql>some arbitrary sql</new-connection-sql>
          -->
        <!-- sql to call on an existing pooled connection when it is obtained from pool - MySQLValidConnectionChecker is preferred for newer drivers
        <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
          -->
     
        <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
        <metadata>
           <type-mapping>mySQL</type-mapping>
        </metadata>
      </local-tx-datasource>
    </datasources>
    www.natoine.fr
    natoine.developpez.com
    Principalement du Java avec un soupçon de réseaux sociaux.

  13. #13
    Membre éclairé
    Avatar de natoine
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Décembre 2007
    Messages
    393
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Chercheur en informatique

    Informations forums :
    Inscription : Décembre 2007
    Messages : 393
    Par défaut
    Ok pour le datasource.
    Ca semble bon.
    Par contre après, je mets quoi dans mon hibernate.cfg.xml ?
    Je suppose que je n'ai plus besoin de :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
            <!-- MySQL connection settings -->
            <property name="connection.url">jdbc:mysql://localhost/jboss_natoine_db?autoReconnect=true</property>
            <property name="connection.username">jboss_user</property>
            <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
            <property name="connection.password">jboss_pwd</property>
            <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
    Et que je dois pouvoir me contenter de référencer ma datasource non ?
    www.natoine.fr
    natoine.developpez.com
    Principalement du Java avec un soupçon de réseaux sociaux.

  14. #14
    Membre éclairé
    Avatar de natoine
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Décembre 2007
    Messages
    393
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Chercheur en informatique

    Informations forums :
    Inscription : Décembre 2007
    Messages : 393
    Par défaut
    Donc j'ai trouvé pour hibernate.cfg.xml, il faut mettre :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <property name="connection.datasource">MaDS</property>
    En l'occurence, j'ai appelé ma DS : DSnatoine_annotations

    Sauf que j'ai une erreur :
    11:26:50,806 ERROR [DatasourceConnectionProvider] Could not find datasource: DSnatoine_annotations
    javax.naming.NameNotFoundException: DSnatoine_annotations not bound
    at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
    at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
    at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
    at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
    at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
    at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)
    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
    at fr.natoine.controler.annotation.CreateAnnotationStatus.setEMF(CreateAnnotationStatus.java:45)
    at fr.natoine.controler.annotation.CreateAnnotationStatus.createAnnotationStatus(CreateAnnotationStatus.java:235)
    at fr.natoine.controler.annotation.CreateAnnotationStatus.createSimpleCommentStatus(CreateAnnotationStatus.java:75)
    at fr.natoine.PortletAnnotation.PortletCreateAnnotation.init(PortletCreateAnnotation.java:146)
    at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.initPortlet(PortletContainerImpl.java:417)
    at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:256)
    at org.jboss.portal.portlet.impl.container.PortletContainerLifeCycle.invokeStart(PortletContainerLifeCycle.java:76)
    at org.jboss.portal.portlet.impl.container.LifeCycle.managedStart(LifeCycle.java:92)
    at org.jboss.portal.portlet.impl.container.PortletApplicationLifeCycle.startDependents(PortletApplicationLifeCycle.java:351)
    at org.jboss.portal.portlet.impl.container.LifeCycle.managedStart(LifeCycle.java:128)
    at org.jboss.portal.portlet.deployment.jboss.PortletAppDeployment.start(PortletAppDeployment.java:226)
    at org.jboss.portal.core.deployment.jboss.PortletAppDeployment.start(PortletAppDeployment.java:94)
    at org.jboss.portal.server.deployment.jboss.DeploymentContext.start(DeploymentContext.java:99)
    at org.jboss.portal.server.deployment.jboss.PortalDeploymentInfoContext.start(PortalDeploymentInfoContext.java:220)
    at org.jboss.portal.server.deployment.jboss.ServerDeployer.start(ServerDeployer.java:217)
    at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
    at sun.reflect.GeneratedMethodAccessor205.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
    at $Proxy222.deploy(Unknown Source)
    at org.jboss.portal.server.deployment.jboss.ServerDeployer.deploy(ServerDeployer.java:259)
    at org.jboss.portal.server.deployment.WebAppAdapter.deploy(WebAppAdapter.java:53)
    at org.jboss.portal.server.deployment.WebAppIntercepter.handleNotification(WebAppIntercepter.java:159)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:153)
    at $Proxy224.handleNotification(Unknown Source)
    at org.jboss.mx.util.JBossNotificationBroadcasterSupport.handleNotification(JBossNotificationBroadcasterSupport.java:127)
    at org.jboss.mx.util.JBossNotificationBroadcasterSupport.sendNotification(JBossNotificationBroadcasterSupport.java:108)
    at org.jboss.deployment.SubDeployerSupport.emitNotification(SubDeployerSupport.java:340)
    at org.jboss.deployment.SubDeployerSupport.start(SubDeployerSupport.java:308)
    at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:482)
    at sun.reflect.GeneratedMethodAccessor105.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
    at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
    at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
    at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
    at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
    at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
    at $Proxy202.start(Unknown Source)
    at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
    at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
    at $Proxy9.deploy(Unknown Source)
    at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
    at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
    11:26:50,812 ERROR [LifeCycle] Cannot start object
    org.jboss.portal.portlet.container.PortletInitializationException: The portlet PortletCreateAnnotation threw a runtime exception during init
    at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:288)
    at org.jboss.portal.portlet.impl.container.PortletContainerLifeCycle.invokeStart(PortletContainerLifeCycle.java:76)
    at org.jboss.portal.portlet.impl.container.LifeCycle.managedStart(LifeCycle.java:92)
    at org.jboss.portal.portlet.impl.container.PortletApplicationLifeCycle.startDependents(PortletApplicationLifeCycle.java:351)
    at org.jboss.portal.portlet.impl.container.LifeCycle.managedStart(LifeCycle.java:128)
    at org.jboss.portal.portlet.deployment.jboss.PortletAppDeployment.start(PortletAppDeployment.java:226)
    at org.jboss.portal.core.deployment.jboss.PortletAppDeployment.start(PortletAppDeployment.java:94)
    at org.jboss.portal.server.deployment.jboss.DeploymentContext.start(DeploymentContext.java:99)
    at org.jboss.portal.server.deployment.jboss.PortalDeploymentInfoContext.start(PortalDeploymentInfoContext.java:220)
    at org.jboss.portal.server.deployment.jboss.ServerDeployer.start(ServerDeployer.java:217)
    at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
    at sun.reflect.GeneratedMethodAccessor205.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
    at $Proxy222.deploy(Unknown Source)
    at org.jboss.portal.server.deployment.jboss.ServerDeployer.deploy(ServerDeployer.java:259)
    at org.jboss.portal.server.deployment.WebAppAdapter.deploy(WebAppAdapter.java:53)
    at org.jboss.portal.server.deployment.WebAppIntercepter.handleNotification(WebAppIntercepter.java:159)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:153)
    at $Proxy224.handleNotification(Unknown Source)
    at org.jboss.mx.util.JBossNotificationBroadcasterSupport.handleNotification(JBossNotificationBroadcasterSupport.java:127)
    at org.jboss.mx.util.JBossNotificationBroadcasterSupport.sendNotification(JBossNotificationBroadcasterSupport.java:108)
    at org.jboss.deployment.SubDeployerSupport.emitNotification(SubDeployerSupport.java:340)
    at org.jboss.deployment.SubDeployerSupport.start(SubDeployerSupport.java:308)
    at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:482)
    at sun.reflect.GeneratedMethodAccessor105.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
    at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
    at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
    at org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
    at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
    at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
    at $Proxy202.start(Unknown Source)
    at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
    at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
    at $Proxy9.deploy(Unknown Source)
    at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
    at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
    at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
    Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not find datasource
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:720)
    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
    at fr.natoine.controler.annotation.CreateAnnotationStatus.setEMF(CreateAnnotationStatus.java:45)
    at fr.natoine.controler.annotation.CreateAnnotationStatus.createAnnotationStatus(CreateAnnotationStatus.java:235)
    at fr.natoine.controler.annotation.CreateAnnotationStatus.createSimpleCommentStatus(CreateAnnotationStatus.java:75)
    at fr.natoine.PortletAnnotation.PortletCreateAnnotation.init(PortletCreateAnnotation.java:146)
    at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.initPortlet(PortletContainerImpl.java:417)
    at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:256)
    ... 76 more
    Caused by: org.hibernate.HibernateException: Could not find datasource
    at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
    at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
    at org.hibernate.ejb.InjectionSettingsFactory.createConnectionProvider(InjectionSettingsFactory.java:29)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)
    ... 85 more
    Caused by: javax.naming.NameNotFoundException: DSnatoine_annotations not bound
    at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
    at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
    at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
    at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
    ... 91 more
    Donc j'ai un problème dans ma DS ou dans l'emplacement de mon fichier mysql-ds.xml
    www.natoine.fr
    natoine.developpez.com
    Principalement du Java avec un soupçon de réseaux sociaux.

  15. #15
    Expert confirmé
    Avatar de sinok
    Profil pro
    Inscrit en
    Août 2004
    Messages
    8 765
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Août 2004
    Messages : 8 765
    Par défaut
    Sauf que tu n'as pas lu le lien que je t'ai donné lors de ma dernière réponse.

    En effet dans ce document le nom du fichier de conf de la datasource ne s'appelle pas mysql-ds.xm.

    Donc je te conseille de suivre au pied de la lettre la doc portal pour commencer, avant de t'embarquer dans la doc JBoss.

    Puis as tu redémarré ton JBoss depuis l'ajout du fichier, (bon je ne connais pas des masses JBoss, mais un paquet d'autres serveurs d'applis demandent un redémarrage pour que la DS soit correctement propagée/activée...)

  16. #16
    Membre éclairé
    Avatar de natoine
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Décembre 2007
    Messages
    393
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Chercheur en informatique

    Informations forums :
    Inscription : Décembre 2007
    Messages : 393
    Par défaut
    Ah ouais j'avais pas fait gaffe au nom de fichier.
    En plus il y a un portal-mysql et un portal-mysql5 ...
    www.natoine.fr
    natoine.developpez.com
    Principalement du Java avec un soupçon de réseaux sociaux.

  17. #17
    Membre éclairé
    Avatar de natoine
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Décembre 2007
    Messages
    393
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Chercheur en informatique

    Informations forums :
    Inscription : Décembre 2007
    Messages : 393
    Par défaut
    J'ai lu la doc JBoss Portal.
    En fait que le fichier commence par portal ou pas on s'en fiche.
    Ce qui compte c'est que le fichier termine par -ds.xml
    Quand je déploie mon fichier -ds.xml, le serveur me répond bien dans les logs :
    11:54:18,655 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DSnatoine_annotations' to JNDI name 'javaSnatoine_annotations'
    Bon ben ça marche, mon dernier problème en fait, dans la déclaration de la datasource, on met ce qu'on veut mais dans le fichier hibernate.cfg.xml, il faut ajouter java:
    Exemple :
    Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
    <property name="connection.datasource">java:DSnatoine_annotations</property>

    Merci pour votre aide en tout cas.
    www.natoine.fr
    natoine.developpez.com
    Principalement du Java avec un soupçon de réseaux sociaux.

  18. #18
    Expert confirmé
    Avatar de sinok
    Profil pro
    Inscrit en
    Août 2004
    Messages
    8 765
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Août 2004
    Messages : 8 765
    Par défaut
    A toi ensuite d'adapter les max-pool-size et min-pool-size pour obtenir la charge la moindre possible.

    En général il n'est pas besoin d'avoir autant de connexions que de user connectés.

  19. #19
    Membre éclairé
    Avatar de natoine
    Homme Profil pro
    Chercheur en informatique
    Inscrit en
    Décembre 2007
    Messages
    393
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Chercheur en informatique

    Informations forums :
    Inscription : Décembre 2007
    Messages : 393
    Par défaut
    En fait je ne sais pas combien j'aurai d'utilisateurs au maximum.
    Vendredi dernier on avait un test avec 30 utilisateurs mais à terme on espère en avoir beaucoup ^^

    Merci pour votre aide en tout cas, problème résolu.
    www.natoine.fr
    natoine.developpez.com
    Principalement du Java avec un soupçon de réseaux sociaux.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 6
    Dernier message: 27/04/2009, 13h58
  2. Réponses: 9
    Dernier message: 27/04/2009, 13h58
  3. [JDBC][SQL Server]Connection Pooling
    Par WE dans le forum JDBC
    Réponses: 4
    Dernier message: 14/03/2006, 09h15
  4. [connection pool]commons DBCP
    Par horalass dans le forum JDBC
    Réponses: 2
    Dernier message: 20/12/2005, 11h02
  5. [Oracle 8i][Internet] Shared Pool Size
    Par dupin40 dans le forum Administration
    Réponses: 39
    Dernier message: 04/11/2004, 12h39

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