You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Benson Margulies <bi...@basistech.com> on 2007/10/01 23:38:55 UTC

Jetty configuration puzzle

This is not exactly concise, please forgive me.

 

Step 1: load up a load of beans.

 

        applicationContext = new GenericApplicationContext();

        readBeans(new ClassPathResource("META-INF/cxf/cxf.xml"));

        readBeans(new
ClassPathResource("META-INF/cxf/cxf-extension-soap.xml"));

        readBeans(new
ClassPathResource("META-INF/cxf/cxf-extension-http.xml"));

        readBeans(new
ClassPathResource("META-INF/cxf/cxf-extension-http-jetty.xml"));

        readBeans(new ClassPathResource("jetty-config-beans.xml",
getClass()));

        readBeans(getServiceDefinitionBeans());

        

     // bring in some property values from a Properties file

        PropertyPlaceholderConfigurer cfg = new
PropertyPlaceholderConfigurer();

        Properties properties = new Properties();

        properties.setProperty("staticResourceURL",
getStaticResourceURL());

        cfg.setProperties(properties);

        // now actually do the replacement

        cfg.postProcessBeanFactory(applicationContext.getBeanFactory());


        applicationContext.refresh();
 
Step 2: What's in those beans? The jetty-config-beans.xml looks like:
 
<httpj:engine-factory bus="cxf">
  <httpj:engine port="8808">
      <httpj:handlers>
        <bean class="org.mortbay.jetty.handler.ResourceHandler">
          <property name="baseResource">
            <bean class="org.mortbay.resource.FileResource">
             <constructor-arg value="${staticResourceURL}"/>
            </bean>
          </property>
        </bean>
        <bean class="org.mortbay.jetty.handler.DefaultHandler"/>

      </httpj:handlers>
    </httpj:engine>
</httpj:engine-factory>
 
And the last set of beans looks like:
 

<bean id="aegisBean"
class="org.apache.cxf.aegis.databinding.AegisDatabinding"
scope='prototype'>

  <property name='configuration'>

   <bean class='org.apache.cxf.aegis.type.Configuration'>

    <property name='defaultMinOccurs' value='1' />

    <property name='defaultNillable' value='false' />

   </bean>

  </property>

 </bean>

 

<bean id='jaxws-and-aegis-service-factory'
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"

  scope='prototype'>

  <property name="dataBinding" ref="aegisBean" />

 </bean>

 

 <jaxws:endpoint id="dummy-service-endpoint"
implementor="com.basistech.ws.DummyServiceImpl"
address="http://localhost:8808/Dummy">

  <jaxws:serviceFactory>

   <ref bean='jaxws-and-aegis-service-factory' />

  </jaxws:serviceFactory>

 </jaxws:endpoint>

 

 <bean id="dummy-client" class="com.basistech.ws.DummyService"
factory-bean="clientFactory" factory-method="create" />

 

 <bean id="clientFactory"
class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">

  <property name="serviceClass" value="com.basistech.ws.DummyService" />

  <property name="address" value="http://localhost:8808/Dummy" />

 </bean>

 

So, what could explain the following log traffic? What is with
'IOException: not found'?

 
 

Oct 1, 2007 5:33:27 PM sun.reflect.NativeMethodAccessorImpl invoke0

INFO: Logging to org.slf4j.impl.JDK14LoggerAdapter(org.mortbay.log) via
org.mortbay.log.Slf4jLog

Oct 1, 2007 5:33:27 PM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass

INFO: Creating Service {http://ws.basistech.com/}DummyServiceImplService
from class com.basistech.ws.DummyServiceImpl

Oct 1, 2007 5:33:28 PM sun.reflect.NativeMethodAccessorImpl invoke0

INFO: jetty-6.1.5

Oct 1, 2007 5:33:28 PM sun.reflect.NativeMethodAccessorImpl invoke0

INFO: Started SelectChannelConnector@0.0.0.0:8808

Oct 1, 2007 5:33:28 PM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass

INFO: Creating Service {http://ws.basistech.com/}DummyServiceService
from class com.basistech.ws.DummyService

Oct 1, 2007 5:33:28 PM org.apache.cxf.phase.PhaseInterceptorChain
doIntercept

INFO: Interceptor has thrown exception, unwinding now

org.apache.cxf.interceptor.Fault: Could not send Message.

      at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingI
nterceptor.handleMessage(MessageSenderInterceptor.java:64)

      at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
hain.java:207)

      at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)

      at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205)

      at
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)

      at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)

      at $Proxy28.echo(Unknown Source)

      at
com.basistech.ws.TestAbstractTestService.pokeDummyService(TestAbstractTe
stService.java:35)

      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.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethod
Runner.java:99)

      at
org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRun
ner.java:81)

      at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAf
terRunner.java:34)

      at
org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.j
ava:75)

      at
org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45
)

      at
org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestC
lassMethodsRunner.java:66)

      at
org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRu
nner.java:35)

      at
org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRun
ner.java:42)

      at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAf
terRunner.java:34)

      at
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)

      at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4Tes
tReference.java:38)

      at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.ja
va:38)

      at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:460)

      at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:673)

      at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
ner.java:386)

      at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
nner.java:196)

