Keystore.jks (for SSL) cannot be found when starting project with Intellij IDEA, but Eclipse found

I am using an application context file to configure SSL to connect to a queue using Spring JMS. I am using MethodInvokingFactoryBean method:

<bean
    class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    <property name="targetObject">
        <bean
            class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
            <property name="targetClass" value="java.lang.System" />
            <property name="targetMethod" value="getProperties" />
        </bean>
    </property>
    <property name="targetMethod" value="putAll" />
    <property name="arguments">
        <util:properties>
            <prop key="javax.net.ssl.trustStore">src\main\resources\META-INF\spring\ssl\truststore.jks
            </prop>
            <prop key="javax.net.ssl.trustStorePassword">******</prop>
            <prop key="javax.net.ssl.keyStore">src\main\resources\META-INF\spring\ssl\keystore.jks
            </prop>
            <prop key="javax.net.ssl.keyStorePassword">******</prop>
            <prop key="javax.net.ssl.keyStoreType">jks</prop>
        </util:properties>
    </property>
</bean>

      

This works in eclipse without any problem. However, when running with IDEA, it does not seem to find the keyStore file and hence cannot connect, causing the SSL handshake to fail.

Caused by: java.io.FileNotFoundException: src\main\resources\META-INF\spring\ssl\keystore.jks (The system cannot find the path specified)

      

The project is a standard maven project. Both Eclipse and IDEA use the same JRE and have a resource folder included in the build path. Any help on why this is happening is appreciated. Also, if any other information is required please let me know.

+3


source to share


1 answer


In IntelliJ, the working directory is different from Eclipse. Check the run configuration in IDEA and set it accordingly. If I remember correctly in Eclipse his workspace and in IDEA the whole project. See Run / Debug Configuration: Application (remember, in IDEA the project is the workspace) and the Default eclipse desktop



+4


source







All Articles