[Installation, Configuration & DEPLOYMENT] - Re: JavaMail : javax.naming.NameNotFoundException: mail not
by knarenderreddy
Hi
|
| i am getting this bellow error
|
| javax.naming.NameNotFoundException: mail not bound
|
| My Configuration in mail-service is
|
| <?xml version="1.0" encoding="UTF-8"?>
| <!-- $Id: mail-service.xml 62349 2007-04-15 16:48:15Z dimitris(a)jboss.org $ -->
| <server>
|
| <!-- ==================================================================== -->
| <!-- Mail Connection Factory -->
| <!-- ==================================================================== -->
|
| <mbean code="org.jboss.mail.MailService"
| name="jboss:service=Mail">
| <attribute name="JNDIName">mail</attribute>
| <attribute name="User">keshireddy.narender(a)gssamerica.com</attribute>
| <attribute name="Password">Knreddy03</attribute>
| <attribute name="Configuration">
| <!-- A test configuration -->
| <configuration>
| <!-- Change to your mail server prototocol -->
| <!-- <property name="mail.store.protocol" value="pop3"/> -->
| <property name="mail.transport.protocol" value="smtp"/>
|
| <!-- Change to the user who will receive mail -->
| <property name="mail.user" value="keshireddy.narender(a)gssamerica.com"/>
|
| <!-- Change to the mail server -->
| <property name="mail.pop3.host" value="pop3.nosuchhost.nosuchdomain.com"/>
|
| <!-- Change to the SMTP gateway server -->
| <property name="mail.smtp.host" value="mail.abc.com"/>
|
| <!-- The mail server port -->
| <property name="mail.smtp.port" value="25"/>
|
| <!-- Change to the address mail will be from -->
| <property name="mail.from" value="keshireddy.narender(a)gssamerica.com"/>
|
| <!-- Enable debugging output from the javamail classes -->
| <property name="mail.debug" value="true"/>
| <property name="mail.smtp.auth" value="true"/>
| </configuration>
| </attribute>
| <depends>jboss:service=Naming</depends>
| </mbean>
|
| </server>
|
| **and my code for getting the JavaMail session is**
|
| Context envCtx = null;
| javax.mail.Session session =null;
| try{
|
| Properties props= System.getProperties();
| Authenticator auth=new SMTPAuthenticator();
|
| props.put("mail.transport.protocol", "smtp");
| props.put("mail.smtp.host", "mail.abc.com");
| props.put("mail.smtp.port", "25");
| props.put("mail.smtp.sendpartial","true");
|
| String location=servlet.getServletContext().getRealPath("");
| props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
| session = Session.getDefaultInstance(props, auth);
| session.setDebug(true);
| envCtx =new InitialContext(props);
| session = (javax.mail.Session) envCtx.lookup("java:/mail");
|
| Message message = new MimeMessage(session);
| message.setFrom(new InternetAddress(from));
| message.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
| message.setSubject("mail From Tomcat service: :)"+sub);
| message.setContent(content, "text/plain");
| Transport.send(message);
| return 1;
| }
| catch(Exception e)
| {
| e.printStackTrace();
| return 0;
| }
|
| and i am writing code like this also
| session = (javax.mail.Session) envCtx.lookup("java:comp/env/mail");
|
| *when i am sending the mail the server throughs this exception*
|
| 12:33:59,036 ERROR [STDERR] javax.naming.NameNotFoundException: mail not bound
| 12:33:59,036 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
| 12:33:59,036 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
| 12:33:59,036 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
| 12:33:59,036 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
| 12:33:59,521 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
| 12:33:59,521 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
| 12:33:59,521 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:351)
| 12:33:59,521 ERROR [STDERR] at com.gssamerica.expensereporting.ui.common.Mail.sendMail(Mail.java:68)
| 12:33:59,521 ERROR [STDERR] at com.gssamerica.expensereporting.ui.applicationadministrator.ApplicationAdminAction.saveNewAdmin(ApplicationAdminAction.java:843)
| 12:34:00,006 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 12:34:00,006 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 12:34:00,006 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 12:34:00,006 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
| 12:34:00,006 ERROR [STDERR] at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)
| 12:34:00,006 ERROR [STDERR] at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
| 12:34:00,006 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
| 12:34:00,006 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
| 12:34:00,006 ERROR [STDERR] at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
| 12:34:00,006 ERROR [STDERR] at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
| 12:34:00,006 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
| 12:34:00,006 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
| 12:34:00,006 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
| 12:34:00,006 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| 12:34:00,006 ERROR [STDERR] at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
| 12:34:00,006 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| 12:34:00,006 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| 12:34:00,006 ERROR [STDERR] at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
| 12:34:00,006 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| 12:34:00,006 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| 12:34:00,006 ERROR [STDERR] at com.gssamerica.expensereporting.ui.common.HibernateSessionRequestFilter.doFilter(HibernateSessionRequestFilter.java:199)
| 12:34:00,006 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| 12:34:00,006 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| 12:34:00,006 ERROR [STDERR] at com.gssamerica.expensereporting.ui.common.HibernateSessionRequestFilter.doFilter(HibernateSessionRequestFilter.java:199)
| 12:34:00,006 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| 12:34:00,006 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| 12:34:00,006 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| 12:34:00,006 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| 12:34:00,006 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| 12:34:00,006 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
| 12:34:00,006 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
| 12:34:00,006 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
| 12:34:00,006 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
| 12:34:00,006 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
| 12:34:00,006 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
| 12:34:00,006 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
| 12:34:00,006 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
| 12:34:00,006 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
| 12:34:00,006 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
| 12:34:00,006 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
| 12:34:00,006 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
| 12:34:00,006 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
|
| if any one knows the solution please help me as early as possible (i am using Jboss4.2.2 sever)
|
| Thanks and regards
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4150974#4150974
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4150974
18 years, 2 months
[JBoss AOP] - Aspect based logger for EJB3 project
by sandello
I have a project, which use EJB3 Session Beans, EJB3 Persistense, JMX and Eclipse RAP.
Now, I have written simple aspect. It should create TRACE log of all method invocation.
But, I have got exception after start JBoss with my project and aspect logger.
JBoss 4.2.1
JbossAOP 1.5.5
OS Fedora
java version "1.5.0_14"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_14-b03, mixed mode)
Aspect class:
| public class AspectLogger implements Interceptor {
| private Logger logger = Logger.getLogger(AspectLogger.class.getName());
|
|
| public String getName() {
| return this.getClass().getName();
| }
|
| public Object invoke(Invocation invocation) throws Throwable {
| if (invocation instanceof MethodInvocation) {
| MethodInvocation mi = (MethodInvocation) invocation;
|
| String iClassName = mi.getMethod().getDeclaringClass().getName();
| String iMethodName = mi.getMethod().getName();
|
| StringBuffer buff = new StringBuffer();
| buff.append(iClassName).append("#").append(iMethodName).append(" ");
|
| Object[] objects = mi.getArguments();
| buff.append(" agrs: |");
| if (objects != null) {
| for (Object o : objects) {
| buff.append(o.toString()).append("|");
| }
| }else{
| buff.append("|");
| }
| logger.trace(buff);
|
| Object ret = invocation.invokeNext();
|
| buff = new StringBuffer();
| buff.append(iClassName).append(" ").append(iMethodName).append(" ");
|
| buff.append(" result: |").append(ret).append("|");
| logger.trace(buff);
|
| return ret;
|
| }
| else {
| return invocation.invokeNext();
| }
| }
| }
|
jboss-aop.xml
| <aop>
| <bind pointcut="execution(* com.telecom_m.billingtm.*->*(..)) AND !execution(* *javassist*->*(..)) AND !execution(* *$*->*(..))">
| <interceptor class="com.telecom_m.util.log.AspectLogger" scope="PER_INSTANCE"/>
| </bind>
| </aop>
|
exception
| 13:57:32,762 WARN [ServiceController] Problem starting service billing:service=NumberCapacityManager
| java.lang.RuntimeException: javax.ejb.EJBException: java.lang.NullPointerException
| at com.telecom_m.billingtm.numeredcapacity.jmx.NumberCapacityInit.com$telecom_m$billingtm$numeredcapacity$jmx$NumberCapacityInit$start$aop(NumberCapacityInit.java:53)
| at com.telecom_m.billingtm.numeredcapacity.jmx.NumberCapacityInit$start_N8025343665958530775.invokeNext(NumberCapacityInit$start_N8025343665958530775.java)
| at com.telecom_m.util.log.AspectLogger.invoke(AspectLogger.java:43)
| at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:105)
| at com.telecom_m.billingtm.numeredcapacity.jmx.NumberCapacityInit$start_N8025343665958530775.invokeNext(NumberCapacityInit$start_N8025343665958530775.java)
| at com.telecom_m.billingtm.numeredcapacity.jmx.NumberCapacityInit.start(NumberCapacityInit.java)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:995)
| at $Proxy0.start(Unknown Source)
| at org.jboss.system.ServiceController.start(ServiceController.java:417)
| at org.jboss.system.ServiceController.start(ServiceController.java:435)
| at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy132.start(Unknown Source)
| ...
| Caused by: javax.ejb.EJBException: java.lang.NullPointerException
| at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
| at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
| at org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:79)
| at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:70)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:103)
| at $Proxy137.getServerInfo(Unknown Source)
| at com.telecom_m.billingtm.numeredcapacity.jmx.NumberCapacityInit.com$telecom_m$billingtm$numeredcapacity$jmx$NumberCapacityInit$setServerInfo$aop(NumberCapacityInit.java:92)
| at com.telecom_m.billingtm.numeredcapacity.jmx.NumberCapacityInit.access$2(NumberCapacityInit.java)
| at com.telecom_m.billingtm.numeredcapacity.jmx.NumberCapacityInit$setServerInfo_N5058612175990396503.invokeNext(NumberCapacityInit$setServerInfo_N5058612175990396503.java)
| at com.telecom_m.util.log.AspectLogger.invoke(AspectLogger.java:43)
| at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:105)
| at com.telecom_m.billingtm.numeredcapacity.jmx.NumberCapacityInit$setServerInfo_N5058612175990396503.invokeNext(NumberCapacityInit$setServerInfo_N5058612175990396503.java)
| at com.telecom_m.billingtm.numeredcapacity.jmx.NumberCapacityInit.setServerInfo(NumberCapacityInit.java)
| at com.telecom_m.billingtm.numeredcapacity.jmx.NumberCapacityInit.com$telecom_m$billingtm$numeredcapacity$jmx$NumberCapacityInit$start$aop(NumberCapacityInit.java:48)
| ... 142 more
| Caused by: java.lang.NullPointerException
| at com.telecom_m.util.log.AspectLogger.invoke(AspectLogger.java:36)
| at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:105)
| at com.telecom_m.billingtm.numeredcapacity.storage.NumberCapacityStorage$find_N172794843629558471.invokeNext(NumberCapacityStorage$find_N172794843629558471.java)
| at com.telecom_m.billingtm.numeredcapacity.storage.NumberCapacityStorage.find(NumberCapacityStorage.java)
| at com.telecom_m.billingtm.numeredcapacity.storage.NumberCapacityStorage.com$telecom_m$billingtm$numeredcapacity$storage$NumberCapacityStorage$getNumberCapacityAll$aop(NumberCapacityStorage.java:106)
| at com.telecom_m.billingtm.numeredcapacity.storage.NumberCapacityStorage$getNumberCapacityAll_N1171544817664568855.invokeNext(NumberCapacityStorage$getNumberCapacityAll_N1171544817664568855.java)
| at com.telecom_m.util.log.AspectLogger.invoke(AspectLogger.java:43)
| at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:105)
| at com.telecom_m.billingtm.numeredcapacity.storage.NumberCapacityStorage$getNumberCapacityAll_N1171544817664568855.invokeNext(NumberCapacityStorage$getNumberCapacityAll_N1171544817664568855.java)
| at com.telecom_m.billingtm.numeredcapacity.storage.NumberCapacityStorage.getNumberCapacityAll(NumberCapacityStorage.java)
| at com.telecom_m.billingtm.numeredcapacity.server.NumberCapacityServerSEJB3.com$telecom_m$billingtm$numeredcapacity$server$NumberCapacityServerSEJB3$getServerInfo$aop(NumberCapacityServerSEJB3.java:155)
| at com.telecom_m.billingtm.numeredcapacity.server.NumberCapacityServerSEJB3$getServerInfo_8270737250672936487.invokeNext(NumberCapacityServerSEJB3$getServerInfo_8270737250672936487.java)
| at com.telecom_m.util.log.AspectLogger.invoke(AspectLogger.java:43)
| at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:105)
| at com.telecom_m.billingtm.numeredcapacity.server.NumberCapacityServerSEJB3$getServerInfo_8270737250672936487.invokeNext(NumberCapacityServerSEJB3$getServerInfo_8270737250672936487.java)
| ...
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4150962#4150962
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4150962
18 years, 2 months