Caused by: java.io.IOException: Not Found

      at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResp
onse(HTTPConduit.java:1885)

      at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTP
Conduit.java:1790)

      at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)

      at
org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:576)

      at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingI
nterceptor.handleMessage(MessageSenderInterceptor.java:62)

      ... 27 more

Oct 1, 2007 5:33:30 PM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass

INFO: Creating Service {http://ws.basistech.com/}DummyServiceImplService
from class com.basistech.ws.DummyServiceImpl

Oct 1, 2007 5:33:30 PM sun.reflect.NativeMethodAccessorImpl invoke0

INFO: jetty-6.1.5

Oct 1, 2007 5:33:30 PM sun.reflect.NativeMethodAccessorImpl invoke0

WARNING: failed SelectChannelConnector@0.0.0.0:8808

java.net.BindException: Address already in use: bind

      at sun.nio.ch.Net.bind(Native Method)

      at
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:119
)

      at
sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)

      at
org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector
.java:211)

      at
org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnec
tor.java:309)

      at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)

      at org.mortbay.jetty.Server.doStart(Server.java:228)

      at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)

      at
org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(Jet
tyHTTPServerEngine.java:244)

      at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.activate(JettyH
TTPDestination.java:143)

      at
org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractO
bservable.java:47)

      at
org.apache.cxf.binding.AbstractBindingFactory.addListener(AbstractBindin
gFactory.java:166)

      at
org.apache.cxf.binding.soap.SoapBindingFactory.addListener(SoapBindingFa
ctory.java:617)

      at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:121)

     at
org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:231)

      at
org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:179)

      at
org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:340)

      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
com.basistech.ws.AbstractTestService.launchService(AbstractTestService.j
ava:48)

      at
com.basistech.ws.TestAbstractTestService.before(TestAbstractTestService.
java:19)

      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.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAf
terRunner.java:74)

      at
org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfte
rRunner.java:50)

      at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAf
terRunner.java:33)

      at
org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.j
ava:75)

      at
org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45
)

      at
org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestC
lassMethodsRunner.java:66)

      at
org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRu
nner.java:35)

      at
org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRun
ner.java:42)

      at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAf
terRunner.java:34)

      at
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)

      at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4Tes
tReference.java:38)

      at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.ja
va:38)

      at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:460)

      at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:673)

      at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
ner.java:386)

      at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
nner.java:196)

Oct 1, 2007 5:33:30 PM sun.reflect.NativeMethodAccessorImpl invoke0

WARNING: failed Server@129645a

java.net.BindException: Address already in use: bind

      at sun.nio.ch.Net.bind(Native Method)

      at
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:119
)

      at
sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)

      at
org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector
.java:211)

      at
org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnec
tor.java:309)

      at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)

      at org.mortbay.jetty.Server.doStart(Server.java:228)

      at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)

      at
org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(Jet
tyHTTPServerEngine.java:244)

      at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.activate(JettyH
TTPDestination.java:143)

      at
org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractO
bservable.java:47)

      at
org.apache.cxf.binding.AbstractBindingFactory.addListener(AbstractBindin
gFactory.java:166)

      at
org.apache.cxf.binding.soap.SoapBindingFactory.addListener(SoapBindingFa
ctory.java:617)

      at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:121)

     at
org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:231)

      at
org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:179)

      at
org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:340)

      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
com.basistech.ws.AbstractTestService.launchService(AbstractTestService.j
ava:48)

      at
com.basistech.ws.TestAbstractTestService.before(TestAbstractTestService.
java:19)

      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.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAf
terRunner.java:74)

      at
org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfte
rRunner.java:50)

      at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAf
terRunner.java:33)

      at
org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.j
ava:75)

      at
org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45
)

      at
org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestC
lassMethodsRunner.java:66)

      at
org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRu
nner.java:35)

      at
org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRun
ner.java:42)

      at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAf
terRunner.java:34)

      at
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)

      at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4Tes
tReference.java:38)

      at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.ja
va:38)

      at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:460)

      at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:673)

      at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
ner.java:386)

      at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
nner.java:196)

Oct 1, 2007 5:33:30 PM
org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine addServant

SEVERE: Could not start Jetty server: Address already in use: bind

Oct 1, 2007 5:33:30 PM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass

INFO: Creating Service {http://ws.basistech.com/}DummyServiceService
from class com.basistech.ws.DummyService

 
 

RE: Jetty configuration puzzle

Posted by Benson Margulies <bi...@basistech.com>.
This problem goes away if I take out the engine config. So, I guess I'm
asking why the following disables handling actual web service endpoints.
Do I need some different bit of spring-ery to add my handlers without
disturbing the usual handler for the endpoints?

<httpj:engine-factory bus="cxf">
  <httpj:engine port="8808">
      <httpj:handlers>
        <bean class="org.mortbay.jetty.handler.ResourceHandler">
          <property name="baseResource">
            <bean class="org.mortbay.resource.FileResource">
             <constructor-arg value="${staticResourceURL}"/>
            </bean>
          </property>
        </bean>
        <bean class="org.mortbay.jetty.handler.DefaultHandler"/>

      </httpj:handlers>
    </httpj:engine>
</httpj:engine-factory>