2 Replies Latest reply on Jul 18, 2003 6:40 AM by sriramkanala

    JBoss + JAMES + JavaMail problem

    sriramkanala

      Hi,

      I am using JBoss application server (Jboss 3) and running a JSP + EJB application on that.
      In my application, after a new user registers, an email should be sent to the user with the password.
      I used Java Mail API and tried to send that email through JAMES SMTP.

      This works fine for the first time, but from second instance onwards, I'm getting the following error:

      java.lang.SecurityException: Access to default session denied

      And if I restart JBoss server, it once agains works fine -but only the first time.

      What could be the reason? Any clue?

      Sriram

        • 1. Re: JBoss + JAMES + JavaMail problem
          haraldgliebe

          Access to the default session is protected because it may contain passwords, etc. See the JavaMail specification for details. Could you post a complete stacktrace to see who is calling Session.getDefaultInstance? Does Session.getInstance causes the same problems.

          Regards,
          Harald

          • 2. Re: JBoss + JAMES + JavaMail problem
            sriramkanala

            The stack trace is posted below. Hope this gives a clue about the problem.



            17:59:10,052 ERROR [STDERR] java.lang.SecurityException: Access to default sessi
            on denied
            17:59:10,062 ERROR [STDERR] at javax.mail.Session.getDefaultInstance(Session
            .java:289)
            17:59:10,082 ERROR [STDERR] at package.utils.SendMai
            lUsingAuthentication.postMail(Unknown Source)
            17:59:10,082 ERROR [STDERR] at package.ejb.UserEJB.g
            etUserPassword(Unknown Source)
            17:59:10,082 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(
            Native Method)
            17:59:10,082 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(N
            ativeMethodAccessorImpl.java:39)
            17:59:10,082 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invo
            ke(DelegatingMethodAccessorImpl.java:25)
            17:59:10,082 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:3
            24)
            17:59:10,082 ERROR [STDERR] at org.jboss.ejb.EntityContainer$ContainerInterc
            eptor.invoke(EntityContainer.java:1044)
            17:59:10,082 ERROR [STDERR] at org.jboss.ejb.plugins.EntitySynchronizationIn
            terceptor.invoke(EntitySynchronizationInterceptor.java:301)
            17:59:10,082 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedCo
            nnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
            17:59:10,082 ERROR [STDERR] at org.jboss.ejb.plugins.EntityReentranceInterce
            ptor.invoke(EntityReentranceInterceptor.java:82)
            17:59:10,082 ERROR [STDERR] at org.jboss.ejb.plugins.EntityInstanceIntercept
            or.invoke(EntityInstanceInterceptor.java:174)
            17:59:10,082 ERROR [STDERR] at org.jboss.ejb.plugins.EntityLockInterceptor.i
            nvoke(EntityLockInterceptor.java:89)
            17:59:10,082 ERROR [STDERR] at org.jboss.ejb.plugins.EntityCreationIntercept
            or.invoke(EntityCreationInterceptor.java:53)
            17:59:10,082 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.i
            nvokeNext(AbstractTxInterceptor.java:84)
            17:59:10,082 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWit
            hTransactions(TxInterceptorCMT.java:243)
            17:59:10,082 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke
            (TxInterceptorCMT.java:104)
            17:59:10,092 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.inv
            oke(SecurityInterceptor.java:117)
            17:59:10,092 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(L
            ogInterceptor.java:191)
            17:59:10,092 ERROR [STDERR] at org.jboss.ejb.plugins.ProxyFactoryFinderInter
            ceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
            17:59:10,092 ERROR [STDERR] at org.jboss.ejb.EntityContainer.internalInvoke(
            EntityContainer.java:483)
            17:59:10,092 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java
            :674)
            17:59:10,092 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(
            Native Method)
            17:59:10,092 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(N
            ativeMethodAccessorImpl.java:39)
            17:59:10,092 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invo
            ke(DelegatingMethodAccessorImpl.java:25)
            17:59:10,092 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:3
            24)
            17:59:10,092 ERROR [STDERR] at org.jboss.mx.capability.ReflectedMBeanDispatc
            her.invoke(ReflectedMBeanDispatcher.java:284)
            17:59:10,092 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MB
            eanServerImpl.java:549)
            17:59:10,092 ERROR [STDERR] at org.jboss.invocation.local.LocalInvoker.invok
            e(LocalInvoker.java:101)
            17:59:10,092 ERROR [STDERR] at org.jboss.invocation.InvokerInterceptor.invok
            e(InvokerInterceptor.java:83)
            17:59:10,092 ERROR [STDERR] at org.jboss.proxy.TransactionInterceptor.invoke
            (TransactionInterceptor.java:46)
            17:59:10,092 ERROR [STDERR] at org.jboss.proxy.SecurityInterceptor.invoke(Se
            curityInterceptor.java:45)
            17:59:10,092 ERROR [STDERR] at org.jboss.proxy.ejb.EntityInterceptor.invoke(
            EntityInterceptor.java:97)
            17:59:10,092 ERROR [STDERR] at org.jboss.proxy.ClientContainer.invoke(Client
            Container.java:85)
            17:59:10,102 ERROR [STDERR] at $Proxy145.getUserPassword(Unknown Source)
            17:59:10,102 ERROR [STDERR] at package.ejb.UserSearc
            hEJB.getPassword(Unknown Source)
            17:59:10,102 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(
            Native Method)
            17:59:10,102 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(N
            ativeMethodAccessorImpl.java:39)
            17:59:10,102 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invo
            ke(DelegatingMethodAccessorImpl.java:25)
            17:59:10,102 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:3
            24)
            17:59:10,102 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer$Conta
            inerInterceptor.invoke(StatelessSessionContainer.java:629)
            17:59:10,102 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedCo
            nnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
            17:59:10,102 ERROR [STDERR] at org.jboss.ejb.plugins.StatelessSessionInstanc
            eInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
            17:59:10,102 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.i
            nvokeNext(AbstractTxInterceptor.java:84)
            17:59:10,102 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWit
            hTransactions(TxInterceptorCMT.java:243)
            17:59:10,102 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke
            (TxInterceptorCMT.java:104)
            17:59:10,102 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.inv
            oke(SecurityInterceptor.java:117)
            17:59:10,102 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(L
            ogInterceptor.java:191)
            17:59:10,102 ERROR [STDERR] at org.jboss.ejb.plugins.ProxyFactoryFinderInter
            ceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
            17:59:10,102 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer.inter
            nalInvoke(StatelessSessionContainer.java:322)
            17:59:10,102 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java
            :674)
            17:59:10,112 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(
            Native Method)
            17:59:10,112 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(N
            ativeMethodAccessorImpl.java:39)
            17:59:10,112 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invo
            ke(DelegatingMethodAccessorImpl.java:25)
            17:59:10,112 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:3
            24)
            17:59:10,112 ERROR [STDERR] at org.jboss.mx.capability.ReflectedMBeanDispatc
            her.invoke(ReflectedMBeanDispatcher.java:284)
            17:59:10,112 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MB
            eanServerImpl.java:549)
            17:59:10,112 ERROR [STDERR] at org.jboss.invocation.local.LocalInvoker.invok
            e(LocalInvoker.java:101)
            17:59:10,112 ERROR [STDERR] at org.jboss.invocation.InvokerInterceptor.invok
            e(InvokerInterceptor.java:83)
            17:59:10,112 ERROR [STDERR] at org.jboss.proxy.TransactionInterceptor.invoke
            (TransactionInterceptor.java:46)
            17:59:10,112 ERROR [STDERR] at org.jboss.proxy.SecurityInterceptor.invoke(Se
            curityInterceptor.java:45)
            17:59:10,112 ERROR [STDERR] at org.jboss.proxy.ejb.StatelessSessionIntercept
            or.invoke(StatelessSessionInterceptor.java:100)
            17:59:10,112 ERROR [STDERR] at org.jboss.proxy.ClientContainer.invoke(Client
            Container.java:85)
            17:59:10,112 ERROR [STDERR] at $Proxy128.getPassword(Unknown Source)
            17:59:10,112 ERROR [STDERR] at package.strut.ForgotP
            wdAction.perform(Unknown Source)
            17:59:10,122 ERROR [STDERR] at org.apache.struts.action.ActionServlet.proces
            sActionPerform(ActionServlet.java:1787)
            17:59:10,122 ERROR [STDERR] at org.apache.struts.action.ActionServlet.proces
            s(ActionServlet.java:1586)
            17:59:10,122 ERROR [STDERR] at org.apache.struts.action.ActionServlet.doPost
            (ActionServlet.java:510)
            17:59:10,122 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpSe
            rvlet.java:760)
            17:59:10,122 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpSe
            rvlet.java:853)
            17:59:10,122 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha
            in.internalDoFilter(ApplicationFilterChain.java:247)
            17:59:10,122 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha
            in.doFilter(ApplicationFilterChain.java:193)
            17:59:10,122 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve
            .invoke(StandardWrapperValve.java:256)
            17:59:10,122 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$Sta
            ndardPipelineValveContext.invokeNext(StandardPipeline.java:643)
            17:59:10,122 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline.inv
            oke(StandardPipeline.java:480)
            17:59:10,122 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.invoke
            (ContainerBase.java:995)
            17:59:10,122 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve
            .invoke(StandardContextValve.java:191)
            17:59:10,122 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$Sta
            ndardPipelineValveContext.invokeNext(StandardPipeline.java:643)
            17:59:10,122 ERROR [STDERR] at org.apache.catalina.valves.CertificatesValve.
            invoke(CertificatesValve.java:246)
            17:59:10,122 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$Sta
            ndardPipelineValveContext.invokeNext(StandardPipeline.java:641)
            17:59:10,122 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline.inv
            oke(StandardPipeline.java:480)
            17:59:10,132 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.invoke
            (ContainerBase.java:995)
            17:59:10,132 ERROR [STDERR] at org.apache.catalina.core.StandardContext.invo
            ke(StandardContext.java:2415)
            17:59:10,132 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.in
            voke(StandardHostValve.java:180)
            17:59:10,132 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$Sta
            ndardPipelineValveContext.invokeNext(StandardPipeline.java:643)
            17:59:10,132 ERROR [STDERR] at org.apache.catalina.valves.ErrorDispatcherVal
            ve.invoke(ErrorDispatcherValve.java:171)
            17:59:10,132 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$Sta
            ndardPipelineValveContext.invokeNext(StandardPipeline.java:641)
            17:59:10,132 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.i
            nvoke(ErrorReportValve.java:172)
            17:59:10,132 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$Sta
            ndardPipelineValveContext.invokeNext(StandardPipeline.java:641)
            17:59:10,132 ERROR [STDERR] at org.apache.catalina.valves.AccessLogValve.inv
            oke(AccessLogValve.java:509)
            17:59:10,132 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$Sta
            ndardPipelineValveContext.invokeNext(StandardPipeline.java:641)
            17:59:10,132 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline.inv
            oke(StandardPipeline.java:480)
            17:59:10,132 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.invoke
            (ContainerBase.java:995)
            17:59:10,142 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.
            invoke(StandardEngineValve.java:174)
            17:59:10,142 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline$Sta
            ndardPipelineValveContext.invokeNext(StandardPipeline.java:643)
            17:59:10,142 ERROR [STDERR] at org.apache.catalina.core.StandardPipeline.inv
            oke(StandardPipeline.java:480)
            17:59:10,142 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.invoke
            (ContainerBase.java:995)
            17:59:10,142 ERROR [STDERR] at org.apache.coyote.tomcat4.CoyoteAdapter.servi
            ce(CoyoteAdapter.java:223)
            17:59:10,142 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.proc
            ess(Http11Processor.java:594)
            17:59:10,142 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http1
            1ConnectionHandler.processConnection(Http11Protocol.java:392)
            17:59:10,142 ERROR [STDERR] at org.apache.tomcat.util.net.TcpWorkerThread.ru
            nIt(PoolTcpEndpoint.java:565)
            17:59:10,142 ERROR [STDERR] at org.apache.tomcat.util.threads.ThreadPool$Con
            trolRunnable.run(ThreadPool.java:619)
            17:59:10,142 ERROR [STDERR] at java.lang.Thread.run(Thread.java:536)
            17:59:10,142 ERROR [LogInterceptor] TransactionRolledbackException, causedBy:
            java.lang.SecurityException: Email has not been sent
            at package.ejb.UserEJB.getUserPassword(Unknown S
            ource)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
            java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
            sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityConta
            iner.java:1044)
            at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntityS
            ynchronizationInterceptor.java:301)
            at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
            ke(CachedConnectionInterceptor.java:186)
            at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentr
            anceInterceptor.java:82)
            at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstance
            Interceptor.java:174)
            at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockIntercep
            tor.java:89)
            at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreation
            Interceptor.java:53)
            at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
            rceptor.java:84)
            at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
            torCMT.java:243)
            at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:1
            04)
            at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.
            java:117)
            at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
            at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFacto
            ryFinderInterceptor.java:122)
            at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:483
            )
            at org.jboss.ejb.Container.invoke(Container.java:674)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
            java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
            sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
            nDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
            at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:101)

            at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.jav
            a:83)
            at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.
            java:46)
            at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:4
            5)
            at org.jboss.proxy.ejb.EntityInterceptor.invoke(EntityInterceptor.java:9
            7)
            at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
            at $Proxy145.getUserPassword(Unknown Source)
            at package.ejb.UserSearchEJB.getPassword(Unknown
            Source)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
            java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
            sorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)
            at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(S
            tatelessSessionContainer.java:629)