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

Services Web Java Discussion :

Hibernate et Web Service


Sujet :

Services Web Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Inscrit en
    Mai 2010
    Messages
    32
    Détails du profil
    Informations forums :
    Inscription : Mai 2010
    Messages : 32
    Par défaut Hibernate et Web Service
    Bonjour,

    Je me demandais si Hibernate est compatible avec Axis2 ?

    J'ai la classe suivante, à partir de laquelle je veux générer son WSDL et la partie cliente.
    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
    package mpkg.test;
     
    import java.util.Iterator;
    import java.util.List;
     
    import mpkg.classe.Client;
    import mpkg.util.HibernateUtil;
    import net.sf.hibernate.Criteria;
    import net.sf.hibernate.HibernateException;
    import net.sf.hibernate.Query;
    import net.sf.hibernate.Session;
    import net.sf.hibernate.expression.Expression;
     
    //import org.hibernate.HibernateException;
     
    public class Kol {
        public List Afficher(Integer A,Integer B) throws HibernateException{
            @SuppressWarnings("lol")
            Session session;
     
                session = HibernateUtil.currentSession();
                Query requete = session.createQuery("From Client " );
                 System.out.println(requete.list().size());// On vérifie bien que ca a marché
                 List resultat = requete.list();  //je récupère un tableau de 2 colonnes
     
                 for (Iterator it = resultat.iterator(); it.hasNext();){
                        System.out.println(it.next().getClass().getName());
                 }
     
            return resultat;
        }
     
    }
    Et j'ai les erreurs suivantes :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    The service class "mpkg.test.Kol" does not comply to one or more requirements of the JAX-RPC 1.1 specification, and may not deploy or function correctly.
      The method "Afficher" on the service class "mpkg.test.Kol" uses a data type, "java.util.List", that is not supported by the JAX-RPC specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result.
      The field or property "throwable" on the value type "net.sf.hibernate.exception.NestableException" used via the service class "mpkg.test.Kol" has a data type, "java.lang.Throwable", that is not supported by the JAX-RPC 1.1 specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result.
      The field or property "cause" on the value type "net.sf.hibernate.exception.NestableException" used via the service class "mpkg.test.Kol" has a data type, "java.lang.Throwable", that is not supported by the JAX-RPC 1.1 specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result.
      The field or property "throwables" on the value type "net.sf.hibernate.exception.NestableException" used via the service class "mpkg.test.Kol" has a data type, "java.lang.Throwable", that is not supported by the JAX-RPC 1.1 specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result.
    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
    IWAB0398E Error in generating WSDL from Java:  java.lang.NoClassDefFoundError: net/sf/hibernate/HibernateException
        java.lang.NoClassDefFoundError: net/sf/hibernate/HibernateException
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
        at java.lang.Class.getDeclaredMethod(Class.java:1935)
        at org.apache.axis.description.JavaServiceDesc.loadServiceDescByIntrospection(JavaServiceDesc.java:874)
        at org.apache.axis.description.JavaServiceDesc.loadServiceDescByIntrospection(JavaServiceDesc.java:846)
        at org.apache.axis.description.JavaServiceDesc.getOperations(JavaServiceDesc.java:410)
        at org.apache.axis.wsdl.fromJava.Emitter.writePortType(Emitter.java:1016)
        at org.apache.axis.wsdl.fromJava.Emitter.getWSDL(Emitter.java:484)
        at org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:331)
        at org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:430)
        at org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2WsdlAntTask.java:243)
        at org.eclipse.jst.ws.internal.axis.consumption.core.command.Java2WSDLCommand.executeAntTask(Java2WSDLCommand.java:180)
        at org.eclipse.jst.ws.internal.axis.consumption.core.command.Java2WSDLCommand.execute(Java2WSDLCommand.java:95)
        at org.eclipse.jst.ws.internal.axis.creation.ui.command.BUCodeGenOperation$BottomUpWSModifyOperation.execute(BUCodeGenOperation.java:122)
        at org.eclipse.jst.ws.internal.axis.creation.ui.command.BUCodeGenOperation.execute(BUCodeGenOperation.java:86)
        at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.runCommand(CommandFragmentEngine.java:419)
        at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.visitTop(CommandFragmentEngine.java:359)
        at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.moveForwardToNextStop(CommandFragmentEngine.java:254)
        at org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager$6.run(SimpleCommandEngineManager.java:294)
        at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
        at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
        at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1029)
        at org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager.runForwardToNextStop(SimpleCommandEngineManager.java:264)
        at org.eclipse.wst.command.internal.env.ui.widgets.WizardPageManager.runForwardToNextStop(WizardPageManager.java:91)
        at org.eclipse.wst.command.internal.env.ui.widgets.WizardPageManager.performFinish(WizardPageManager.java:262)
        at org.eclipse.wst.command.internal.env.ui.widgets.DynamicWizard.performFinish(DynamicWizard.java:382)
        at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:827)
        at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:432)
        at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
        at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
        at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4125)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1457)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1480)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1465)
        at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1270)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3971)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3610)
        at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
        at org.eclipse.jface.window.Window.open(Window.java:801)
        at org.eclipse.wst.command.internal.env.ui.widgets.popup.DynamicPopupWizard.run(DynamicPopupWizard.java:130)
        at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
        at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
        at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
        at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
        at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4125)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1457)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1480)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1465)
        at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1270)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3971)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3610)
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
        at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
        at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
        Caused by: java.lang.ClassNotFoundException: net.sf.hibernate.HibernateException
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        at org.apache.tools.ant.AntClassLoader.findBaseClass(AntClassLoader.java:1383)
        at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1076)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        ... 73 more
    Pour info tous mes jars sont bien ajoutés.

    Quelqu'un saurait-il me dire d'où vient le problème ?

    Merci d'avance pour votre aide.

  2. #2
    Membre éclairé Avatar de rockley
    Homme Profil pro
    Inscrit en
    Décembre 2010
    Messages
    404
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Décembre 2010
    Messages : 404
    Par défaut
    Je vois que tu utilises java.util.List. Dans tout les WS en général, les listes sont très mal générées car elles appartiennent à l'api Java et il est très difficile de les traduire en xml.

    De plus, met des private dans tes classes et rend tes objets de transition Serializable (commence d’ailleurs par là).
    Si ce ne sont pas des types simples que tu échanges, il faut absolument qu'ils soient sérialisables.

  3. #3
    Membre averti
    Inscrit en
    Mai 2010
    Messages
    32
    Détails du profil
    Informations forums :
    Inscription : Mai 2010
    Messages : 32
    Par défaut
    j'ai mis serialisable et j'ai enlever les listes mais toujours meme erreur

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    IWAB0398E Error in generating WSDL from Java:  java.lang.NoClassDefFoundError: net/sf/hibernate/HibernateException
    Que faire ??

  4. #4
    Membre éclairé Avatar de rockley
    Homme Profil pro
    Inscrit en
    Décembre 2010
    Messages
    404
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Décembre 2010
    Messages : 404
    Par défaut
    Le fait de rendre tes classes serialisable t'a débarrassé de ce problème :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    The service class "mpkg.test.Kol" does not comply to one or more requirements of the JAX-RPC 1.1 specification, and may not deploy or function correctly.
      The method "Afficher" on the service class "mpkg.test.Kol" uses a data type, "java.util.List", that is not supported by the JAX-RPC specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result.
      The field or property "throwable" on the value type "net.sf.hibernate.exception.NestableException" used via the service class "mpkg.test.Kol" has a data type, "java.lang.Throwable", that is not supported by the JAX-RPC 1.1 specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result.
      The field or property "cause" on the value type "net.sf.hibernate.exception.NestableException" used via the service class "mpkg.test.Kol" has a data type, "java.lang.Throwable", that is not supported by the JAX-RPC 1.1 specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result.
      The field or property "throwables" on the value type "net.sf.hibernate.exception.NestableException" used via the service class "mpkg.test.Kol" has a data type, "java.lang.Throwable", that is not supported by the JAX-RPC 1.1 specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result.

    Pour ton NoClassDefFoundError :
    En général NoClassDefFoundError signifie que tu n'as pas chargé un jar.
    Il faut que tu trouves d'où vient cette classe, et que tu intègres le jar correspondant à ton application web sur tomcat.


    Si tu ne trouve rien regarde ça, c'est le même problème :
    http://www.developpez.net/forums/d21...nateexception/

  5. #5
    Membre averti
    Inscrit en
    Mai 2010
    Messages
    32
    Détails du profil
    Informations forums :
    Inscription : Mai 2010
    Messages : 32
    Par défaut
    Pour info j'utilise aussi Hibernate 2 et quand je teste ma classe elle marche sans problème mais j'ai les erreurs quand je crée le service web de ma classe.

    Tous les jars sont ajoutés, je ne comprends pas...

  6. #6
    Membre éclairé Avatar de rockley
    Homme Profil pro
    Inscrit en
    Décembre 2010
    Messages
    404
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Décembre 2010
    Messages : 404
    Par défaut
    Vérifie que dans tes jars t'as bien net/sf/hibernate/HibernateException.
    Vérifie que tous tes jar sont dans ton ClassPath d'Eclipse.

    Si tu ne les trouves pas tu peux les télécharger ici :http://sourceforge.net/projects/hibernate/files/

    De plus, ça aiderait si tu pouvais mettre les logs au complet (ceux Tomcat).

Discussions similaires

  1. web service & hibernate
    Par zikovich dans le forum Services Web
    Réponses: 0
    Dernier message: 04/03/2011, 16h37
  2. Web Service - Spring - Hibernate - CXF
    Par Modzful dans le forum Services Web
    Réponses: 2
    Dernier message: 07/05/2010, 15h22
  3. Web-service sur tomcat & Hibernate
    Par gbinico dans le forum Services Web
    Réponses: 0
    Dernier message: 02/11/2009, 21h52
  4. Web-service sur tomcat & Hibernate
    Par gbinico dans le forum Tomcat et TomEE
    Réponses: 0
    Dernier message: 02/11/2009, 21h35
  5. configurer hibernate sous Spring web services
    Par MyPaiN dans le forum Hibernate
    Réponses: 2
    Dernier message: 25/05/2009, 11h22

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