Hi Chavva,

You need to remove the connector part from httpj:engine element,

<httpj:connector>
        <beans:bean class="org.mortbay.jetty.bio.SocketConnector">
        <beans:property name="port" value="9001" />
        </beans:bean>
</httpj:connector>

Because it doesn't support the ssl.

On Sun Oct  9 12:28:51 2011, chavva2...@gmail.com wrote:
Hi Willem, Thanks for your reply.

Am using Camel 2.5.0, need your help in configuration of HTTPS  Webservices
using CXF component via spring configuration.  In to run my main program
loading following Spring configuration file using
ClassPathXmlApplicationContext("Configuration.xml");

While trying to run the application,* the following IllegalStateException
Exception is observed.*

Please share your Thoughts/Solutions to resolve this issue.  Am I missing
any configuration to make my application to make HTTPS.

*Note :* No issues observed to run only in HTTP.

Regards,
Chavva.


* Exception information*
/
Exception in thread "main" org.apache.camel.RuntimeCamelException:
java.lang.IllegalStateException: Port 9001 is configured with wrong protocol
"http" for "https://localhost:9001/MyService";
at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1140)
at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:103)
...
...
Caused by: java.lang.IllegalStateException: Port 9001 is configured with
wrong protocol "http" for "https://localhost:9001/MyService";
at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.retrieveEngine(JettyHTTPDestination.java:132)
at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.finalizeConfig(JettyHTTPDestination.java:151)
at
org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:123)
at
org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:103)
...
.../


*Here is complete context file.*

/<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:jaxws="http://cxf.apache.org/jaxws";
        xmlns:cxf="http://camel.apache.org/schema/cxf";
xmlns:camel="http://camel.apache.org/schema/spring";
        xmlns:http="http://cxf.apache.org/transports/http/configuration";
        xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration";
        xmlns:sec="http://cxf.apache.org/configuration/security";
xmlns:beans="http://www.springframework.org/schema/beans";
        xsi:schemaLocation="
                        http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
             http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd
             http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
             http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
             http://cxf.apache.org/configuration/security
http://cxf.apache.org/schemas/configuration/security.xsd
                        http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
                        
http://cxf.apache.org/transports/http-jetty/configuration
http://cxf.apache.org/schemas/configuration/http-jetty.xsd
                     ">
        <import resource="classpath:META-INF/cxf/cxf.xml" />
        <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
        <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
        <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" 
/>
        <camel:camelContext id="httpContext">
                <camel:routeBuilder ref="httpRoute" />
        </camel:camelContext>


<cxf:cxfEndpoint id="httpEndpoint"
                address="https://0.0.0.0:9001/MyService";
serviceClass="com.mycompany.WebServiceInerface"
                endpointName="httpttrans:httptransferServiceEndpoint"
serviceName="httpttrans:httptransferService"
                xmlns:httpttrans="https://httptransfer.mycompany.com/";>
</cxf:cxfEndpoint>


   <http:destination name="*.http-destination">  </http:destination>
        <httpj:engine-factory>
                <httpj:identifiedTLSServerParameters id="secure">
                        <httpj:tlsServerParameters>
                                <sec:keyManagers keyPassword="password">
                                        <sec:keyStore type="JKS" password="password" 
file="cherry.jks" />
                                </sec:keyManagers>
                                <sec:trustManagers>
                                        <sec:keyStore type="JKS" password="password" 
file="truststore.jks" />
                                </sec:trustManagers>
                        </httpj:tlsServerParameters>
                </httpj:identifiedTLSServerParameters>
                <httpj:engine port="9001">
                        <httpj:tlsServerParametersRef id="secure" />
                        <httpj:threadingParameters minThreads="5"  maxThreads="15" 
/>
                        <httpj:connector>
                                <beans:bean 
class="org.mortbay.jetty.bio.SocketConnector">
                                        <beans:property name="port" value="9001" 
/>
                                </beans:bean>
                        </httpj:connector>
                        <httpj:handlers>
                                <beans:bean 
class="org.mortbay.jetty.handler.DefaultHandler" />
                        </httpj:handlers>
                        <httpj:sessionSupport>true</httpj:sessionSupport>
                </httpj:engine>
        </httpj:engine-factory>
</beans>
/


--
View this message in context: 
http://camel.465427.n5.nabble.com/Configuring-cxfEndpoint-to-make-secure-HTTPS-need-help-tp4879695p4884446.html
Sent from the Camel - Users mailing list archive at Nabble.com.



--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Reply via email to