You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Christopher Moesel <Ch...@avid.com> on 2007/04/27 20:24:52 UTC

CXF Standalone Server

Hello,

The User Guide has a page on the standalone transport:
http://cwiki.apache.org/CXF20DOC/standalone-http-transport.html

But this page only demonstrates how to setup an SSL server.  Is there
any documentation on setting up a normal HTTP listener?  I'd like to
configure the port it runs on, for instance.  I couldn't find any
samples that use Spring (the tests do have some code examples of the
server).

Also, once this is configured in Spring, how do we start the server?  Do
I just load the spring config files and it starts itself?  Or do I need
to explicitly start it?

-Chris

RE: CXF Standalone Server

Posted by Christopher Moesel <Ch...@avid.com>.
Nevermind-- it looks like the problem is caused because I'm trying to
run it from inside my IDE-- which is using the same java process and
already had jetty loaded.

Running it outside of the IDE fixed the problem.

-Chris

-----Original Message-----
From: Christopher Moesel [mailto:Christopher_Moesel@avid.com] 
Sent: Monday, April 30, 2007 10:01 AM
To: cxf-user@incubator.apache.org
Subject: RE: CXF Standalone Server

Thanks for the pointers, Willem.  Now when I load the spring config
files (just via a main method in a Java class), I get an error when it
tries to load the jetty classes.  Any ideas what might be going on here?

-Chris

Apr 30, 2007 9:58:09 AM
org.apache.cxf.transport.http_jetty.JettyHTTPDestination activate
WARNING: URL creation failed: 
java.lang.SecurityException: sealing violation: can't seal package
org.mortbay.jetty: already loaded
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:235)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
	at
org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(Jet
tyHTTPServerEngine.java:105)
	at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.activate(JettyH
TTPDestination.java:110)
	at
org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractO
bservable.java:47)
	at
org.apache.cxf.binding.AbstractBindingFactory.addListener(AbstractBindin
gFactory.java:152)
	at
org.apache.cxf.binding.soap.SoapBindingFactory.addListener(SoapBindingFa
ctory.java:376)
	at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:119)
	at
org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:246)
	at
org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:178)
	at
org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:373)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1214
)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1179)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.initializeBean(AbstractAutowireCapableBeanFactory.java:1145)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.createBean(AbstractAutowireCapableBeanFactory.java:427)
	at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObjec
t(AbstractBeanFactory.java:251)
	at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.g
etSingleton(DefaultSingletonBeanRegistry.java:144)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Ab
stractBeanFactory.java:248)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Ab
stractBeanFactory.java:160)
	at
org.springframework.beans.factory.support.DefaultListableBeanFactory.pre
InstantiateSingletons(DefaultListableBeanFactory.java:279)
	at
org.springframework.context.support.AbstractApplicationContext.refresh(A
bstractApplicationContext.java:360)
	at
org.springframework.context.support.ClassPathXmlApplicationContext.<init
>(ClassPathXmlApplicationContext.java:91)
	at
org.springframework.context.support.ClassPathXmlApplicationContext.<init
>(ClassPathXmlApplicationContext.java:75)
	at
com.avid.interplay.portal.metadata.ws.StandaloneService.main(StandaloneS
ervice.java:10)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)

-----Original Message-----
From: Willem Jiang [mailto:ning.jiang@iona.com] 
Sent: Friday, April 27, 2007 10:32 PM
To: cxf-user@incubator.apache.org
Subject: Re: CXF Standalone Server

Hi Chris,

If you want to start up a CXF standalone Server , you don't need to do 
any configuration of the HTTP listener.
It will start up the listener on the service publish address which you 
define in  the wsdl or pass to the jaxws api.

CXF HTTP standalone Server start the http transport listener when you 
call the jaxws publish() API.
But in spring,  you need not to call the publish method youself. CXF 
jaxws syntax will help you.

Here is a example of publish the service by using the  JAXWS syntax,

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:jaxws="http://cxf.apache.org/jaxws"
    xsi:schemaLocation="
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.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-extension-http.xml" />
    <import 
resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />

    <jaxws:endpoint
      id="helloWorld"
      implementor="demo.spring.HelloWorldImpl"     
      address="http://localhost:8080/HelloWorld" />
     
</beans>

NOTE:
I am not sure you how you load this configuration in spring.
But you should take care of the creation of the bus which is the key 
point of configuration in CXF. 
You need to init a right bus before you publish the service.
The detail code you can find in CXFServlet.java in cxf-rt-transport-http

module.

Cheers,
Willem.

Christopher Moesel wrote:
> Hello,
>
> The User Guide has a page on the standalone transport:
> http://cwiki.apache.org/CXF20DOC/standalone-http-transport.html
>
> But this page only demonstrates how to setup an SSL server.  Is there
> any documentation on setting up a normal HTTP listener?  I'd like to
> configure the port it runs on, for instance.  I couldn't find any
> samples that use Spring (the tests do have some code examples of the
> server).
>
> Also, once this is configured in Spring, how do we start the server?
Do
> I just load the spring config files and it starts itself?  Or do I
need
> to explicitly start it?
>
> -Chris
>
>
>   



RE: CXF Standalone Server

Posted by Christopher Moesel <Ch...@avid.com>.
Thanks for the pointers, Willem.  Now when I load the spring config
files (just via a main method in a Java class), I get an error when it
tries to load the jetty classes.  Any ideas what might be going on here?

-Chris

