Re: [jetty-users] Not able to point to keystore file in embedded jetty

On Fri, Feb 25, 2011 at 6:24 PM, Mitul Adhia wrote:
Hi Thomas,

My application is working on windows machine ..
Yes the path should be relative to the bundle where jettyconfig bundle.

What should be the value in JETTY_HOME ??? Is the keyword is case sensitive ??? Whether it should be jetty.home or jetty_home ??

Best regards,
Mitul

On Fri, Feb 25, 2011 at 5:57 PM, Thomas Becker wrote:
Hi Mitul,

sorry, I misunderstood your requirements. I guess in your case the path is relative to where you've started jetty. Can you confirm this? I'm pretty sure that /etc/keystore1 on a linux box will resolve to the absolute path /etc/keystore1 as you would expect.

Have you tried setting a JETTY_HOME environment variable and removing the leading slash from the path? "etc/keystore1" instead of "/etc/keystore1"

Cheers,
Thomas

On 25/02/2011 10:28, Mitul Adhia wrote:
Hi Thomas,

The requirement is not to set the absolute path which is always possible . I mean if i set the path from the start of directory structure it would definitely work . But what if i wanted to set the path relative to the bundle . My application would be in finally be zipped and shipped . Definetly the customer are not going to unzip the bundles in C directory always ..it can be in any directory .

Best Regards,
Mitul

On Fri, Feb 25, 2011 at 1:49 PM, Thomas Becker wrote:
Hi Mitul,

as you're on windows have you tried setting the path to:
"C:\etc\keystore1"?

regards,
Thomas

On 25/02/2011 09:14, Mitul Adhia wrote:
Hi All,

I am using embedded jetty 7.2.2. and wanted to configure SSL in it . For this i have created fragment bundle named jettyconfig which consist of FragmentActivator class and jetty.xml & keystore1 located under folder etc. The fragment bundle is called from jetty.boot bundle .

Attach is the complete jettyconfig fragment bundle for your reference . In jetty.xml file if i set the keystore path as highlighted  below i get the following exception

jetty.xml entry for SSL

<Arg>
<New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
<Set name="Port">8443</Set>
<Set name="maxIdleTime">30000</Set>

<Set name="Acceptors">2</Set>

<Set name="AcceptQueueSize">100</Set>
<Set name="Keystore"><Property name="jetty.home" default="." />/etc/keystore1</Set>
<Set name="truststore"><Property name="jetty.home" default="." />/etc/keystore1</Set>

</New>

</Arg>
</Call>

Exception trace below comes on console when jetty is coming up :

2011-02-25 13:33:43.671:INFO::Started SelectChannelConnector@0.0.0.0:50099
2011-02-25 13:33:43.672:WARN::FAILED SslSelectChannelConnector@0.0.0.0:8443: java.io.FileNotFoundException: C:\Mitul\Software\eclipse-jpaas-helios-SR1-win32\etc\keystore1 (The system cannot find the path specified)
2011-02-25 13:33:43.673:WARN::FAILED org.eclipse.jetty.server.Server@182a70: java.io.FileNotFoundException: C:\Mitul\Software\eclipse-jpaas-helios-SR1-win32\etc\keystore1 (The system cannot find the path specified)
java.io.FileNotFoundException: C:\Mitul\Software\eclipse-jpaas-helios-SR1-win32\etc\keystore1 (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at org.eclipse.jetty.util.resource.FileResource.getInputStream(FileResource.java:274)
at org.eclipse.jetty.server.ssl.SslSelectChannelConnector.getKeyStore(SslSelectChannelConnector.java:683)
at org.eclipse.jetty.server.ssl.SslSelectChannelConnector.getKeyManagers(SslSelectChannelConnector.java:650)
at org.eclipse.jetty.server.ssl.SslSelectChannelConnector.createSSLContext(SslSelectChannelConnector.java:637)
at org.eclipse.jetty.server.ssl.SslSelectChannelConnector.doStart(SslSelectChannelConnector.java:595)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at org.eclipse.jetty.server.Server.doStart(Server.java:254)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at org.eclipse.jetty.osgi.boot.internal.serverfactory.ServerInstanceWrapper.start(ServerInstanceWrapper.java:175)
at org.eclipse.jetty.osgi.boot.internal.serverfactory.JettyServerServiceTracker.serviceChanged(JettyServerServiceTracker.java:108)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:104)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:933)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:756)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:711)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)

If the path is changed to  /newWP1/jettyconfig/etc/ketystore1 then it is able to locate the given file .  Here newWP1 is my eclipse workspace name & jettyconfig is the bundle which is attached .
I wanted to know how can i point to required file without the use of /newWP1/jettyconfig in key store path ???

Best Regards,
mitul

```
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users
```