[jboss-user] [Installation, Configuration & Deployment] - Re: 4.05GA javamail problem

bezdomny do-not-reply at jboss.com
Mon Oct 23 12:04:43 EDT 2006


Hey Dimitris,
I would if I could, but as soon as the MimeMessage(mailSession) constructor is called and InvocationTargetException is thrown, then I see the java.lang.NoClassDefFoundError: com/sun/mail/util/SharedByteArrayInputStream

Here is my method:

public void sendMessage() {
    	
    	try {
    		Session mailSession =  null;
			
    		try { 
				Context ctx = new InitialContext();
				Object objref = ctx.lookup("java:/Mail");
				mailSession = (Session) PortableRemoteObject.narrow(objref, Session.class); 
			} catch (NamingException e) {
				
				System.out.println(e);
				e.printStackTrace();
			}
	        
			MimeMessage msg = new MimeMessage(mailSession);
			
			msg.setSubject(subject);
			msg.setSentDate(new Date());
			msg.setFrom();
			msg.setRecipients(Message.RecipientType.TO, getAddresses());
			msg.setText(mailMessage); 

			Transport.send(msg);
		
    	}
    	catch (MessagingException e) {
    		logger.log(Level.SEVERE, "messaging error: ", e);
    	} 
    }

Bob



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3980094#3980094

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3980094



More information about the jboss-user mailing list