Re: Need help with James 3.4, smtpserver, and keystore file.

Marc Chamberlin <[email protected]>
Newsgroups gmane.comp.jakarta.james.user
Message-ID <[email protected]>
Hello again,  It appears that I have managed to make a bit of progress
on my own since my original post. For some odd reason I got past the
FileNotFound exception by changing (adding) execute permission to the
directory containing the keystore file. So now it is set as follows -

quasar:/mail/apache-james-3.4/james-server-app-3.4.0/conf # ll -d
keystore.privateFiles
drwxrwxrwx 2 james mail 4096 Dec 27 22:11 keystore.privateFiles

It is a puzzler (at least to me) why adding execute permissions would
allow James to find my Keystore file. But I immediately hit another
snag, James is not correctly applying the password to access the
keystore file and throwing another exception. The smtpserver.xml is
configured as follows -

     <tls socketTLS="false" startTLS="true">
      
<keystore>file:/mail/apache-james-3.4/james-server-app-3.4.0/conf/keystore</keystore>
       <secret>mypassword</secret>
      
<provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
       <algorithm>SunX509</algorithm>
     </tls>

To test the keystore file I executed the following command and it worked
fine -

quasar:/mail/apache-james-3.4/james-server-app-3.4.0/conf # keytool
-list -v -keystore
/mail/apache-james-3.4/james-server-app-3.4.0/conf/keystore -storetype
PKCS12 -storepass mypassword

The exception and stack walkback I am getting from James is shown
below.  I am continuing to Google for answers but no joy so far...
Anyone here got any ideas? Thanks again in advance...     Marc.

----

INFO   | jvm 1    | 2019/12/28 17:13:27 | WARN  17:13:26,963 |
org.apache.james.container.spring.context.JamesServerApplicationContext
| Exception encountered during context initialization - cancelling
refresh attempt:
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'smtpserver': Invocation of init method failed; nested
exception is java.io.IOException: keystore password was incorrect
INFO   | jvm 1    | 2019/12/28 17:13:27 | INFO  17:13:26,964 |
org.apache.james.mailetcontainer.impl.JamesMailSpooler | start dispose() ...
INFO   | jvm 1    | 2019/12/28 17:13:27 | INFO  17:13:26,964 |
org.apache.james.mailetcontainer.impl.JamesMailSpooler | thread shutdown
completed.
INFO   | jvm 1    | 2019/12/28 17:13:27 |
INFO   | jvm 1    | 2019/12/28 17:13:27 | WrapperSimpleApp: Encountered
an error running main:
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'smtpserver': Invocation of init method failed; nested
exception is java.io.IOException: keystore password was incorrect
INFO   | jvm 1    | 2019/12/28 17:13:27 |
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'smtpserver': Invocation of init method failed; nested
exception is java.io.IOException: keystore password was incorrect
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:396)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1507)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:638)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:942)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.apache.james.container.spring.context.JamesServerApplicationContext.<init>(JamesServerApplicationContext.java:40)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.apache.james.app.spring.JamesAppSpringMain.init(JamesAppSpringMain.java:56)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.apache.james.app.spring.JamesAppSpringMain.main(JamesAppSpringMain.java:42)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
java.lang.reflect.Method.invoke(Method.java:498)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
java.lang.Thread.run(Thread.java:748)
INFO   | jvm 1    | 2019/12/28 17:13:27 | Caused by:
java.io.IOException: keystore password was incorrect
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:2059)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
sun.security.provider.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:238)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
sun.security.provider.JavaKeyStore$DualFormatJKS.engineLoad(JavaKeyStore.java:70)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
java.security.KeyStore.load(KeyStore.java:1445)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.apache.james.protocols.lib.netty.AbstractConfigurableAsyncServer.buildSSLContext(AbstractConfigurableAsyncServer.java:405)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.apache.james.protocols.lib.netty.AbstractConfigurableAsyncServer.init(AbstractConfigurableAsyncServer.java:263)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.apache.james.protocols.lib.netty.AbstractServerFactory.init(AbstractServerFactory.java:57)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
java.lang.reflect.Method.invoke(Method.java:498)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:344)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:295)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       at
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:130)
INFO   | jvm 1    | 2019/12/28 17:13:27 |       ... 22 more
INFO   | jvm 1    | 2019/12/28 17:13:27 | Caused by:
java.security.UnrecoverableKeyException: failed to decrypt safe contents
entry: java.lang.IllegalStateException: password has been cleared
INFO   | jvm 1    | 2019/12/28 17:13:27 |       ... 36 more

-- 

  --...  ...--  .----.  ...    -..  .    .--  .-  --...  .--.  -..-  .--     --  .-  .-.  -.-. 


*Computers: the final frontier. These are the voyages of the user Marc.
His mission: to explore strange new hardware. To seek out new software
and new applications.
To boldly go where no Marc has gone before!
*
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.