1 Reply Latest reply on Jan 31, 2006 6:58 AM by J Edgar

    Using JavaMail within a SessionBean: RMI class loader disabl

    J Edgar Newbie

      Hello,

      we want to implement a method in a SessionBean which uses the standard JBoss Mailservice. The lookup of javax.mail.Session works, but sending the mail with "javax.mail.Transport.send()" produced an exception.
      Is is a classloader configuration Problem ? ("no security manager: RMI class loader disabled")

      Any ideas?

      Environment:
      - JBoss 4.0.3SP1 (build: CVSTag=JBoss_4_0_3_SP1 date=200511211529)
      - default configuration
      - Java version: 1.5.0_04,Sun Microsystems Inc.
      - Windows XP 5.1,x86
      - JBoss is started within Eclipse 3.1 using the Jbossplugin

      ...
      InitialContext initCtx = new InitialContext();
      javax.mail.Session session = (javax.mail.Session)initCtx.lookup("java:/Mail");
      MimeMessage message = new MimeMessage(session);
      message.setFrom(new InternetAddress(from));
      //to
      InternetAddress tolist[] = new InternetAddress[to.length];
      for (int i = 0; i < tolist.length; i++)
      {
       tolist = new InternetAddress(to);
      }
      message.setRecipients(RecipientType.TO, tolist);
      message.setSubject(subject);
      message.setContent(content, contentType);
      javax.mail.Transport.send(message);
      ...
      


      Exception:
      java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
       java.lang.ClassNotFoundException: javax.mail.SendFailedException (no security manager: RMI class loader disabled)
       at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:217)
       at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
       at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
       at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:118)
       at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:227)
       at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:167)
       at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
       at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
       at org.jboss.proxy.ejb.StatefulSessionInterceptor.invoke(StatefulSessionInterceptor.java:106)
       at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
       at $Proxy1.sendEmail(Unknown Source)
       at siteos.leasware.client.test.EJBTester.testEmail(EJBTester.java:839)
       at siteos.leasware.client.test.EJBTester.main(EJBTester.java:107)
      Caused by: java.lang.ClassNotFoundException: javax.mail.SendFailedException (no security manager: RMI class loader disabled)
       at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:371)
       at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
       at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
       at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
       at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
       at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1538)
       at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
       at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
       at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:215)
       ... 12 more