Issue Details (XML | Word | Printable)

Key: GLASSFISH-18610
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Tim Quinn
Reporter: Dennis MacConnell
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
glassfish

JNDI lookup of javamail resource returns a type (javax.naming.Reference) that can not be cast to javax.mail.Session

Created: 10/Apr/12 12:39 PM   Updated: 18/Jun/12 03:13 PM   Resolved: 18/Jun/12 03:10 PM
Component/s: standalone_client
Affects Version/s: 4.0
Fix Version/s: 4.0_b42

Time Tracking:
Not Specified

File Attachments: 1. XML File application-client.xml (0.6 kB) 10/Apr/12 12:39 PM - Dennis MacConnell
2. XML File glassfish-application-client.xml (0.4 kB) 10/Apr/12 12:39 PM - Dennis MacConnell
3. Java Source File Main.java (0.6 kB) 10/Apr/12 12:39 PM - Dennis MacConnell

Issue Links:
Related
 

Tags:
Participants: Cheng Fang, Dennis MacConnell and Tim Quinn


 Description  « Hide

There are a few CTS javamail tests that fail due to this issue.

The following line in a JavaEE appclient program causes a ClassCastException: javax.naming.Reference cannot be cast to javax.mail.Session

Session session = (Session) ic.lookup("java:comp/env/mail/MailSession");

I attached a simple appclient program to reproduce it



Cheng Fang added a comment - 18/Apr/12 09:36 PM

The most likely cause is some classes that are needed on the client side are not availabel at runtime. That could also explain why the same set tests fail in remote client, but pass in server environment.

I remember some time back javax.mail.jar was split into 3 jars, along with some other refactoring:

rw-rr-@ 1 staff 26926 Apr 17 13:19 javamail-connector.jar
rw-rr-@ 1 staff 12859 Apr 17 13:19 javamail-runtime.jar
rw-rr-@ 1 staff 507980 Apr 17 13:19 javax.mail.jar

Dennnis, can you try including both javax.mail.jar and javamail-runtime.jar in appclient classpath?


Dennis MacConnell added a comment - 19/Apr/12 02:54 PM

Adding javamail-connector.jar & javamail-runtime.jar to the appclient command classpath resolves the problem.


Cheng Fang added a comment - 19/Apr/12 03:24 PM

Assign to appclient team to see if we can fix gf-client.jar.

gf-client.jar references javax.mail.jar but not javamail-runtime.jar.


Tim Quinn added a comment - 18/Jun/12 03:10 PM

Fix checked in.

Project: glassfish
Repository: svn
Revision: 54626
Author: tjquinn
Date: 2012-06-18 15:09:33 UTC
Link:

Log Message:
------------
Fix for 18610

App clients that use JavaMail were not working correctly without explicitly adding two JavaMail-related JARs to the class path.

This change makes those JARs available to clients.

pom.xml change approved: Romain
Tests: QL, deployment devtests

Revisions:
----------
54626

Modified Paths:
---------------
trunk/main/appserver/appclient/client/acc/pom.xml


Tim Quinn added a comment - 18/Jun/12 03:13 PM

While resolving 18610 I discovered that even after a mail session was removed on the server, as long as the server was not restarted new runs of the client could continue to open sessions using the resource. Issue 18800 tracks that separate bug.