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 EE Discussion :

Problème EJB: java.lang.ClassFormatError


Sujet :

Java EE

  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    41
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 41
    Par défaut Problème EJB: java.lang.ClassFormatError
    J'ai déployé un EJB avec succes sur JBoss 5.1.0GA.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
     
    @Remote
    public interface ConnectionService {
     
        public void connect(String user, String pwd) throws ConnectionException;
     
        public void disconnect() throws ConnectionException;
     
    }
     
    @Stateless
    public class ConnectionServiceBean implements ConnectionService {
        ...
    }
    Et après, j'ai ajouté ce ejb-jar et tous les jars du répertoire JBoss/client/ dans mon projet client swing. Ensuite, je lance le client qui execute les lignes suivantes:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
         ...
         ConnectionService cs=EJBProxy.getInstance().getConnectionService();
         cs.connect("user", "pwd");
    Avec debug, je vois que la première ligne marche bien (cs n'est pas null). Mais à l'execution de la deuxième ligne, j'ai l'exception suivante.

    Quelqu'un a une idée? Merci à l'avance!

    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
     
    java.lang.reflect.UndeclaredThrowableException
            at $Proxy2.connect(Unknown Source)
            at info.j2ee.client.connection.ConnectDialog.connectBtnActionPerformed(ConnectDialog.java:74)
            at info.j2ee.client.connection.ConnectDialog.access$000(ConnectDialog.java:16)
            at info.j2ee.client.connection.ConnectDialog$1.actionPerformed(ConnectDialog.java:47)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
            at java.awt.Component.processMouseEvent(Component.java:6263)
            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:4238)
            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.pumpEventsForFilter(EventDispatchThread.java:178)
            at java.awt.Dialog$1.run(Dialog.java:1045)
            at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
            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: java.security.PrivilegedActionException: java.lang.reflect.InvocationTargetException
            at java.security.AccessController.doPrivileged(Native Method)
            at org.jboss.ejb3.security.client.SecurityActions.createSecurityContext(SecurityActions.java:657)
            at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:59)
            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
            at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
            at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
            at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
            at $Proxy3.invoke(Unknown Source)
            at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
            at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
            ... 35 more
    Caused by: java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
            at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
            at org.jboss.security.SecurityContextFactory.createSecurityContext(SecurityContextFactory.java:117)
            at org.jboss.security.SecurityContextFactory.createSecurityContext(SecurityContextFactory.java:76)
            at org.jboss.ejb3.security.client.SecurityActions$1.run(SecurityActions.java:662)
            ... 45 more
    Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/security/jacc/PolicyContextException
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
            at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
            at org.jboss.security.plugins.JBossSecurityContext.<init>(JBossSecurityContext.java:82)
            ... 52 more

  2. #2
    Membre averti
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    41
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 41
    Par défaut
    Ben, j'ai trouvé le problème

    En fait, quand je crée un projet EAR, Netbeans systématiquement ajoute une librairie 'j2ee 6 api library' dans le classpath. Ca fait des doublons quand j'ajoute encore des jars j2ee du /jboss/client/.

    J'enlève le 'j2ee 6 api library'. Et tout marche

  3. #3
    Membre émérite Avatar de Heimdal
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    549
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 549
    Par défaut
    Salut,

    sans doute manque-t-il l'implémentation de jee au classpath de ton client

    EDIT: grillé et HS

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

Discussions similaires

  1. [EJB3.1] Injection avec @ejb et problème de java.lang.NullPointerException
    Par ensatTetouan dans le forum Java EE
    Réponses: 1
    Dernier message: 04/03/2012, 03h00
  2. Problème simpliste : java.lang.NoClassDefFoundError
    Par gazier20 dans le forum Spring
    Réponses: 8
    Dernier message: 15/06/2009, 15h14
  3. problème de java.lang.NullPointerException
    Par vince351 dans le forum AWT/Swing
    Réponses: 3
    Dernier message: 28/03/2007, 08h36
  4. Réponses: 1
    Dernier message: 14/10/2006, 07h13
  5. Problème de java.lang.NoClassDefFoundError
    Par nramariavelo dans le forum Hibernate
    Réponses: 5
    Dernier message: 13/06/2006, 14h54

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