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

Java Discussion :

[Classique] ORA-12519, TNS:no appropriate service handler found


Sujet :

Java

  1. #1
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2011
    Messages
    84
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juillet 2011
    Messages : 84
    Points : 65
    Points
    65
    Par défaut [Classique] ORA-12519, TNS:no appropriate service handler found
    Bonjour tous le monde j'ai réalisé une application Java/Swing avec Hibernate et spring ,mais lorsque je lance l'application j'ai cette erreur
    cette application gére les notes des etudiant (les modules les matieres ...)
    mais lorsque je saisie les données à un moment il y a cette jolie erreur qui s'affiche


    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
     
    double-click
    Exception in thread "AWT-EventQueue-0" org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection
    	at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:601)
    	at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
    	at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:335)
    	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:105)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    	at $Proxy30.doGetListMatiereFromModule(Unknown Source)
    	at ma.ismp.gpedagogique.application.MatiereServiceFactory.getListMatiere(MatiereServiceFactory.java:63)
    	at ma.ismp.gpedagogique.presentation.ModelNoteMa.<init>(ModelNoteMa.java:48)
    	at ma.ismp.gpedagogique.presentation.FicheNoteMats.<init>(FicheNoteMats.java:64)
    	at ma.ismp.gpedagogique.presentation.FicheNoteMo$Mouselistner.mouseClicked(FicheNoteMo.java:215)
    	at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)
    	at java.awt.Component.processMouseEvent(Component.java:6266)
    	at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
    	at java.awt.Component.processEvent(Component.java:6028)
    	at java.awt.Container.processEvent(Container.java:2041)
    	at java.awt.Component.dispatchEventImpl(Component.java:4630)
    	at java.awt.Container.dispatchEventImpl(Container.java:2099)
    	at java.awt.Component.dispatchEvent(Component.java:4460)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
    	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4247)
    	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
    	at java.awt.Container.dispatchEventImpl(Container.java:2085)
    	at java.awt.Window.dispatchEventImpl(Window.java:2475)
    	at java.awt.Component.dispatchEvent(Component.java:4460)
    	at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
    	at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
    	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
    	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
    	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
    	at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
    	at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
    	at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:160)
    	at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:81)
    	at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1473)
    	at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:559)
    	... 31 more
    Caused by: java.sql.SQLException: Listener refused the connection with the following error:
    ORA-12519, TNS:no appropriate service handler found
    The Connection descriptor used by the client was:
    localhost:1521:XE
     
    	at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    	at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:261)
    	at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
    	at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:441)
    	at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
    	at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
    	at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
    	at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
    	at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
    	at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:974)
    	at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
    	at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
    	at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:82)
    	at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
    apres un tour sur le net ,j'ai modifie le fichier init.ora le voici
    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
    ##############################################################################
    # Copyright (c) 1991, 2011, Oracle and/or its affiliates. All rights reserved. 
    ##############################################################################
     
    ###########################################
    # Cursors and Library Cache
    ###########################################
    open_cursors=300
     
    ###########################################
    # Database Identification
    ###########################################
    db_name=XE
     
    ###########################################
    # File Configuration
    ###########################################
    control_files=("C:\oracleXE11g\app\oracle\oradata\XE\control.dbf")
    
    ###############################diagnostic_dest=############
    # Job Queues
    ###########################################
    job_queue_processes=7500
     
    ###########################################
    # Miscellaneous
    ###########################################
    compatible=11.2.0.0.0
    diagnostic_dest=C:\oracleXE11g\app\oracle\.
    memory_target=1024M
    
    
    ###########################################
    # Processes and Sessions
    ###########################################
    sessions=8500
     
     
    ###########################################
    # Security and Auditing
    ###########################################
    audit_file_dest=C:\oracleXE11g\app\oracle\admin\XE\adump
    remote_login_passwordfile=EXCLUSIVE
     
    ###########################################
    # Shared Server
    ###########################################
    dispatchers="(PROTOCOL=TCP) (SERVICE=XEXDB)"
    shared_servers=4 
    
     
    ###########################################
    # System Managed Undo and Rollback Segments
    ###########################################
    undo_management=AUTO
    undo_tablespace=UNDOTBS1
    
    ###########################################
    # Backup and Recovery
    ###########################################
    DB_RECOVERY_FILE_DEST_SIZE = 10G
    DB_RECOVERY_FILE_DEST=C:\oracleXE11g\app\oracle\fast_recovery_area
    est ce qu'il y a d'autres parametres à modifier ,ou bien cette erreur est inevitable !! . Merci d'avance

  2. #2
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 481
    Points : 48 806
    Points
    48 806
    Par défaut
    D'abord, faire tourner correctement ton serveur.
    Ensuite, quand tu arrive à t'y connecter avec le client oracle standard (sqldevelopper), tu n'a plus qu'à reprendre les paramètres du client dans sqldevelopper pour les mettre dans ton application.

  3. #3
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2011
    Messages
    84
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juillet 2011
    Messages : 84
    Points : 65
    Points
    65
    Par défaut
    D'abord, faire tourner correctement ton serveur.
    Merci d'abord pour votre réponse ,je précise que je travaille avec Oracle 11g XE
    ,lorsque je lance l'application ça marche je fais des CRUD sans probleme mais à un moment donnée cette erreur ce lance ,et je dois redemarrer l'application

    Ensuite, quand tu arrive à t'y connecter avec le client oracle standard (sqldevelopper), tu n'a plus qu'à reprendre les paramètres du client dans sqldevelopper pour les mettre dans ton application.
    j'aimerais bien avoir quelques explications (je suis débutant en Oracle )
    Merci : )

  4. #4
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 481
    Points : 48 806
    Points
    48 806
    Par défaut
    Citation Envoyé par ensemien Voir le message
    Merci d'abord pour votre réponse ,je précise que je travaille avec Oracle 11g XE
    ,lorsque je lance l'application ça marche je fais des CRUD sans probleme mais à un moment donnée cette erreur ce lance ,et je dois redemarrer l'application
    Bizarre, vu que c'est une erreur de configuration, il n'est pas normal que ça marche "parfosi" Ou alors tu as mis plusieurs configurations pour différents services => regarde comment tu as confguré les autres.

    j'aimerais bien avoir quelques explications (je suis débutant en Oracle )
    Merci : )
    Le mieux dans ce cas, c'est de demander à ton administrateur Oracle quels sont les paramètres à utiliser.

    Le format de la configuration coté java, c'est

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     jdbc:oracle:thin:@[HOST][:PORT]:SID
    ou
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     jdbc:oracle:thin:@//[HOST][:PORT]/SERVICE
    ou encre, si tu aime te triturer les méninges (mais personnes n'utilise se format)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(HOST=<host>)(PORT=<port>))(CONNECT_DATA=(SERVICE_NAME=<service>)))

  5. #5
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2011
    Messages
    84
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juillet 2011
    Messages : 84
    Points : 65
    Points
    65
    Par défaut
    Merci ,voici la partie base de données de mon fichier Applicatiocontext.xml

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
     
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    		<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
    		<property name="url" value="jdbc:oracle:thin:@localhost:1521:XE"/>
    		<property name="username" value="ispm" />
    		<property name="password" value="ispm" />
     
    </bean>
    et voici le fichier dans son integralite

    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
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
     
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:aop="http://www.springframework.org/schema/aop"
    	xmlns:c="http://www.springframework.org/schema/c"
    	xmlns:cache="http://www.springframework.org/schema/cache"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    	xmlns:jee="http://www.springframework.org/schema/jee"
    	xmlns:jms="http://www.springframework.org/schema/jms"
    	xmlns:jpa="http://www.springframework.org/schema/data/jpa"
    	xmlns:lang="http://www.springframework.org/schema/lang"
    	xmlns:mvc="http://www.springframework.org/schema/mvc"
    	xmlns:oxm="http://www.springframework.org/schema/oxm"
    	xmlns:p="http://www.springframework.org/schema/p"
    	xmlns:repository="http://www.springframework.org/schema/data/repository"
    	xmlns:security="http://www.springframework.org/schema/security"
    	xmlns:task="http://www.springframework.org/schema/task"
    	xmlns:tx="http://www.springframework.org/schema/tx"
    	xmlns:util="http://www.springframework.org/schema/util"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
    		http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd
    		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
    		http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
    		http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
    		http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-3.1.xsd
    		http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.0.xsd
    		http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.1.xsd
    		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
    		http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.1.xsd
    		http://www.springframework.org/schema/data/repository http://www.springframework.org/schema/data/repository/spring-repository-1.0.xsd
    		http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.3.xsd
    		http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd
    		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
    		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd">
     
     
     
     
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    		<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
    		<property name="url" value="jdbc:oracle:thin:@localhost:1521:XE"/>
    		<property name="username" value="ispm" />
    		<property name="password" value="ispm" />
     
    </bean>
     
     
     
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    		<property name="dataSource" ref="dataSource" />
    		<property name="annotatedClasses">
    			<list>
     
    		        <value>ma.ismp.gpedagogique.domain.model.Etudiant</value>
    		        <value>ma.ismp.gpedagogique.domain.model.Module</value>
    		        <value>ma.ismp.gpedagogique.domain.model.Matiere</value>
    		        <value>ma.ismp.gpedagogique.domain.model.Filiere</value>
    		         <value>ma.ismp.gpedagogique.domain.model.AttestationReussite</value>
     
    		   </list>
    		</property>
    		<property name="hibernateProperties">
    			<props>
    				  <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
    				  <prop key="hibernate.show_sql">true</prop>
    			      <prop key="hibernate.hbm2ddl.auto">update</prop> 
    			      <!--  <prop key="hibernate.jdbc.batch_size">0</prop>   -->
    			</props>
    		</property>
    </bean>
     
     
     
    	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory" ref="sessionFactory" />
    	</bean>
    	<tx:annotation-driven transaction-manager="transactionManager"/>
     
     
    	<context:annotation-config />
            <context:component-scan base-package  = "ma.ismp.*" />
     
     
     
     
    </beans>
    je rappelle que ca marche au debut mais lorsque j'effectue plusieurs CRUD(Create Read Delete) ca donne cette erreur ,normalement j'ai utilisé Hibernate pour sa robustesse ,et pour éviter ce genre de problemes ,sincerement je ne sais pas c'est quoi le probleme.
    Merci pour tous conseil de votre part

  6. #6
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 481
    Points : 48 806
    Points
    48 806
    Par défaut
    bizarre ce message d'erreur, normalement ca veux dire que ta config est incorrecte. Donc tu ne devrais pas avoir la possibilité de réussir le moindre CRUD.

    Regarde aussi si tu n'a pas dépassé le nombre max de connexions autorisées par ta licence oracle. Quand tu as ce message, tu arrive toujours à te connecter à ton oracle avec son client sql?

  7. #7
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2011
    Messages
    84
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juillet 2011
    Messages : 84
    Points : 65
    Points
    65
    Par défaut
    hmm là vous avez raison ,effectivement j'ai essayé de faire plusieur crud comme d'habitude et lorsque le messaqge s'est affiché ,j'ai 'pingué' le serveur et ça donnait 'Ping Failed' , le ping reste failed jusqu'à ce que je redémarre l'application
    est ce que celà veut dire que cettre erreur est inévitable ,j'aimerais bien savoir comment traiter cette exception (genre du try {} catch) pour dire à l'utilisateur 'veuillez redémarrer l'application'
    Merci

  8. #8
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 481
    Points : 48 806
    Points
    48 806
    Par défaut
    qu'est-ce que tu entends par "pingé" ??

    Si ton oracle a un nombre limite de connexion autorisées en parallèe, simplement, arrange toi pour ne pas les dépasser. Ou prend une licence avec plus de connexion.

    J'ai l'impression que tu joue avec une version "developper" de la licence oracle. Cette license sert juste à tester une application sur oracle, pas à utiliser pour de la prod. En prod il te faut une licence adaptée à ton utilisation (et bien sûr, il faut payer).


    Si ton application en test marche un certains temps puis plus, regarde quand même si tu n'a pas de fuite de tes connexion. Genre tu démarre une session hibernate, tu as une erreur, et tu oublie de fermer ta session hibernate qui, du coup, conserve ad vitam une connexion à la DB oracle.

  9. #9
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Juillet 2011
    Messages
    84
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juillet 2011
    Messages : 84
    Points : 65
    Points
    65
    Par défaut
    Bonsoir Merci beaucoup pour vos reponses , et désolè pour mes reponses tardives vu que j’étais en voyage

    pour la version j'utilise Oracle XE 11g ,

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    Si ton application en test marche un certains temps puis plus, regarde quand même si tu n'a pas de fuite de tes connexion. Genre tu démarre une session hibernate, tu as une erreur, et tu oublie de fermer ta session hibernate qui, du coup, conserve ad vitam une connexion à la DB oracle.
    là j'ai utilisé une architecture 3 tiers
    avec :
    la couche DAO :Hibernate
    voici un exepemple d'une interface DAO

    L'interface
    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
     
    public interface EtudiantDaoInterf {
     
     
     
    	public Etudiant getEtudiantById(int etudiantId);
    	public Etudiant getEtudiantByCin(String etudiantCin);
    	public Etudiant getEtudiantByCne(String etudiantCne);	
     
    	public List<Etudiant> getAllEtudiants();
    	public List<Etudiant> getEtudiantsByLevel(String etudiantLevel);
    	public List<Etudiant> getEtudiantsByFiliere(String etudiantFiliere);
    	public List<Etudiant> getEtudiantsByFiliereANDLevel(String etudiantFiliere , String etudiantLevel);
    	public List<Etudiant> getEtudiantsByFLY(String etudiantFiliere , String etudiantLevel ,String etudiantYear1 ,String etudiantYear2);
     
    	public Etudiant  getEtudiantByCinAndYear(String etudiantCin ,String etudiantYear1 ,String etudiantYear2);
     
     
    	public List<Etudiant> getEtudiantsByFY(String etudiantFiliere ,String etudiantYear1 ,String etudiantYear2);
     
    	public List<Integer> getListIdentifByFL(String filiere,String level, String year1 ,String year2);
     
    	public List<String> getListMatricByYear(String year1 ,String year2);
     
     
     
    	public void saveEtudiant(Etudiant e);
    	public void removeEtudiant(Etudiant e);
    	public void updateEtudiant(Etudiant e);
     
     
     
     
     
     
     
    }

    et son implementation :
    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
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
     
    @Transactional
    @Repository("etudiantDao")
    public class EtudiantDaoImpl   implements EtudiantDaoInterf{
     
     
    	    @Autowired	
    		private SessionFactory sessionFactory;
     
     
     
     
     
    	public SessionFactory getSessionFactory() {
     
    			return sessionFactory;
     
            }
     
    		public void setSessionFactory(SessionFactory sessionFactory) {
    			this.sessionFactory = sessionFactory;
    		}
     
     
     
     
     
     
    	@Override
    	public Etudiant getEtudiantById(int etudiantId) {
     
    		return (Etudiant) sessionFactory.getCurrentSession().getNamedQuery("Etudiant.ById").setParameter("etudiantId", etudiantId).uniqueResult();
     
    	}
     
    	@Override
    	public Etudiant getEtudiantByCin(String etudiantCin) {
     
    		return (Etudiant) sessionFactory.getCurrentSession().getNamedQuery("Etudiant.ByCin").setParameter("etudiantCin", etudiantCin).uniqueResult();
     
    	}
     
    	@Override
    	public Etudiant getEtudiantByCne(String etudiantCne) {
     
    		return (Etudiant) sessionFactory.getCurrentSession().getNamedQuery("Etudiant.ByCne").setParameter("etudiantCne", etudiantCne).uniqueResult();
     
    	}
     
    	@SuppressWarnings("unchecked")
    	@Override
    	public List<Etudiant> getAllEtudiants() {
     
    		return    sessionFactory.getCurrentSession().getNamedQuery("Etudiant.All").list();
    	}
     
     
     
    	@SuppressWarnings("unchecked")
    	@Override
    	public List<Etudiant> getEtudiantsByFiliere(String etudiantFiliere) {
     
    		return   sessionFactory.getCurrentSession().getNamedQuery("Etudiant.ByFiliere").setParameter("etudiantFiliere", etudiantFiliere) .list();
     
    	}
     
    	@SuppressWarnings("unchecked")
    	@Override
    	public List<Etudiant> getEtudiantsByLevel(String etudiantLevel) {
    		return   sessionFactory.getCurrentSession().getNamedQuery("Etudiant.ByLevel").setParameter("etudiantLevel", etudiantLevel) .list();
    	}
     
     
     
     
    	@SuppressWarnings("unchecked")
    	@Override
    	public List<Etudiant> getEtudiantsByFiliereANDLevel(String etudiantFiliere,
    			String etudiantLevel) {
    		return   sessionFactory.getCurrentSession().getNamedQuery("Etudiant.ByFiliereANDLevel").setParameter("etudiantFiliere", etudiantFiliere)
    				 .setParameter("etudiantLevel", etudiantLevel) .list();
    	}
     
     
    	@SuppressWarnings("unchecked")
    	@Override
    	public List<Etudiant> getEtudiantsByFLY(String etudiantFiliere,
    			String etudiantLevel, String etudiantYear1,String etudiantYear2) {
    		return   sessionFactory.getCurrentSession().getNamedQuery("Etudiant.ByFLY")
    				 .setParameter("etudiantFiliere", etudiantFiliere)
    				 .setParameter("etudiantLevel", etudiantLevel) 
    				 .setParameter("etudiantYear1", etudiantYear1)
    				  .setParameter("etudiantYear2", etudiantYear2)
    				 .list();
    	}
     
    	@SuppressWarnings("unchecked")
    	@Override
    	public List<Etudiant> getEtudiantsByFY(String etudiantFiliere,
    		 String etudiantYear1,String etudiantYear2) {
    		return   sessionFactory.getCurrentSession().getNamedQuery("Etudiant.ByFY")
    				 .setParameter("etudiantFiliere", etudiantFiliere)
    				 .setParameter("etudiantYear1", etudiantYear1)
    				 .setParameter("etudiantYear2", etudiantYear2)
    				 .list();
    	}
     
     
     
    	@Override
    	public void saveEtudiant(Etudiant e) {
    		 sessionFactory.getCurrentSession().persist(e);
     
     
    	  }
     
     
     
    	@Override
    	public void removeEtudiant(Etudiant e) {
    	  sessionFactory.getCurrentSession().delete(e);
    	 }
     
     
     
    	@Override
    	public void updateEtudiant(Etudiant e) {
    	 sessionFactory.getCurrentSession().update(e);
     
    	  }
     
     
    	@SuppressWarnings("unchecked")
    	@Override
    	public List<Integer> getListIdentifByFL(String etudiantFiliere, String etudiantLevel ,String etudiantYear1,String etudiantYear2) {
     
    		return   sessionFactory.getCurrentSession().getNamedQuery("Etudiant.ListIdByFLY")
    				 .setParameter("etudiantFiliere", etudiantFiliere)
    				 .setParameter("etudiantLevel", etudiantLevel) 
    				  .setParameter("etudiantYear1", etudiantYear1)
    				  .setParameter("etudiantYear2", etudiantYear2)
    				 .list();
     
    	}
     
    	@SuppressWarnings("unchecked")
    	@Override
    	public List<String> getListMatricByYear(String etudiantYear1,String etudiantYear2) {
    		return   sessionFactory.getCurrentSession().getNamedQuery("Etudiant.ListMatricByYear")
    				   .setParameter("etudiantYear1", etudiantYear1)
    				   .setParameter("etudiantYear2", etudiantYear2)
    				   .list();
    	}
     
    	@SuppressWarnings("unchecked")
    	@Override
    	public Etudiant getEtudiantByCinAndYear(String etudiantCin,
    			String etudiantYear1,String etudiantYear2) {
    		// TODO Auto-generated method stub
    	 return   (Etudiant) sessionFactory.getCurrentSession().getNamedQuery("Etudiant.ByCinYear").setParameter("etudiantCin", etudiantCin)
    			 .setParameter("etudiantYear1", etudiantYear1)
    			 .setParameter("etudiantYear2", etudiantYear2).uniqueResult();
     
    	}
     
     
     
     
     
     
     
     
     
    }

Discussions similaires

  1. Réponses: 1
    Dernier message: 25/11/2009, 23h01
  2. Réponses: 2
    Dernier message: 06/04/2009, 09h16
  3. ORA-12519, TNS:no appropriate service handler found
    Par willoi dans le forum Administration
    Réponses: 16
    Dernier message: 04/09/2007, 13h40
  4. ORA-12162: TNS:net service name is incorrect
    Par gubule dans le forum Oracle
    Réponses: 15
    Dernier message: 11/07/2006, 18h04
  5. Réponses: 11
    Dernier message: 29/06/2005, 11h36

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