-
1. Re: JavaMail on JBoss AS 7.1.x
ctomc Feb 10, 2012 5:17 PM (in response to chufaca)Hi,
what is exact version of AS 7.1.x that you are using? there ware some bugs in CR1, all should be fixed in nightly builds after first week of january.
can you paste the stacktrace?
and you are sure that smtp is listening and accepting connection on localhost 25?
cheers,
tomaz
-
2. Re: JavaMail on JBoss AS 7.1.x
jaikiran Feb 13, 2012 12:53 AM (in response to chufaca)Facundo Contrera wrote:
Caused by: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
The method that gave my that exception is javax.naming.Context.lookup(String name)
What does your jndi.properties (if any) or the InitialContext properties that you use look like?
-
3. Re: JavaMail on JBoss AS 7.1.x
chufaca Feb 13, 2012 7:25 AM (in response to jaikiran)There isn't any jndi.properties, I just config the standalone.xml. The Context I use is "org.jnp.interfaces.NamingContextFactory" (the same I used for jboss-5.1.0.GA).
I think that the error is not because socket binding or port, or whatever... but because of that Naming Factory which doesn't recognize java:/Mail as a properly JNDI Name.
I saw that in the mail-service.xml in JBoss 5 we had to add the "<depends>jboss:service=Naming</depends>", but in JBoss 7.1 I haven't configurated anything in the subsystem "naming".
Does this make any sense?
-
4. Re: JavaMail on JBoss AS 7.1.x
ctomc Feb 13, 2012 7:58 AM (in response to chufaca)1 of 1 people found this helpfulHi,
From where are you trying to do jndi lookup? from inside the application that is deployed in AS7?
if that is the case you just use default NamingContextFactory. org.jnp.interfaces.NamingContextFactory does not exits anymore in AS7.
Here is sample code that will get you mail session:
InitialContext ic = new InitialContext(); Session s = (Session)ic.lookup("java:/Mail); ic.close();
that is all of the code needed (i have omited try catch), no special InitialContext setup and passing properties
can you try this?
--
tomaz
-
5. Re: JavaMail on JBoss AS 7.1.x
chufaca Feb 13, 2012 8:06 AM (in response to chufaca)That was the error! The context in AS7 has to be "org.jboss.as.naming.InitialContextFactory" instead of "org.jnp.interfaces.NamingContextFactory".
Thanks for all your help!