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

JOnAS Java Discussion :

[JDBC] Problème d'accès à la base de données


Sujet :

JOnAS Java

  1. #1
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2011
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2011
    Messages : 6
    Points : 6
    Points
    6
    Par défaut [JDBC] Problème d'accès à la base de données
    Bonjour,

    j'essaie de porter une application web déployée sous tomcat vers un serveur d'application JOnAS mais lorsque je lance l'application, j'obtiens l'erreur suivante:

    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
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
     
    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.exception.JDBCConnectionException: Cannot open connection
    	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:886)
    	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:790)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
     
    root cause
     
    org.hibernate.exception.JDBCConnectionException: Cannot open connection
    	org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:97)
    	org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
    	org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
    	org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
    	org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
    	org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142)
    	org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)
    	org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1354)
    	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	java.lang.reflect.Method.invoke(Method.java:601)
    	org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:342)
    	$Proxy61.beginTransaction(Unknown Source)
    	dao.CategorieDAO.getListCategorie(CategorieDAO.java:28)
    	controleurs.Connect.connexion(Connect.java:82)
    	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	java.lang.reflect.Method.invoke(Method.java:601)
    	org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:471)
    	org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:408)
    	org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
    	org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900)
    	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
    	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:874)
    	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:790)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
     
    root cause
     
    java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@localhost:1521:XE
    	java.sql.DriverManager.getConnection(DriverManager.java:604)
    	java.sql.DriverManager.getConnection(DriverManager.java:190)
    	org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
    	org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
    	org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
    	org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142)
    	org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)
    	org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1354)
    	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	java.lang.reflect.Method.invoke(Method.java:601)
    	org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:342)
    	$Proxy61.beginTransaction(Unknown Source)
    	dao.CategorieDAO.getListCategorie(CategorieDAO.java:28)
    	controleurs.Connect.connexion(Connect.java:82)
    	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	java.lang.reflect.Method.invoke(Method.java:601)
    	org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:471)
    	org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:408)
    	org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
    	org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900)
    	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
    	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:874)
    	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:790)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    J'utilise une base de donnée Oracle et le jar ojdbc14_g.jar est bien dans le dossier lib donc je ne comprends pas tellement mon erreur, sachant que l'application fonctionne sous tomcat.

    Quelqu'un aurait une idée ?

  2. #2
    Membre VIP Avatar de kalysto
    Profil pro
    Développeur
    Inscrit en
    Mars 2003
    Messages
    442
    Détails du profil
    Informations personnelles :
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur

    Informations forums :
    Inscription : Mars 2003
    Messages : 442
    Points : 568
    Points
    568
    Par défaut
    Quelle version de JOnAS ?
    En JOnAS 5, il faut mettre le jar dans lib/ext/
    SI c'est une verison 4, il me semble que c'est lib/commons

  3. #3
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2011
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2011
    Messages : 6
    Points : 6
    Points
    6
    Par défaut
    J'utilise JOnAS version 5.2.2 et je suis sous Ubuntu.
    J'ai placé mes .jar dans le dossier WebContent/WEB-INF/lib/ext comme expliqué dans ta réponse, et j'ai toujours le même problème .

    C'est bien dans ce dossier qu'il fallait placer les archives ?

  4. #4
    Membre VIP Avatar de kalysto
    Profil pro
    Développeur
    Inscrit en
    Mars 2003
    Messages
    442
    Détails du profil
    Informations personnelles :
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur

    Informations forums :
    Inscription : Mars 2003
    Messages : 442
    Points : 568
    Points
    568
    Par défaut
    Comment configures tu ta DataSource ?
    Si tu utilises le service DBM ou les Rars de JOnAS, tu dois mettre ton jar dans ${jonas.root}/lib/ext
    Sinon, simplement le mettre dans WEB-INF/lib devrait faire l'affaire.

  5. #5
    Membre actif Avatar de Lician
    Homme Profil pro
    Architecte Logiciel
    Inscrit en
    Mars 2011
    Messages
    93
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Architecte Logiciel
    Secteur : Services de proximité

    Informations forums :
    Inscription : Mars 2011
    Messages : 93
    Points : 230
    Points
    230
    Par défaut
    Bonjour,

    Placer le .jar est une chose mais as-tu vérifié que le build path était modifié en conséquence?


    Cordialement.
    Keep enjoy'n the ride and let's rock...
    Pensez au bouton et à voter sur les messages utiles pour les autres!
    --------
    Lician - https://chat.developpez.com/ - http://87.98.168.209/

  6. #6
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2011
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2011
    Messages : 6
    Points : 6
    Points
    6
    Par défaut
    Kalysto: Je ne suis pas sur de saisir la question (dsl un peu novice ) mais si j'ai bien compris, l'accès à ma base de données est configuré via le fichier xml hibernate.cfg.xml

    Lician: Lorsque je place mes archives dans WEB-INF/lib elles s'ajoutent bien dans le build path, donc je ne pense pas que le problème viennent de là.

Discussions similaires

  1. [phpMyAdmin] problème d'accès à la base de données ovh
    Par jeje38 dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 1
    Dernier message: 26/01/2008, 19h49
  2. Problème d'accès à une base de données.
    Par GBAGO dans le forum Macros et VBA Excel
    Réponses: 6
    Dernier message: 03/08/2007, 18h45
  3. Problème d'accès à une base de données
    Par senactu dans le forum Débuter
    Réponses: 2
    Dernier message: 19/12/2006, 22h38
  4. Problème d'accès à une base de données
    Par Kankuro dans le forum Administration
    Réponses: 2
    Dernier message: 03/12/2006, 04h15
  5. Réponses: 4
    Dernier message: 15/01/2005, 17h05

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