- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想从 gmail 服务器获取电子邮件和未读电子邮件的数量。我访问了几个 stackoverflow 帖子和网站,但给出的所有代码在我这边都不起作用。如果您能帮助我,我将不胜感激,因为我不知道代码中哪里出了问题。以下是我的代码:
public void getEmailNumber() throws NoSuchProviderException, MessagingException {
final Properties props = new Properties();
props.setProperty("mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.setProperty("mail.pop3.socketFactory.fallback", "false");
props.setProperty( "mail.pop3.host", "pop.gmail.com" );
props.setProperty( "mail.pop3.user", "username");
props.setProperty( "mail.pop3.password", "password");
props.setProperty( "mail.pop3.ssl.enable", "true");
props.setProperty( "mail.pop3.port", "995" );
props.setProperty( "mail.pop3.auth", "true" );
props.setProperty("mail.pop3.starttls.enable", "true");
Session session = Session.getInstance(props);
session.setDebug(true);
Store store = session.getStore("pop3");
store.connect("username", "password");
Folder folder = store.getDefaultFolder();
folder.open(Folder.READ_ONLY);
Message message[] = folder.getMessages();
for ( int i = 0; i < message.length; i++ )
{
Message m = message[i];
System.out.println( "-------------------------\nNachricht: " + i );
System.out.println( "From: " + Arrays.toString(m.getFrom()) );
System.out.println( "Topic: " + m.getSubject() );
if ( m.isMimeType("text/plain") )
try {
System.out.println( m.getContent() );
} catch (IOException ex) {
Logger.getLogger(AdminLoginManagedBean.class.getName()).log(Level.SEVERE, null, ex);
}
}
folder.close( false );
store.close();
}
我一直遇到的错误是:
Severe: Error Rendering View[/index.xhtml]
javax.enterprise.inject.CreationException
at sun.reflect.GeneratedConstructorAccessor1175.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at org.jboss.weld.security.NewInstanceAction.run(NewInstanceAction.java:33)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:40)
at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:50)
at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:90)
at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:127)
at org.jboss.weld.injection.ConstructorInjectionPoint.invokeAroundConstructCallbacks(ConstructorInjectionPoint.java:92)
at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:78)
at org.jboss.weld.injection.producer.AbstractInstantiator.newInstance(AbstractInstantiator.java:28)
at org.jboss.weld.injection.producer.BasicInjectionTarget.produce(BasicInjectionTarget.java:112)
at org.jboss.weld.injection.producer.BeanInjectionTarget.produce(BeanInjectionTarget.java:180)
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:158)
at org.jboss.weld.contexts.AbstractContext.get(AbstractContext.java:96)
at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:100)
at org.jboss.weld.bean.ContextualInstanceStrategy$CachingContextualInstanceStrategy.get(ContextualInstanceStrategy.java:177)
at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:676)
at org.jboss.weld.module.web.el.AbstractWeldELResolver.lookup(AbstractWeldELResolver.java:107)
at org.jboss.weld.module.web.el.AbstractWeldELResolver.getValue(AbstractWeldELResolver.java:90)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:147)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:156)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:184)
at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:92)
at com.sun.el.parser.AstValue.getBase(AstValue.java:126)
at com.sun.el.parser.AstValue.getValue(AstValue.java:175)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:202)
at org.jboss.weld.module.web.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:73)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:170)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:157)
at javax.faces.component.UIOutput.getValue(UIOutput.java:140)
at javax.faces.component.UIInput.getValue(UIInput.java:287)
at org.primefaces.util.ComponentUtils.getValueToRender(ComponentUtils.java:109)
at org.primefaces.util.ComponentUtils.getValueToRender(ComponentUtils.java:73)
at org.primefaces.component.inputtext.InputTextRenderer.encodeMarkup(InputTextRenderer.java:92)
at org.primefaces.component.inputtext.InputTextRenderer.encodeEnd(InputTextRenderer.java:62)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:595)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:286)
at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:162)
at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:105)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:566)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:82)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:69)
at org.primefaces.component.dialog.DialogRenderer.encodeContent(DialogRenderer.java:200)
at org.primefaces.component.dialog.DialogRenderer.encodeMarkup(DialogRenderer.java:123)
at org.primefaces.component.dialog.DialogRenderer.encodeEnd(DialogRenderer.java:54)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:595)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1654)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:152)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:566)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1647)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:468)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:170)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:102)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:76)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:199)
at javax.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:708)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:451)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1540)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:297)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:167)
at web.filter.SecurityFilter.doFilter(SecurityFilter.java:59)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:167)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:215)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:119)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:550)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:75)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:114)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:199)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:439)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:144)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:182)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:156)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:218)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:515)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:33)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.mail.MessagingException: Connect failed;
nested exception is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:195)
at javax.mail.Service.connect(Service.java:342)
at javax.mail.Service.connect(Service.java:222)
at javax.mail.Service.connect(Service.java:243)
at jsf.managedBean.AdminLoginManagedBean.getEmailNumber(AdminLoginManagedBean.java:81)
at jsf.managedBean.AdminLoginManagedBean.<init>(AdminLoginManagedBean.java:38)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:119)
... 88 more
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1946)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:316)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:310)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1688)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1038)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:966)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1064)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:602)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:376)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:193)
at com.sun.mail.pop3.Protocol.<init>(Protocol.java:94)
at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:247)
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:189)
... 98 more
Suppressed: java.lang.NullPointerException
at com.sun.mail.pop3.Protocol.cleanupAndThrow(Protocol.java:124)
at com.sun.mail.pop3.Protocol.<init>(Protocol.java:98)
... 100 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:397)
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:302)
at sun.security.validator.Validator.validate(Validator.java:262)
at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:330)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:237)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:132)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1670)
... 111 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:392)
... 117 more
Warning: StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:392)
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:302)
at sun.security.validator.Validator.validate(Validator.java:262)
at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:330)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:237)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:132)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1670)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1038)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:966)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1064)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:602)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:376)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:193)
at com.sun.mail.pop3.Protocol.<init>(Protocol.java:94)
at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:247)
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:189)
at javax.mail.Service.connect(Service.java:342)
at javax.mail.Service.connect(Service.java:222)
at javax.mail.Service.connect(Service.java:243)
at jsf.managedBean.AdminLoginManagedBean.getEmailNumber(AdminLoginManagedBean.java:81)
at jsf.managedBean.AdminLoginManagedBean.<init>(AdminLoginManagedBean.java:38)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:119)
at org.jboss.weld.injection.ConstructorInjectionPoint.invokeAroundConstructCallbacks(ConstructorInjectionPoint.java:92)
at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:78)
at org.jboss.weld.injection.producer.AbstractInstantiator.newInstance(AbstractInstantiator.java:28)
at org.jboss.weld.injection.producer.BasicInjectionTarget.produce(BasicInjectionTarget.java:112)
at org.jboss.weld.injection.producer.BeanInjectionTarget.produce(BeanInjectionTarget.java:180)
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:158)
at org.jboss.weld.contexts.AbstractContext.get(AbstractContext.java:96)
at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:100)
at org.jboss.weld.bean.ContextualInstanceStrategy$CachingContextualInstanceStrategy.get(ContextualInstanceStrategy.java:177)
at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:676)
at org.jboss.weld.module.web.el.AbstractWeldELResolver.lookup(AbstractWeldELResolver.java:107)
at org.jboss.weld.module.web.el.AbstractWeldELResolver.getValue(AbstractWeldELResolver.java:90)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:147)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:156)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:184)
at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:92)
at com.sun.el.parser.AstValue.getBase(AstValue.java:126)
at com.sun.el.parser.AstValue.getValue(AstValue.java:175)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:202)
at org.jboss.weld.module.web.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:73)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:170)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:157)
at javax.faces.component.UIOutput.getValue(UIOutput.java:140)
at javax.faces.component.UIInput.getValue(UIInput.java:287)
at org.primefaces.util.ComponentUtils.getValueToRender(ComponentUtils.java:109)
at org.primefaces.util.ComponentUtils.getValueToRender(ComponentUtils.java:73)
at org.primefaces.component.inputtext.InputTextRenderer.encodeMarkup(InputTextRenderer.java:92)
at org.primefaces.component.inputtext.InputTextRenderer.encodeEnd(InputTextRenderer.java:62)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:595)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:286)
at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:162)
at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:105)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:566)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:82)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:69)
at org.primefaces.component.dialog.DialogRenderer.encodeContent(DialogRenderer.java:200)
at org.primefaces.component.dialog.DialogRenderer.encodeMarkup(DialogRenderer.java:123)
at org.primefaces.component.dialog.DialogRenderer.encodeEnd(DialogRenderer.java:54)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:595)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1654)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:152)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:566)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1647)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1650)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:468)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:170)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:102)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:76)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:199)
at javax.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:708)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:451)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1540)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:297)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:167)
at web.filter.SecurityFilter.doFilter(SecurityFilter.java:59)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:167)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:215)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:119)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:550)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:75)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:114)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:199)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:439)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:144)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:182)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:156)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:218)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:515)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:33)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
at java.lang.Thread.run(Thread.java:748)
最佳答案
使用 SSL 连接到远程服务器似乎是 PKIX 问题。
Caused by: javax.mail.MessagingException: Connect failed;
nested exception is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
您可以通过使用 keytool 导入 SSL 证书来解决这些错误:
keytool -import -file <the cert file> -alias <some meaningful name> -keystore <path to cacerts file>
关于用于接收电子邮件的 JavaMail API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61241841/
在发布之前,我在互联网上阅读了很多内容和建议的问题,但找不到任何适合我的内容。 有关使用 gmail 的 JavaMail 常见问题解答 Stackoverflow 问题 JavaMail 教程 Go
我正在尝试通过 java 邮件发送电子邮件。它给出了以下异常javax.mail.internet.ParseException: 在 Content-Type string 中,预期的 MIME 类
我想从我的 Gmail 帐户的特定文件夹中获取最近未读的具有特定主题的电子邮件。我正在使用 JavaMail API,如下所示,但它返回 0 个结果。但是,如果我只单独使用 subjectTerm,我
我正在开发一个基于 Spring 的网络应用程序,当用户输入他的电子邮件和密码进行注册时我想验证它们并向他发送电子邮件。我已经使用 java mail api并正确设置gmail smtp。 这是我的
我试图获取我的 Gmail 的所有邮件,但只能获取 250 封。根据 https://javaee.github.io/javamail/FAQ#gmailsettings ,我已经将邮件数量限制设置
我有几封主题为报告 #123:来自测试的“Email_test_856” 的电子邮件。我尝试使用 JavaMail API 根据关键字 Email_test 查找邮件,但它不会过滤掉任何邮件。 这是我
我有一种方法可以发送 HTML 电子邮件和嵌入的图片,以引用我的计算机中的图像,例如 c:/image.gif 该方法效果很好,但我不知道如何添加位于远程计算机中的图像,我知道您的 IP 地址和图像所
这是我的代码,它应该会收到未读消息。然而,它正在返回我收件箱中的最后一条消息。有什么建议吗? import javax.mail.*; import javax.mail.internet.*; im
Javax邮件版本使用1.6.2 手动设置 JavaMailSender 我尝试使用 mail.smtp.timeout 和 mail.smtps.timeout 超时。 而且,我尝试使用字符串和整数
我有以下问题:我的电子邮件客户端使用 Javamail,可以获取电子邮件的所有部分,如发送日期、主题、发件人、收件人等,但我不知道如何获取邮件正文. 我已经尝试过 getContent() 函数,但它
我编写了一个使用 JavaMail API 发送 gmail 的程序。以下是我的代码: import java.util.*; import javax.mail.*; import javax.ac
所以我的问题是关于JavaMail 的。我想向不同的电子邮件地址发送电子邮件,但我希望发件人类似于“noreply”。但是,我似乎无法这样做,因为 JavaMail 需要发送者和接收者都有实际的电子邮
我正在尝试从 Java 应用程序发送电子邮件,但每当我运行在线找到的代码时 here 当我运行代码时,我收到此错误: Exception in thread "main" java.lang.NoCl
所以我遇到了 Javamail 的问题,如果我在邮件中发送附件,正文就会消失。当我不随邮件发送附件时,我只能看到正文。 我的 GMailSender.java: public GMailSender(
我有一个关于 Java Mail 及其如何与流配合使用的问题。在 Java Mail 1.4.1 中,有一个 MimeMessage constructor that accepts a stream
我窃取了这段代码来测试使用 java 发送电子邮件的情况。显然,Javamail 是必需的。由于某种原因,我无法实现 javax.mail。我下载了最新的javamail并将它们放入jdk和jre l
我正在使用 JavaMail 开发一个邮件客户端,它运行良好。现在我希望能够处理传入消息的已读回执。如果传入的邮件 header 包含“Disposition-Notification-To”,我想处
Javamail 在 JUnit 测试和 GlassFish 3.1.2 中工作正常,但在 Tomcat 7.0.41 中不起作用:所有“From” header 均为 NULL!我究竟做错了什么?当
我尝试使用 javamail 连接到电子邮件 - 在非 Android 应用程序中,此代码工作正常: public void perform(View v){ Toast.makeText(g
我必须向多个收件人发送电子邮件。我不希望标题显示完整的收件人列表(即我没有使用“Message.RecipientType.CC”)。如果我使用“Message.RecipientType.BCC”,
我是一名优秀的程序员,十分优秀!