This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
NB 200706270000 & GF v2 52. Got exception while accessing a JavaMail Resource injected within a Servlet (calling the sendMail method) in a Web application. ** create a New web application ** add a JavaMail resource with default values in wizard: mail/mySession <mail-resource debug="true" enabled="true" from="testnb@gamay-03.france.sun.com" host="gamay-03.france.sun.com" jndi-name="mail/mySession" object-type="user" store-protocol="imap" store-protocol-class="com.sun.mail.imap.IMAPStore" transport-protocol="smtp" transport-protocol-class="com.sun.mail.smtp.SMTPTransport" user="testnb"> <description>nouar conf</description> </mail-resource> ** add a servlet (NewServlet) inside the project within a source package <> default. ** in Servlet code: Add the previous created resource in editor: click right and in "Enterprise Resources" choose "Send an Email" and give the jdni-name = mail/mySession ** verify in code: that @Resource is done + the sendMail method + the needed imports: ok ** build/"Undeploy & Deploy" the web app: OK ** Access the Servlet page: http://localhost:8080/WebApplication6/NewServlet got the exception message added in the Servlet code when sendMail method is called. "Got exception in sendMail method Invalid Addresses" PING gamay-03.france.sun.com: 56 data bytes 64 bytes from gamay-03 (129.157.201.114): icmp_seq=0. time=0. ms will join the code of the servlet. Output-server can see: <<< Added Resource Type: mail-resource ADM1041:Sent the event to instance:[ResourceDeployEvent -- reference-added mail/mail/mySession] CORE5004: Resource Deployed: [mail:mail/mySession]. DEBUG: JavaMail version 1.4.1ea-SNAPSHOT DEBUG: not loading file: /usr/jdk/instances/jdk1.6.0/jre/lib/javamail.providers DEBUG: java.io.FileNotFoundException: /usr/jdk/instances/jdk1.6.0/jre/lib/javamail.providers (No such file or directory) DEBUG: !anyLoaded DEBUG: not loading resource: /META-INF/javamail.providers DEBUG: successfully loaded resource: /META-INF/javamail.default.providers DEBUG: Tables of loaded providers DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]} DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]} DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map DEBUG: !anyLoaded DEBUG: not loading resource: /META-INF/javamail.address.map DEBUG: not loading file: /usr/jdk/instances/jdk1.6.0/jre/lib/javamail.address.map DEBUG: java.io.FileNotFoundException: /usr/jdk/instances/jdk1.6.0/jre/lib/javamail.address.map (No such file or directory) ADM1041:Sent the event to instance:[ResourceDeployEvent -- reference-removed null/mail/mySession] CORE5006: Resource UnDeployed: [mail:mail/mySession]. deployed with moduleid = WebApplication6 Added Resource Type: mail-resource ADM1041:Sent the event to instance:[ResourceDeployEvent -- reference-added mail/mail/mySession] CORE5004: Resource Deployed: [mail:mail/mySession]. >>>
Created attachment 44529 [details] added the servlet code
This appears to be an application error. The log message indicates that the ping of the address failed. PING gamay-03.france.sun.com: 56 data bytes 64 bytes from gamay-03 (129.157.201.114): icmp_seq=0. time=0. ms Also, the server has error messages indicating that it could not load javamail.address.map Have to investigate to see what are the requirements for using JavaMail in an app. Lowering to P3 as it is most likely a configuration issue and nothing that the plugin or IDE is doing wrong
Cannot reproduce exception. I think the defined mail resource is wrong. Following is snippet on creating a mail resource from the EE tutorial, Creating a Mail Session To create a mail session in the Application Server using the Admin Console, follow these steps: 1. Open the URL http://localhost:4848/asadmin in a browser. 2. Select the JavaMail Sessions node. 3. Click New. 4. Type mail/MySession in the JNDI Name field. 5. Type the name of the host running your mail server in the Mail Host field. 6. Type the destination email address in the Default User field. 7. Type your email address in the Default Return Address field. 8. Click OK. 9. Note that mail/MySession is listed under the JavaMail Sessions node. Please reopen if you still see the issue
NB 6.0 20070820 & GF v2 b58c on solaris-sparc: was able to receive the mail sent to my desktop as Mail server and to myself as a valid user each time accessing the servlet. I've created the java mail resource with the wizard in IDE. thanks for investigating.