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

GWT et Vaadin Java Discussion :

Base de données et GWT


Sujet :

GWT et Vaadin Java

  1. #1
    Membre confirmé
    Homme Profil pro
    Inscrit en
    Octobre 2011
    Messages
    80
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Sarthe (Pays de la Loire)

    Informations forums :
    Inscription : Octobre 2011
    Messages : 80
    Par défaut Base de données et GWT
    Bonjour à tous, j'ai un projet à réaliser en gwt , je doit crée un site qui utilise un BDD mysql

    Mais après avoir farfouiller partout sur le net je ne voie pas trop comment faire,
    déjà j'aimerais savoir avec quel logiciel lancer la bdd? quel langage faut t'il associé à GWT pour exécuté des requêtes sur cette base de donné ?

    je suis un peux perdu sur GWT sa ressemble à du java en apparence mais tout est différent^^' du coup c'est très compliqué :s si quelqu'un pouvais m'éclairer du fonctionnement ce serais très gentil de ça part

  2. #2
    Rédacteur

    Avatar de khayyam90
    Homme Profil pro
    Architecte de système d’information
    Inscrit en
    Janvier 2004
    Messages
    10 371
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Architecte de système d’information

    Informations forums :
    Inscription : Janvier 2004
    Messages : 10 371
    Par défaut
    Bonsoir,

    GWT ne sert pas qu'à développer un côté client, il permet aussi de développer les échanges RPC avec des servlets java côté serveur. En théorie il est même possible de faire communiquer le côté client avec n'importe quelle technologie puisqu'au final l'appel RPC sera implémenté en Ajax.

    Dans ton cas il te faut développer un service RPC et une servlet java (en "vrai" java) pour interroger ta base de données. Le requêtage se fera entièrement dans le monde java, tu auras à ta disposition tous les outils qui vont bien (sql, jdbc, hibernate ....)

  3. #3
    Membre confirmé
    Homme Profil pro
    Inscrit en
    Octobre 2011
    Messages
    80
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Sarthe (Pays de la Loire)

    Informations forums :
    Inscription : Octobre 2011
    Messages : 80
    Par défaut
    Merci pour ta réponse, comment tu récupère les donné d'une servlet du coté client? car je doit afficher des pages, et des information récupéré de la base de donné

  4. #4
    Membre du Club
    Homme Profil pro
    Développeur Java
    Inscrit en
    Janvier 2007
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : Enseignement

    Informations forums :
    Inscription : Janvier 2007
    Messages : 7

  5. #5
    Rédacteur

    Avatar de khayyam90
    Homme Profil pro
    Architecte de système d’information
    Inscrit en
    Janvier 2004
    Messages
    10 371
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Architecte de système d’information

    Informations forums :
    Inscription : Janvier 2004
    Messages : 10 371
    Par défaut
    Il faut te documenter sur les services RPC gérés par GWT, ils permettent de transférer des données entre le client et le serveur, dans le même projet de développement.

  6. #6
    Membre confirmé
    Homme Profil pro
    Inscrit en
    Octobre 2011
    Messages
    80
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Sarthe (Pays de la Loire)

    Informations forums :
    Inscription : Octobre 2011
    Messages : 80
    Par défaut
    j'ai crée le service, rpc mais j'ai beaucoup de mal :s je n'arrive vraiment pas à me connecter à une bdd.
    Je ne trouve AUCUN tutoriel qui fait une connexion à une base de donné et qui affiche le résultat d'une requête a l'écran ce qui est quand même dommage :/

  7. #7
    Rédacteur

    Avatar de khayyam90
    Homme Profil pro
    Architecte de système d’information
    Inscrit en
    Janvier 2004
    Messages
    10 371
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Architecte de système d’information

    Informations forums :
    Inscription : Janvier 2004
    Messages : 10 371
    Par défaut
    C'est très vague comme problème.
    Si tu ne sais pas comment requêter une base de données, regarde donc sur la faq JDBC http://java.developpez.com/faq/jdbc/

    Une fois que tu as tes objets requêtés côté serveur, tu dois les renvoyer côté client dans une structure de données de ton choix (une simple List<> fait l'affaire). Puis côté client tu dois itérer sur ta List<> et générer des objets graphiques pour les représenter (des lignes d'un tableau par exemple).

  8. #8
    Membre confirmé
    Homme Profil pro
    Inscrit en
    Octobre 2011
    Messages
    80
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Sarthe (Pays de la Loire)

    Informations forums :
    Inscription : Octobre 2011
    Messages : 80
    Par défaut
    tout ce qui est coté jdbc fonctionnement mais couplé tout ça avec le RPC c'est la grosse galère :/ tu ne peux pas instancier directement les classes de connexion

  9. #9
    Rédacteur

    Avatar de khayyam90
    Homme Profil pro
    Architecte de système d’information
    Inscrit en
    Janvier 2004
    Messages
    10 371
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Architecte de système d’information

    Informations forums :
    Inscription : Janvier 2004
    Messages : 10 371
    Par défaut
    Citation Envoyé par dragonxav72 Voir le message
    tout ce qui est coté jdbc fonctionnement mais couplé tout ça avec le RPC c'est la grosse galère :/ tu ne peux pas instancier directement les classes de connexion
    oui c'est le principe de la séparation client/serveur. La connexion base de données se fait côté serveur. Mais bon, ça sera difficile d'aller plus loin sans code.

  10. #10
    Membre confirmé
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    68
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : France

    Informations forums :
    Inscription : Mai 2004
    Messages : 68
    Par défaut
    je n'ai pas beaucoup d'experience sur GWT
    mais j'ai vu que les Singleton fonctionne
    tu peu donc crée ton connecteur JDBC dedans et le réutiliser

    dans ton RPC tu récupères ton interface JDBC qui sera instancier la première fois
    et après tu peu t'en servir directement

    je ne vosi pas trop ou est le problème

  11. #11
    Membre confirmé
    Homme Profil pro
    Inscrit en
    Octobre 2011
    Messages
    80
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Sarthe (Pays de la Loire)

    Informations forums :
    Inscription : Octobre 2011
    Messages : 80
    Par défaut
    le problème c'est que je ne comprend pas du tout la logique, personne n'a un code très simple de connexion à une bdd exécution d'une requête et affichage du résultat à l'écran? à partir de ça je pourrais comprendre comment tout fonctionne =)

  12. #12
    Membre confirmé
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    68
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : France

    Informations forums :
    Inscription : Mai 2004
    Messages : 68
    Par défaut
    Cherche à JDBC pour avoir un exemple de requête sur une base de donnée.

    avec les donnée que tu as tu les envois sous le format que tu veux au client via les RPC GWT, dans l'application d'exemple généré par défaut tu as déjà le squelette de la communication.

    une fois les données coté clients tu les affiches.

  13. #13
    Membre confirmé
    Homme Profil pro
    Inscrit en
    Octobre 2011
    Messages
    80
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Sarthe (Pays de la Loire)

    Informations forums :
    Inscription : Octobre 2011
    Messages : 80
    Par défaut
    bon je vais poster mes codes en espérant que quelqu'un trouve une solution ^^'
    j’essaye pourtant de faire quelque chose de très simple :/, connexion a une base de donné et affichage du résultat à l'écran

    pour la bdd:
    enigme2
    >user
    >id (AI)
    >mdp (varchar)
    >nom (varchar)
    >prenom (varchar)
    >admin (boolean)

    // la classe principale

    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
    package bdd.client;
     
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.core.client.GWT;
    import com.google.gwt.user.client.Window;
    import com.google.gwt.user.client.rpc.AsyncCallback;
    import com.google.gwt.user.client.ui.HorizontalPanel;
    import com.google.gwt.user.client.ui.RootPanel;
     
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class TestBddGwt_v2 implements EntryPoint {
     
    	private final GreetingServiceAsync greetingService = GWT
    	.create(GreetingService.class);
     
    	public void onModuleLoad() {
     
    		HorizontalPanel panelHaut = new HorizontalPanel();
    		panelHaut.setSpacing(120);
    		AsyncCallback<String> callback = new AsyncCallback<String>() {
    			@Override
    			public void onFailure(Throwable caught) {
    				Window.alert("fail");
    				GWT.log(caught.getMessage(),caught);
     
    			}
     
    			@Override
    			public void onSuccess(String result) {
    				// TODO Auto-generated method stub
    				Window.alert("bravo");
    			}
     
    		};
     
    		greetingService.connectionBdd("//127.0.0.1:3306/enigme2", "root", "", callback);
    		RootPanel.get().add(panelHaut);
     
    	}
    }
    //GreetingServiceImpl

    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
     
    package bdd.server;
     
    import java.sql.ResultSet;
    import java.sql.SQLException;
     
    import bdd.client.GreetingService;
    import bdd.shared.FieldVerifier;
    import com.google.gwt.user.server.rpc.RemoteServiceServlet;
     
    /**
     * The server side implementation of the RPC service.
     */
    @SuppressWarnings("serial")
    public class GreetingServiceImpl extends RemoteServiceServlet implements
    		GreetingService {
     
    	@Override
    	public String connectionBdd(String url, String login, String password) {
     
    		String requete="SELECT id,nom,prenom,admin FROM User ";
    		ConBDD connexion=new ConBDD(url,login,password);
    		ResultSet resultat=connexion.getData(requete);
    		if (resultat==null)
    			return null;
    		try {
    			while (resultat.next()){
    				String p="";
    				p+=(resultat.getString("id"));
    				p+=(resultat.getString("nom"));
    				p+=(resultat.getString("prenom"));
    				p+=(resultat.getBoolean("admin"));
     
    				System.out.println(p); //juste pour voir si en console cela marche
    				return p;
    			}
    			return null;
    		}catch (SQLException e) {
    			e.printStackTrace();
    			return null;
    		}
    	}
     
    }
    //la connection a la bdd

    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
     
    package bdd.server;
     
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
     
    public class ConBDD {
     
     
    	private Connection connOjbect = null;
    	private static String URL      = "";
    	private static String userName = "";
    	private static String userPWD  = "";
     
     
     
    	public ConBDD(String URLparam, String userNameparam, String userPWDparam) {
    		super();
     
    		URL = URLparam;
    		userName = userNameparam; 
    		userPWD = userPWDparam; 
     
    		connectToDB();
     
    	}
     
    	private boolean connectToDB(){
     
    		try{
    			Class.forName("com.mysql.jdbc.Driver").newInstance();
    		} catch (InstantiationException e) {
    			e.printStackTrace();
    		} catch (IllegalAccessException e) {
    			e.printStackTrace();
    		} catch (ClassNotFoundException e) {
    			e.printStackTrace();
    		}
    		try {
    			connOjbect = DriverManager.getConnection("jdbc:mysql:"+URL,userName, userPWD);
    			return true;
    		} catch (SQLException e) {
    			System.err.println("Mysql Connection Error: ");
    			e.printStackTrace();
    		}
    		return false;	
    	}
     
    	public ResultSet getData(String SQL) {
    		ResultSet results = null;
     
    		if (connOjbect==null)
    			connectToDB();
    		try {
    			results = connOjbect.createStatement().executeQuery(SQL);
     
    		} catch (SQLException e) {
    			System.err.println("Impossible d'executer la requete");
    			e.printStackTrace();
    		}
     
    		return results;
     
     
    	}
     
     
    	public Connection getConnectionObject(){
    		return connOjbect;
    	}
     
     
    }

    //GreetingService
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
     
    package bdd.client;
     
    import com.google.gwt.user.client.rpc.RemoteService;
    import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
     
    /**
     * The client side stub for the RPC service.
     */
    @RemoteServiceRelativePath("greet")
    public interface GreetingService extends RemoteService {
     
    	String connectionBdd(String url, String login, String password);
    }

    //GreetingServiceAsync

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
    package bdd.client;
     
    import com.google.gwt.user.client.rpc.AsyncCallback;
     
    /**
     * The async counterpart of <code>GreetingService</code>.
     */
    public interface GreetingServiceAsync {
    	void connectionBdd(String url,String login,String password, AsyncCallback<String> callback)	throws IllegalArgumentException;
     
     
    }

  14. #14
    Membre confirmé
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    68
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : France

    Informations forums :
    Inscription : Mai 2004
    Messages : 68
    Par défaut
    c'est quoi le message d'erreur ?

  15. #15
    Membre confirmé
    Homme Profil pro
    Inscrit en
    Octobre 2011
    Messages
    80
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Sarthe (Pays de la Loire)

    Informations forums :
    Inscription : Octobre 2011
    Messages : 80
    Par défaut
    Citation Envoyé par Lsong Voir le message
    c'est quoi le message d'erreur ?
    un peux long^^'

    [WARN] Server class 'com.mysql.jdbc.Driver' could not be found in the web app, but was found on the system classpath
    [WARN] Adding classpath entry 'file:/C:/Users/virlouvet/workspace/LibrairieJava/mysql-connector-java-5.1.17-bin.jar' to the web app classpath for this session
    For additional info see: file:/C:/Users/virlouvet/Desktop/apply/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.r36v201109211906/gwt-2.4.0/doc/helpInfo/webAppClassPath.html
    Mysql Connection Error:
    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:344)
    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2333)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2370)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2154)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at bdd.server.ConBDD.connectToDB(ConBDD.java:41)
    at bdd.server.ConBDD.<init>(ConBDD.java:25)
    at bdd.server.GreetingServiceImpl.connectionBdd(GreetingServiceImpl.java:21)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
    Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:257)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:294)
    ... 44 more
    Mysql Connection Error:
    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:344)
    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2333)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2370)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2154)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at bdd.server.ConBDD.connectToDB(ConBDD.java:41)
    at bdd.server.ConBDD.getData(ConBDD.java:54)
    at bdd.server.GreetingServiceImpl.connectionBdd(GreetingServiceImpl.java:22)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
    Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:257)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:294)
    ... 44 more
    Starting Jetty on port 8888
    [WARN] Exception while dispatching incoming RPC call
    com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.lang.String bdd.client.GreetingService.connectionBdd(java.lang.String,java.lang.String,java.lang.String)' threw an unexpected exception: java.lang.NullPointerException
    at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
    Caused by: java.lang.NullPointerException
    at bdd.server.ConBDD.getData(ConBDD.java:56)
    at bdd.server.GreetingServiceImpl.connectionBdd(GreetingServiceImpl.java:22)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
    ... 22 more
    [ERROR] 500 - POST /testbddgwt_v2/greet (127.0.0.1) 57 bytes
    Request headers
    Host: 127.0.0.1:8888
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
    Accept-Encoding: gzip, deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Connection: keep-alive
    Referer: http://127.0.0.1:8888/TestBddGwt_v2....127.0.0.1:9997
    X-GWT-Permutation: HostedMode
    X-GWT-Module-Base: http://127.0.0.1:8888/testbddgwt_v2/
    Content-Type: text/x-gwt-rpc; charset=utf-8
    Content-Length: 198
    Pragma: no-cache
    Cache-Control: no-cache
    Response headers
    Content-Type: text/plain

  16. #16
    Membre confirmé
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    68
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : France

    Informations forums :
    Inscription : Mai 2004
    Messages : 68
    Par défaut
    dans ton log d'erreur il est claire que c'est un problème de connections JDBC

    Mysql Connection Error:
    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
    il faudrait aller voir dans le forum adéquate
    je ne sais pas si la habitué du coin s'y connaisse en jdbc, ce n'est pas mon cas

  17. #17
    Membre confirmé
    Homme Profil pro
    Inscrit en
    Octobre 2011
    Messages
    80
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Sarthe (Pays de la Loire)

    Informations forums :
    Inscription : Octobre 2011
    Messages : 80
    Par défaut
    non c'est bon j'ai réussi je suis un boulet :/ j'ai du fermer la bdd a un moment sans faire gaffe^^' , ça m'affiche le résultat en console plus qu'a le passer à l'écran^^

    merci pour tout


    ...quoi que passer de la console à l'écran na pas l'air aussi simple que je pensais ^^

  18. #18
    Membre confirmé
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    68
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : France

    Informations forums :
    Inscription : Mai 2004
    Messages : 68
    Par défaut
    j'ai lut ton impl tu sais que tu ne peu faire qu'un return

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    while (resultat.next()){
    				String p="";
    				p+=(resultat.getString("id"));
    				p+=(resultat.getString("nom"));
    				p+=(resultat.getString("prenom"));
    				p+=(resultat.getBoolean("admin"));
     
    				System.out.println(p); //juste pour voir si en console cela marche
    				return p;
    			}
    tu vas lire le premier résultat et hop fini

  19. #19
    Membre confirmé
    Homme Profil pro
    Inscrit en
    Octobre 2011
    Messages
    80
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Sarthe (Pays de la Loire)

    Informations forums :
    Inscription : Octobre 2011
    Messages : 80
    Par défaut
    oui j'ai vue ça ^^, j'ai des soucis pour stocker dans une autre classes, pour le moment je renvoie un String qui contient tout

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

Discussions similaires

  1. Gwt - RPC - Base de données
    Par fluff dans le forum GWT et Vaadin
    Réponses: 4
    Dernier message: 07/05/2009, 09h00
  2. Probleme Google GWT connexion base de donne
    Par r0nsync dans le forum Webdesign & Ergonomie
    Réponses: 6
    Dernier message: 26/09/2008, 18h05
  3. Gwt et les bases de données
    Par offspring dans le forum GWT et Vaadin
    Réponses: 2
    Dernier message: 24/09/2008, 17h27
  4. Probleme Google GWT connexion base de donne
    Par dominou73 dans le forum Webdesign & Ergonomie
    Réponses: 1
    Dernier message: 10/07/2007, 15h49
  5. Probleme Google GWT connexion base de donne
    Par dominou73 dans le forum GWT et Vaadin
    Réponses: 1
    Dernier message: 03/07/2007, 22h51

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