[b]javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at beanManaged.Entrepriseaction.main(Entrepriseaction.java:29)
Exception in thread "main" java.lang.NullPointerException
at beanManaged.Entrepriseaction.main(Entrepriseaction.java:34)/b
super_toinou
Messages postés764Date d'inscriptionmardi 25 mai 2004StatutMembreDernière intervention 8 mars 20116 2 sept. 2010 à 18:34
Hello,
c'est ton client qui est incapable d'appeler le serveur.
Soit tu mets tout ce qu'il faut dans les variables d'environnement.
Soit tu mets (et c'est plus la norme) un fichier jndi.properties dans ton classpath contenant au moins les infos suivantes:
java.naming.factory.initial=la factory pour ton serveur
java.naming.factory.url.pkgs=les urls de packages pour ton serveur
java.naming.provider.url=host:port
et après tu fais
Context ctx = new InitialContext();
pour les propriétés du fichier jndi.properties, cherche sur le net des s exemples en fonction de ton serveur d'app
le problem est le suivant :
quand je sauvegarde ce fichier dans la racine il affiche toujour la meme erreur precedente et si je le sauvegarde dans la racine src
j'ai cette erreur
log4j:[b]WARN No appenders could be found for logger (org.jnp.interfaces.NamingContext).
log4j:WARN Please initialize the log4j system properly.
javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]]
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1414)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:594)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(Unknown Source)
at beanManaged.Entrepriseaction.main(Entrepriseaction.java:32)
Caused by: javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:269)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1385)
... 4 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused: connect]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:243)
... 5 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.(Unknown Source)
at java.net.Socket.(Unknown Source)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:84)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:77)
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:239)
... 5 more
Exception in thread "main" java.lang.NullPointerException
at beanManaged.Entrepriseaction.main(Entrepriseaction.java:37)/b
aya2007
Messages postés11Date d'inscriptionvendredi 1 juin 2007StatutMembreDernière intervention10 janvier 2011 3 sept. 2010 à 15:38
Merçi beaucoup je vais ésséyer avec jboss car j'utilise tomcat
je veux savoir maitenant comment faire le lien entre mon ejb statefull et un formulaire JSF qui fait le traitement d'une table des entreprises "affichage ajout suppression.." es ce que je declare ma classe de test EJB comme manager bean ??