Bonjour;
j'ai crée un EJB3 avec un client, j'ai fais la connexion entre les deux mais quand je lance le client j'ai une erreur voici mon code :
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 package FilePackage; import javax.ejb.Remote; @Remote public interface FileRemote { public int emfiler(int element); public int défiler(); public boolean estVide(); public boolean estPleine(); public int sommet(); public void affichage(); public int taille(); public int priorite(); }voici mon client :
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 package FilePackage; import java.util.Vector; import javax.annotation.PostConstruct; import javax.ejb.Stateful; @Stateful (mappedName="File") public class File implements FileRemote { Vector<Champ> file; public File() { file=new Vector<Champ>(10); } public File(int num,int pro) { file=new Vector<Champ>(num,pro); } @PostConstruct public void initialize () { this.file= null; file.setSize(0); } @Override public int emfiler(int element) { return element; } @Override public int défiler() { return element; } @Override public boolean estVide() { return file.size()==0; } @Override public boolean estPleine() { return file.size()==10; } @Override public int sommet() { return file.firstElement().getNum(); } @Override public void affichage() { } @Override public int taille() { return file.size(); } @Override public int priorite() { return indice; } }
et voici l'erreur :
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 package Client; import java.util.Properties; import FilePackage.File; import FilePackage.FileRemote; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; public class client { public static void main(String[] args) throws NamingException { // TODO Auto-generated method stub Properties props=System.getProperties(); props.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); props.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); props.put("java.naming.provider.url", "localhost:1099"); Context context = new InitialContext(props); System.out.println("Context lookup finished"); FileRemote file=(FileRemote)(context.lookup("File/remote"));
je vois pas ou est le problème, qui pourra m'aider svp
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 Context lookup finished Exception in thread "main" javax.naming.NamingException: Could not dereference object [Root exception is java.lang.reflect.UndeclaredThrowableException] at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1150) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:705) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587) at javax.naming.InitialContext.lookup(Unknown Source) at Client.client.main(client.java:29) Caused by: java.lang.reflect.UndeclaredThrowableException at $Proxy0.createProxy(Unknown Source) at org.jboss.ejb3.JndiProxyFactory.getObjectInstance(JndiProxyFactory.java:53) at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source) at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1125) at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1142) ... 4 more Caused by: java.lang.ClassNotFoundException: EJB.Ifile at org.jboss.remoting.serialization.ClassLoaderUtility.loadClass(ClassLoaderUtility.java:82) at org.jboss.remoting.loading.RemotingClassLoader.loadClass(RemotingClassLoader.java:76) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.resolveProxyClass(ObjectInputStreamWithClassLoader.java:248) at java.io.ObjectInputStream.readProxyDesc(Unknown Source) at java.io.ObjectInputStream.readClassDesc(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at org.jboss.aop.joinpoint.InvocationResponse.readExternal(InvocationResponse.java:122) at java.io.ObjectInputStream.readExternalData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.defaultReadFields(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObjectVersion2_2(JavaSerializationManager.java:239) at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:133) at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:120) at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.versionedRead(MicroSocketClientInvoker.java:943) at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:584) at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122) at org.jboss.remoting.Client.invoke(Client.java:1550) at org.jboss.remoting.Client.invoke(Client.java:530) at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.remoting.IsLocalProxyFactoryInterceptor.invoke(IsLocalProxyFactoryInterceptor.java:70) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:61) at $Proxy0.createProxy(Unknown Source) at org.jboss.ejb3.JndiProxyFactory.getObjectInstance(JndiProxyFactory.java:53) at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source) at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1125) at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1142) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:705) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587) at javax.naming.InitialContext.lookup(Unknown Source) at Client.client.main(client.java:29) at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.ejb3.remoting.IsLocalProxyFactoryInterceptor.invoke(IsLocalProxyFactoryInterceptor.java:70) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:61) ... 9 more
Partager