hi,

I added a service with certificate with this code:
                         JaxWsServerFactoryBean sf = new
JaxWsServerFactoryBean();
                         sf.setServiceClass(implementor.getClass());
                         String hostName;
                         int port =8443
                         hostName ="localhost"
                         sf.setAddress("https://"+hostName +":"+port+"/"+ 
serviceName);
                         sf.getServiceFactory().setInvoker(new 
BeanInvoker(implementor));
                         sslServerConfigUtil.configureSSLOnTheServer(sf, port, 
hostName);
                         Server s = sf.create();

/*sslServerConfigUtil is:*/

public JaxWsServerFactoryBean configureSSLOnTheServer(JaxWsServerFactoryBean
sf, int port, String address) {
                try {

                        TLSServerParameters tlsParams = new 
TLSServerParameters();
                        KeyStore keyStore =
KeyStore.getInstance(KeyStore.getDefaultType());//keyStoreName);
                        String password = trustpass;
                        File truststore = new File(filePath);
                        keyStore.load(new FileInputStream(truststore), 
password.toCharArray());
                        KeyManagerFactory keyFactory =
KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
                        keyFactory.init(keyStore, password.toCharArray());
                        KeyManager[] km = keyFactory.getKeyManagers();
                        tlsParams.setKeyManagers(km);

                        truststore = new File(filePath);
                        keyStore.load(new FileInputStream(truststore), 
password.toCharArray());
                        TrustManagerFactory trustFactory =
TrustManagerFactory.getInstance(TrustManagerFactory
                                        .getDefaultAlgorithm());
                        trustFactory.init(keyStore);
                        //TrustManager[] tm =
getTrustedManagers();//trustFactory.getTrustManagers();
                        TrustManager[] trustManagers;
                        TrustManagerFactory trustManagerFactory =
TrustManagerFactory.getInstance("SunX509");
                        trustManagerFactory.init(keyStore);
                        trustManagers = trustManagerFactory.getTrustManagers();
                        
                        tlsParams.setTrustManagers(trustManagers);

                        ClientAuthentication ca = new ClientAuthentication();
                        ca.setRequired(true);
                        ca.setWant(true);
                        tlsParams.setClientAuthentication(ca);

                        JettyHTTPServerEngineFactory factory = new
JettyHTTPServerEngineFactory();
                        factory.setTLSServerParametersForPort(address,port, 
tlsParams);
                
                

                }
                return sf;
        }

this code is working fine when I'm load just 1 service, but, if I'm trying
to load another one (with another implementor) I'm getting this error
message: java.io.IOException: can't set the TLS params on the opened
connector.

how can I do it?

thanks in advance!



--
View this message in context: 
http://cxf.547215.n5.nabble.com/create-more-than-1-web-service-on-the-same-port-with-ssl-certificate-tp5765982.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to