Apr 30, 2007 9:58:09 AM
org.apache.cxf.transport.http_jetty.JettyHTTPDestination activate
WARNING: URL creation failed: 
java.lang.SecurityException: sealing violation: can't seal package
org.mortbay.jetty: already loaded
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:235)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
	at
org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(Jet
tyHTTPServerEngine.java:105)
	at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.activate(JettyH
TTPDestination.java:110)
	at
org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractO
bservable.java:47)
	at
org.apache.cxf.binding.AbstractBindingFactory.addListener(AbstractBindin
gFactory.java:152)
	at
org.apache.cxf.binding.soap.SoapBindingFactory.addListener(SoapBindingFa
ctory.java:376)
	at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:119)
	at
org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:246)
	at
org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:178)
	at
org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:373)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1214
)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1179)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.initializeBean(AbstractAutowireCapableBeanFactory.java:1145)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.createBean(AbstractAutowireCapableBeanFactory.java:427)
	at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObjec
t(AbstractBeanFactory.java:251)
	at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.g
etSingleton(DefaultSingletonBeanRegistry.java:144)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Ab
stractBeanFactory.java:248)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Ab
stractBeanFactory.java:160)
	at
org.springframework.beans.factory.support.DefaultListableBeanFactory.pre
InstantiateSingletons(DefaultListableBeanFactory.java:279)
	at
org.springframework.context.support.AbstractApplicationContext.refresh(A
bstractApplicationContext.java:360)
	at
org.springframework.context.support.ClassPathXmlApplicationContext.<init
>(ClassPathXmlApplicationContext.java:91)
	at
org.springframework.context.support.ClassPathXmlApplicationContext.<init
>(ClassPathXmlApplicationContext.java:75)
	at
com.avid.interplay.portal.metadata.ws.StandaloneService.main(StandaloneS
ervice.java:10)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)

-----Original Message-----
From: Willem Jiang [mailto:ning.jiang@iona.com] 
Sent: Friday, April 27, 2007 10:32 PM
To: cxf-user@incubator.apache.org
Subject: Re: CXF Standalone Server

Hi Chris,

If you want to start up a CXF standalone Server , you don't need to do 
any configuration of the HTTP listener.
It will start up the listener on the service publish address which you 
define in  the wsdl or pass to the jaxws api.

CXF HTTP standalone Server start the http transport listener when you 
call the jaxws publish() API.
But in spring,  you need not to call the publish method youself. CXF 
jaxws syntax will help you.

Here is a example of publish the service by using the  JAXWS syntax,

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:jaxws="http://cxf.apache.org/jaxws"
    xsi:schemaLocation="
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.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-extension-http.xml" />
    <import 
resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />

    <jaxws:endpoint
      id="helloWorld"
      implementor="demo.spring.HelloWorldImpl"     
      address="http://localhost:8080/HelloWorld" />
     
</beans>

NOTE:
I am not sure you how you load this configuration in spring.
But you should take care of the creation of the bus which is the key 
point of configuration in CXF. 
You need to init a right bus before you publish the service.
The detail code you can find in CXFServlet.java in cxf-rt-transport-http

module.

Cheers,
Willem.

Christopher Moesel wrote:
> Hello,
>
> The User Guide has a page on the standalone transport:
> http://cwiki.apache.org/CXF20DOC/standalone-http-transport.html
>
> But this page only demonstrates how to setup an SSL server.  Is there
> any documentation on setting up a normal HTTP listener?  I'd like to
> configure the port it runs on, for instance.  I couldn't find any
> samples that use Spring (the tests do have some code examples of the
> server).
>
> Also, once this is configured in Spring, how do we start the server?
Do
> I just load the spring config files and it starts itself?  Or do I
need
> to explicitly start it?
>
> -Chris
>
>
>   



Re: CXF Standalone Server

Posted by Willem Jiang <ni...@iona.com>.
Hi Chris,

If you want to start up a CXF standalone Server , you don't need to do 
any configuration of the HTTP listener.
It will start up the listener on the service publish address which you 
define in  the wsdl or pass to the jaxws api.

CXF HTTP standalone Server start the http transport listener when you 
call the jaxws publish() API.
But in spring,  you need not to call the publish method youself. CXF 
jaxws syntax will help you.

Here is a example of publish the service by using the  JAXWS syntax,

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:jaxws="http://cxf.apache.org/jaxws"
    xsi:schemaLocation="
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.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-extension-http.xml" />
    <import 
resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />

    <jaxws:endpoint
      id="helloWorld"
      implementor="demo.spring.HelloWorldImpl"     
      address="http://localhost:8080/HelloWorld" />
     
</beans>

NOTE:
I am not sure you how you load this configuration in spring.
But you should take care of the creation of the bus which is the key 
point of configuration in CXF. 
You need to init a right bus before you publish the service.
The detail code you can find in CXFServlet.java in cxf-rt-transport-http 
module.

Cheers,
Willem.

Christopher Moesel wrote:
> Hello,
>
> The User Guide has a page on the standalone transport:
> http://cwiki.apache.org/CXF20DOC/standalone-http-transport.html
>
> But this page only demonstrates how to setup an SSL server.  Is there
> any documentation on setting up a normal HTTP listener?  I'd like to
> configure the port it runs on, for instance.  I couldn't find any
> samples that use Spring (the tests do have some code examples of the
> server).
>
> Also, once this is configured in Spring, how do we start the server?  Do
> I just load the spring config files and it starts itself?  Or do I need
> to explicitly start it?
>
> -Chris
>
>
>