chimufox 25 de jul. de 2011
Sei não, mas acho que se você dizer o problema acho que ajuda.
jeroqueiroz 25 de jul. de 2011
Estou tendo o problema abaixo:
OBS: A classe roda normal quando utilizo Java Application. Porém quando migro para Web ele apresenta erro.
Linha do código onde o erro esta sendo apresentado.
Erro apresentado no console.
3 [ "http-bio-8080" - exec - 3 ] INFO http . HTTPSender - Unable to sendViaPost to url [ https : // hnfe . sefaz . ba . go v . br / webservices / nfenw / NfeRecepcao2 . asmx ]
javax . net . ssl . SSLHandshakeException : Error signing certificate verify
at com . sun . net . ssl . int ernal . ssl . Alerts . get SSLException ( Unknown Source )
at com . sun . net . ssl . int ernal . ssl . SSLSocketImpl . fatal ( Unknown Source )
at com . sun . net . ssl . int ernal . ssl . Handshaker . fatalSE ( Unknown Source )
at com . sun . net . ssl . int ernal . ssl . ClientHandshaker . serverHelloDone ( Unknown Source )
at com . sun . net . ssl . int ernal . ssl . ClientHandshaker . processMessage ( Unknown Source )
at com . sun . net . ssl . int ernal . ssl . Handshaker . processLoop ( Unknown Source )
at com . sun . net . ssl . int ernal . ssl . Handshaker . process_record ( Unknown Source )
at com . sun . net . ssl . int ernal . ssl . SSLSocketImpl . read Record ( Unknown Source )
at com . sun . net . ssl . int ernal . ssl . SSLSocketImpl . read Data Record ( Unknown Source )
at com . sun . net . ssl . int ernal . ssl . AppInputStream . read ( Unknown Source )
at java . io . BufferedInputStream . fill ( Unknown Source )
at java . io . BufferedInputStream . read ( Unknown Source )
at or g . apache . commons . httpclient . HttpParser . read RawLine ( HttpParser . java : 78 )
at or g . apache . commons . httpclient . HttpParser . read Line ( HttpParser . java : 106 )
at or g . apache . commons . httpclient . HttpConnection . read Line ( HttpConnection . java : 1116 )
at or g . apache . commons . httpclient . MultiThreadedHttpConnectionManager$HttpConnectionAdapter . read Line ( MultiThreadedHttpConnectionManager . java : 1413 )
at or g . apache . commons . httpclient . HttpMethodBase . read StatusLine ( HttpMethodBase . java : 1973 )
at or g . apache . commons . httpclient . HttpMethodBase . read Response ( HttpMethodBase . java : 1735 )
at or g . apache . commons . httpclient . HttpMethodBase . execute ( HttpMethodBase . java : 1098 )
at or g . apache . commons . httpclient . HttpMethodDirector . executeWithRetry ( HttpMethodDirector . java : 398 )
at or g . apache . commons . httpclient . HttpMethodDirector . executeMethod ( HttpMethodDirector . java : 171 )
at or g . apache . commons . httpclient . HttpClient . executeMethod ( HttpClient . java : 397 )
at or g . apache . commons . httpclient . HttpClient . executeMethod ( HttpClient . java : 346 )
at or g . apache . axis2 . transport . http . Abs tractHTTPSender . executeMethod ( Abs tractHTTPSender . java : 560 )
at or g . apache . axis2 . transport . http . HTTPSender . sendViaPost ( HTTPSender . java : 199 )
at or g . apache . axis2 . transport . http . HTTPSender . send ( HTTPSender . java : 76 )
at or g . apache . axis2 . transport . http . CommonsHTTPTransportSender . writeMessageWithCommons ( CommonsHTTPTransportSender . java : 400 )
at or g . apache . axis2 . transport . http . CommonsHTTPTransportSender . invoke ( CommonsHTTPTransportSender . java : 225 )
at or g . apache . axis2 . engine . AxisEngine . send ( AxisEngine . java : 438 )
at or g . apache . axis2 . description . OutInAxisOperationClient . send ( OutInAxisOperation . java : 402 )
at or g . apache . axis2 . description . OutInAxisOperationClient . executeImpl ( OutInAxisOperation . java : 229 )
at or g . apache . axis2 . client . OperationClient . execute ( OperationClient . java : 165 )
at br . inf . portalfiscal . www . nfe . wsdl . nferecepcao2 . NfeRecepcao2Stub . nfeRecepcaoLote2 ( NfeRecepcao2Stub . java : 196 )
at br . go v . fazenda . nfe . www . envio . NFeRecepcaoCerA3 . NfeRecepcaoLoteA3 ( NFeRecepcaoCerA3 . java : 98 )
at br . go v . fazenda . nfe . www . inicial . EmissaoPadraoNfe . emiteNotaFiscal ( EmissaoPadraoNfe . java : 28 )
at br . go v . fazenda . nfe . www . inicial . NfeEnvio . doGet ( NfeEnvio . java : 34 )
at javax . servlet . http . HttpServlet . service ( HttpServlet . java : 621 )
at javax . servlet . http . HttpServlet . service ( HttpServlet . java : 722 )
at or g . apache . catalina . core . ApplicationFilterChain . int ernalDoFilter ( ApplicationFilterChain . java : 304 )
at or g . apache . catalina . core . ApplicationFilterChain . doFilter ( ApplicationFilterChain . java : 210 )
at or g . apache . catalina . core . StandardWrapperValve . invoke ( StandardWrapperValve . java : 240 )
at or g . apache . catalina . core . StandardContextValve . invoke ( StandardContextValve . java : 164 )
at or g . apache . catalina . authenticator . AuthenticatorBase . invoke ( AuthenticatorBase . java : 462 )
at or g . apache . catalina . core . StandardHostValve . invoke ( StandardHostValve . java : 164 )
at or g . apache . catalina . val ves . ErrorReportValve . invoke ( ErrorReportValve . java : 100 )
at or g . apache . catalina . val ves . AccessLogValve . invoke ( AccessLogValve . java : 563 )
at or g . apache . catalina . core . StandardEngineValve . invoke ( StandardEngineValve . java : 118 )
at or g . apache . catalina . connector . CoyoteAdapter . service ( CoyoteAdapter . java : 403 )
at or g . apache . coyote . http11 . Http11Processor . process ( Http11Processor . java : 301 )
at or g . apache . coyote . http11 . Http11Protocol$Http11ConnectionHandler . process ( Http11Protocol . java : 162 )
at or g . apache . coyote . http11 . Http11Protocol$Http11ConnectionHandler . process ( Http11Protocol . java : 140 )
at or g . apache . to mcat . util . net . JIoEndpoint$SocketProcessor . run ( JIoEndpoint . java : 309 )
at java . util . concurrent . ThreadPoolExecutor$Worker . run Task ( Unknown Source )
at java . util . concurrent . ThreadPoolExecutor$Worker . run ( Unknown Source )
at java . lang . Thread . run ( Unknown Source )
Caused by : java . security . InvalidKeyException : Unsupported key type : SunPKCS11 - SmartCard RSA private key , 1024 bits ( id 1 , to ken object , sensitive , unextractable )
at sun . security . mscapi . RSACipher . engineGetKeySize ( RSACipher . java : 345 )
at javax . crypto . Cipher . b ( DashoA13 * .. )
at javax . crypto . Cipher . a ( DashoA13 * .. )
at javax . crypto . Cipher . init ( DashoA13 * .. )
at java . security . Signature$CipherAdapter . engineInitSign ( Unknown Source )
at java . security . Signature$Delegate . init ( Unknown Source )
at java . security . Signature$Delegate . chooseProvider ( Unknown Source )
at java . security . Signature$Delegate . engineInitSign ( Unknown Source )
at java . security . Signature . initSign ( Unknown Source )
at com . sun . net . ssl . int ernal . ssl . RSASignature . engineInitSign ( Unknown Source )
at java . security . Signature$Delegate . engineInitSign ( Unknown Source )
at java . security . Signature . initSign ( Unknown Source )
at com . sun . net . ssl . int ernal . ssl . HandshakeMessage$CertificateVerify . & lt ; init & gt ;( Unknown Source )
Mudei o server para o Jboss 5.0, a mensagem de erro mudou:
jeroqueiroz 25 de jul. de 2011
Conseguiu resolver meu problema em partes, pois para certificado A1 resolveu, porém necessito para A3 alguém sabe informar como devo proceder?
Segue resolução:
Acerte o servidor.xml do tomcat para:
<Connector port="8443"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" keystoreFile="c:\java\certificado.p12" keystoreType="PKCS12" keystorePass="certificado" debug="0" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
presta atenção, tem um parâmetro novo no Connector Port:
Conteúdo visto neste post: http://www.guj.com.br/java/29710-tomcat--https/2#1288066