RSS Feed

Articles associés au tag ‘jonas’

Support de JOnAS dans Netbeans 5.5

21 September 2006 par SeB Pas de commentaire »

J’ai plutôt l’habitude de parler d’Eclipse. Cependant, aujourd’hui c’est l’IDE Netbeans qui est à l’affiche.

Effectivement, le projet JOnbAS est un nouveau module pour Netbeans 5.5 qui ajoute le support de JOnAS. Il permet :

  • Le démarrage et l’arrêt du serveur.
  • Le débuguage des JSP et du Java.
  • La génération des descripteurs de déploiement spécifiques.
  • Le déploiement des EAR, EJB et WAR.
  • L’exploration des modules déployés.

Ce module est rapide à installer et vraiment très simple à utiliser.

Ce travail est le résultat des efforts réalisés par Stepan Herolds. Tout retour d’expérience, rapport d’anomalie ou suggestion sont les bienvenus.

 

JOnAS XDoclet – accéder à l’interface locale des EJBs

8 September 2006 par SeB Pas de commentaire »

Vous générez vos EJBs avec XDoclet et les déployez dans JOnAS ? Et vous n’arrivez à pas accéder à l’interface locale ?

Dès que vous faites un appel à la méthode :

MyEJBServiceUtil.getLocalHome();

L’exception suivante est levée :

javax.naming.NameNotFoundException: MyEJBServiceLocal 	at
	com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:95) 	at
	javax.naming.InitialContext.lookup(InitialContext.java:355) 	at
	org.objectweb.carol.jndi.spi.AbsContext.lookup(AbsContext.java:140) 	at
	org.objectweb.carol.jndi.spi.AbsContext.lookup(AbsContext.java:150) 	at
	javax.naming.InitialContext.lookup(InitialContext.java:351) 	at
	org.objectweb.carol.jndi.spi.MultiContext.lookup(MultiContext.java:118) 	at
	javax.naming.InitialContext.lookup(InitialContext.java:351) 	at
	com.company.project.ejb.MyEJBServiceUtil.lookupHome(MyEJBServiceUtil.java:22) 	at
	com.company.project.ejb.MyEJBServiceUtil.getLocalHome(MyEJBServiceUtil.java:64) 	at
	com.company.project.ejb.MyEJBServiceBean.myService(MyEJBServiceBean.java:112) 	at
	org.objectweb.jonas_gen.com.company.project.ejb.JOnASMyEJBService_69323337Remote.myService(JOnASMyEJBService_69323337Remote.java:56) 	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:585) 	at
	sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294) 	at
	org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.dispatch(JUnicastServerRef.java:143) 	at
	sun.rmi.transport.Transport$1.run(Transport.java:153) 	at
	java.security.AccessController.doPrivileged(Native Method) 	at
	sun.rmi.transport.Transport.serviceCall(Transport.java:149) 	at
	sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466) 	at
	sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707) 	at
	java.lang.Thread.run(Thread.java:595)

En fait, JOnAS ne permet pas de configurer la référence JNDI de votre interface locale. Cette référence est obligatoirement égale à la référence JNDI de l’interface distante à laquelle il est ajouté la chaîne de caractère _L. Ainsi, si la référence distante JNDI de votre EJB est MyEJBService, la référence locale est MyEJBService_L.

Donc, pour cet exemple, les tags XDoclet à positionner sont :

/* * @ejb.bean
 *      name="MyEJBService"
 *      type="Stateless"
 *      view-type="local"
 *      jndi-name="MyEJBService"
 *      local-jndi-name="MyEJBService_L"
 * @jonas.bean
 *      ejb-name="MyEJBService"
 *      jndi-name="MyEJBService"
 */

Maintenant, vous êtes capable de récupérer l’interface locale d’un EJB généré avec XDoclet et déployé sous JOnAS.

 

Eclipse WTP – impossible de déployer des EJBs dans JOnAS

27 July 2006 par SeB 2 commentaires »

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.

lire la suite…