Eclipse WTP – impossible de déployer des EJBs dans JOnAS
En utilisant WTP 1.5 et Eclipse 3.2, lors du déploiement de modules EJBs dans JOnAS, il arrive de rencontrer cette erreur dans la console JOnAS :
2006-07-26 09:46:10,105 : Server.start : Le serveur JOnAS 'jonas' est démarré sur rmi/jrmp 2006-07-26 09:47:03,589 : EarServiceImpl.unDeployEarMBean : Error when trying to get the canonical file from C:/JONAS_4_7_5/apps/autoload/myproject-ear.earSyntaxe du nom de fichier, de répertoire ou de volume incorrecte C:/JONAS_4_7_5/apps/autoload/myproject-ear.ear is using DTDs, WsGen needs Schema only : META-INF/jonas-ejb-jar.xml use a DTD. Only XML Schema are accepted for J2EE 1.4 webservices 2006-07-26 09:47:05,261 : EJBServiceImpl.checkGenIC : JOnAS version was not found in the '/C:/JONAS_4_7_5/work/apps/jonas/myproject-ear_2006.07.26-09.47.04/myproject-ejb.jar' manifest file. Auto-generating container classes... GenIC for JOnAS 4.7.5: 'MyService' generation ... No javac command was found at 'C:Program FilesJavajre1.5.0_07..binjavac'. Check that you are using a JDK and not a JRE. 2006-07-26 09:47:06,402 : Cmd.run : exception java.io.IOException: CreateProcess: "C:/Program Files/Java/jre1.5.0_07/../bin/javac" -classpath C:/DOCUME~1/MYUSERLOCALS~1/Temp/genic6738.tmp;/C:/JONAS_4_7_5/work/apps/jonas/myproject-ear_2006.07.26-09.47.04/myproject-ejb.jar;;C:/JONAS_4_7_5/conf;C:/JONAS_4_7_4/conf;C:/JONAS_4_7_5/lib/commons/j2ee/connector-1_5.jar;C:/JONAS_4_7_5/lib/commons/j2eeejb-2_1-api.jar;C:/JONAS_4_7_5/lib/commons/j2ee/emb-jsr86-api.jar;C:/JONAS_4_7_5/lib/commons/j2ee/gnu-jaf.jar;C:/JONAS_4_7_5/lib/commons/j2ee/gnu-mail.jar;C:/JONAS_4_7_5/lib/commons/j2ee/gnu-providers.jar;C:/JONAS_4_7_5/lib/commons/j2ee/jacc-1_0.jar;C:/JONAS_4_7_5/lib/commons/j2ee/javax77.jar;C:/JONAS_4_7_5/lib/commons/j2ee/jaxr-api.jar;C:/JONAS_4_7_5/lib/commons/j2ee/jaxrpc.jar;C:/JONAS_4_7_5/lib/commons/j2eejms.jar;C:/JONAS_4_7_5/lib/commons/j2ee/jsp-2_0.jar;C:/JONAS_4_7_5/lib/commons/j2ee/jsr88-api.jar;C:/JONAS_4_7_5/lib/commons/j2ee/jta-spec1_0_1.jar;C:/JONAS_4_7_5/lib/commons/j2ee/saaj.jar;C:/JONAS_4_7_5/lib/commons/j2ee/servlet-2_4.jar;C:/JONAS_4_7_5/lib/commons/j2ee/wsdl4j.jar;C:/JONAâ€
at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) at java.lang.ProcessBuilder.start(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at java.lang.Runtime.exec(Unknown Source) at org.objectweb.common.Cmd.run(Cmd.java:147) at org.objectweb.jonas_ejb.genic.GenIC.compilClasses(GenIC.java:887) at org.objectweb.jonas_ejb.genic.GenIC.main(GenIC.java:425) 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 org.objectweb.jonas_ejb.genic.wrapper.GenicServiceWrapper.callGenic(GenicServiceWrapper.java:68) at org.objectweb.jonas.server.J2EEServerMBean.callGenic(J2EEServerMBean.java:450) at org.objectweb.jonas.server.J2EEServerMBean.deployLocalFile(J2EEServerMBean.java:235) 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 org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:454) at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(Unknown Source) at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(Unknown Source) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source) at org.objectweb.jonas.container.EJBServiceImpl.checkGenIC(EJBServiceImpl.java:1771) at org.objectweb.jonas.ear.EarServiceImpl.deployEar(EarServiceImpl.java:803) at org.objectweb.jonas.ear.EarServiceImpl.deployEarMBean(EarServiceImpl.java:1219) at org.objectweb.jonas.adm.Adm.addEar(Adm.java:288) 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 sun.rmi.server.UnicastServerRef.dispatch(Unknown Source) at org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.dispatch(JUnicastServerRef.java:143) at sun.rmi.transport.Transport$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Unknown Source) at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source) at java.lang.Thread.run(Unknown Source) GenIC fatal error: Failed when compiling the generated classes via java compiler 2006-07-26 09:47:06,418 : J2EEServerMBean.deployLocalFile : Cannot generate classes for this application : '/C:/JONAS_4_7_5/work/apps/jonas/myproject-ear_2006.07.26-09.47.04/myproject-ejb.jar. Problems when invoking main method from GenIC: java.lang.RuntimeException: Failed when compiling the generated classes via java compiler'. 2006-07-26 09:47:06,496 : JFactory.checkJonasVersion : failed to find class org.objectweb.jonas_gen.com.mycompany.myproject.JOnASMyService_491313683Home java.lang.ClassNotFoundException: org.objectweb.jonas_gen.com.mycompany.myproject.JOnASMyService_491313683Home at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at org.objectweb.jonas_ejb.container.JFactory.checkJonasVersion(JFactory.java:981) at org.objectweb.jonas_ejb.container.JFactory.init(JFactory.java:191) at org.objectweb.jonas_ejb.container.JFactory.<init>(JFactory.java:168) at org.objectweb.jonas_ejb.container.JSessionFactory.<init>(JSessionFactory.java:83) at org.objectweb.jonas_ejb.container.JStatelessFactory.<init>(JStatelessFactory.java:83) at org.objectweb.jonas_ejb.container.JContainer.addBean(JContainer.java:237) at org.objectweb.jonas.container.EJBServiceImpl.createContainer(EJBServiceImpl.java:815) at org.objectweb.jonas.container.EJBServiceImpl.deployJars(EJBServiceImpl.java:1477) at org.objectweb.jonas.ear.EarServiceImpl.deployEar(EarServiceImpl.java:929) at org.objectweb.jonas.ear.EarServiceImpl.deployEarMBean(EarServiceImpl.java:1219) at org.objectweb.jonas.adm.Adm.addEar(Adm.java:288) 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 sun.rmi.server.UnicastServerRef.dispatch(Unknown Source) at org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.dispatch(JUnicastServerRef.java:143) at sun.rmi.transport.Transport$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Unknown Source) at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source) at java.lang.Thread.run(Unknown Source) 2006-07-26 09:47:06,496 : EJBServiceImpl.deployJars : Error when deploying '/C:/JONAS_4_7_5/work/apps/jonas/myproject-ear_2006.07.26-09.47.04/myproject-ejb.jar' javax.ejb.EJBException: MyService Cannot load org.objectweb.jonas_gen.com.mycompany.myproject.JOnASMyService_491313683Home at org.objectweb.jonas_ejb.container.JSessionFactory.<init>(JSessionFactory.java:98) at org.objectweb.jonas_ejb.container.JStatelessFactory.<init>(JStatelessFactory.java:83) at org.objectweb.jonas_ejb.container.JContainer.addBean(JContainer.java:237) at org.objectweb.jonas.container.EJBServiceImpl.createContainer(EJBServiceImpl.java:815) at org.objectweb.jonas.container.EJBServiceImpl.deployJars(EJBServiceImpl.java:1477) at org.objectweb.jonas.ear.EarServiceImpl.deployEar(EarServiceImpl.java:929) at org.objectweb.jonas.ear.EarServiceImpl.deployEarMBean(EarServiceImpl.java:1219) at org.objectweb.jonas.adm.Adm.addEar(Adm.java:288) 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 sun.rmi.server.UnicastServerRef.dispatch(Unknown Source) at org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.dispatch(JUnicastServerRef.java:143) at sun.rmi.transport.Transport$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Unknown Source) at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: org.objectweb.jonas_gen.com.mycompany.myproject.JOnASMyService_491313683Home at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at org.objectweb.jonas_ejb.container.JSessionFactory.<init>(JSessionFactory.java:96) ... 19 more 2006-07-26 09:47:06,496 : EJBServiceImpl.deployJars : Undeploy ejb-jar of the ear application 2006-07-26 09:47:06,496 : EJBServiceImpl.deployJars : Cannot remove the non-existant container '/C:/JONAS_4_7_5/work/apps/jonas/myproject-ear_2006.07.26-09.47.04/myproject-ejb.jar' 2006-07-26 09:47:06,496 : EarServiceImpl.deployEar : Error during the deployment of the jars files of the Ear file C:/JONAS_4_7_5/apps/autoload/myproject-ear.ear': Error during the deployment: javax.ejb.EJBException: MyService Cannot load org.objectweb.jonas_gen.com.mycompany.myproject.JOnASMyService_491313683Home 2006-07-26 09:47:06,496 : EarServiceImpl.deployEarMBean : Cannot deploy file 'C:/JONAS_4_7_5/apps/autoload/myproject-ear.ear'
Comme l’explique à juste titre le message d’erreur, la tâche Ant qui génère les EJBs est lancée par le JRE au lieu du JDK[1]. Et c’est pourquoi l’outil GenIC ne trouve pas le programme javac
.
Le problème peut être résolu en lancant votre serveur d’applications[2] avec le JDK au lieu du JRE Pour celà, il faut procéder ainsi :
- Vérifier la configuration du JDK dans Eclipse
- Aller dans Windows -> Preferences… -> Java -> Installed JREs
- S’il n’y a aucun JDK dans la liste des Installed JRE, en ajouter un soit avec Add… soit avec Search…
- Configurer le serveur d’applications JOnAS avec WTP
- Aller dans Windows -> Preferences… -> Server -> Installed Runtimes
- Sélectionner le serveur d’applications utilisé[3] et cliquer sur Edit…
- Modifier le JRE en sélectionnant un JDK, puis cliquer sur Finish et enfin sur OK
Pour que la modification soit effective, il faut redémarrer le serveur d’application bien entendu. Maintenant vos petits EJBs peuvent être déployés ! 🙂
Notes
[1] Il semble que ce soit un bug de Ant !?
[2] Ici JOnAS.
[3] Dans mon cas, c’est JOnAS v4.
https://blog.lecacheur.com/2006/07/27/eclipse-wtp-impossible-de-deployer-des-ejbs-dans-jonas/DéveloppementJava EEeclipse,ejb,jonasEn utilisant WTP 1.5 et Eclipse 3.2, lors du déploiement de modules EJBs dans JOnAS, il arrive de rencontrer cette erreur dans la console JOnAS : 2006-07-26 09:46:10,105 : Server.start : Le serveur JOnAS 'jonas' est démarré sur rmi/jrmp 2006-07-26 09:47:03,589 : EarServiceImpl.unDeployEarMBean : Error when trying to get the canonical file from...SeBSébastien LECACHEUR23r0@laposte.netAdministratorLe weblogue de SeB
Merci beaucoup !!!!
Apres de long moment de recherche enfin une réponse 🙂
Donc écrire les solutions de ces problemes qqpart ca sert pas à rien !!! et j’encourage tout le monde à le faire !!!
Content de voir que mon aide-mémoire ait pu t’aider. 😉