Hi Sergey,

I ended up just upgrading to 3.0 and added pretty much all the jars to the
classpath and it's working. I will trim them down afterwards to the minimum
needed. Thanks for your help!

Chris


On Thu, Jul 3, 2014 at 8:09 AM, Sergey Beryozkin <[email protected]>
wrote:

> On 03/07/14 12:59, Chris Bud wrote:
>
>> Yes I run it like so, I need both http-jetty and http transports to get
>> the
>> service started.
>>
>> java -cp
>> test-1.0-jar-with-dependencies.jar:cxf-rt-transports-http-2.7.11.jar:
>> cxf-rt-transports-http-jetty-2.7.11.jar
>> com.crush.tests.service.Test
>>
>> I'm trying to deploy this to a VM so I will not be able to run the maven
>> profile in my target deployment
>>
> Ok, it makes it more interesting. Can you deploy it as a war ?
>
> If not then we'd need to have a complete class path that may be needed for
> 2.7.11. It can be simpler with 3.0.0.
>
> In 2.7.11 you'd also need to have cxf-rt-bindings-xml and cxf-api added at
> the very least. In 3.0.0 those 2 deps would be replaced by cxf-core.
> I'm not 100% sure we can completely avoid Spring dependencies in 2.7.11.
> Please continue experimenting, it is a class path issue,
> I can try and experiment myself a bit later too, give it a try please
> Cheers, Sergey
>
>
>
>
>
>>
>> On Thu, Jul 3, 2014 at 7:53 AM, Sergey Beryozkin <[email protected]>
>> wrote:
>>
>>  So you have a jar and then add CXF http-jetty tarnsport to the classpath
>>> with -cp ? I don;t understand how else you'd get JettyHttpDestination
>>> loaded as per the stack trace.
>>> If you do follow this approach then I'm not sure it makes sense to
>>> investigate the cause because this is not how CXF applications ever run,
>>> one would use -Pserver for a simple demo run or would depend on a war and
>>> HTTP containers...
>>>
>>> Cheers, Sergey
>>>
>>>
>>>
>>> On 03/07/14 12:45, Chris Bud wrote:
>>>
>>>  I'm running from the command line using my standalone jar. I configured
>>>> cxf
>>>> without spring per the link you provided.
>>>>
>>>>
>>>> On Thu, Jul 3, 2014 at 7:08 AM, Sergey Beryozkin <[email protected]>
>>>> wrote:
>>>>
>>>>   Have you created a war or use -Pserver or something else ?
>>>>
>>>>>
>>>>> Cheers, Sergey
>>>>>
>>>>> On 03/07/14 10:31, Chris Bud wrote:
>>>>>
>>>>>   Now I try to hit my service and I'm getting an exception
>>>>>
>>>>>>
>>>>>> 2014-07-03 04:49:58.264:WARN:oejs.AbstractHttpConnection:/basic/test
>>>>>> java.lang.NullPointerException
>>>>>> at
>>>>>> org.apache.cxf.transport.ChainInitiationObserver.onMessage(
>>>>>> ChainInitiationObserver.java:99)
>>>>>> at
>>>>>> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(
>>>>>> AbstractHTTPDestination.java:243)
>>>>>> at
>>>>>> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(
>>>>>> JettyHTTPDestination.java:259)
>>>>>> at
>>>>>> org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(
>>>>>> JettyHTTPHandler.java:65)
>>>>>> at
>>>>>> org.eclipse.jetty.server.handler.ContextHandler.
>>>>>> doHandle(ContextHandler.java:1067)
>>>>>> at
>>>>>> org.eclipse.jetty.server.handler.ContextHandler.
>>>>>> doScope(ContextHandler.java:1003)
>>>>>> at
>>>>>> org.eclipse.jetty.server.handler.ScopedHandler.handle(
>>>>>> ScopedHandler.java:117)
>>>>>> at
>>>>>> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(
>>>>>> ContextHandlerCollection.java:250)
>>>>>> at
>>>>>> org.eclipse.jetty.server.handler.HandlerWrapper.handle(
>>>>>> HandlerWrapper.java:111)
>>>>>> at org.eclipse.jetty.server.Server.handle(Server.java:351)
>>>>>> at
>>>>>> org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(
>>>>>> AbstractHttpConnection.java:454)
>>>>>> at
>>>>>> org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(
>>>>>> AbstractHttpConnection.java:890)
>>>>>> at
>>>>>> org.eclipse.jetty.server.AbstractHttpConnection$
>>>>>> RequestHandler.headerComplete(AbstractHttpConnection.java:944)
>>>>>> at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)
>>>>>> at org.eclipse.jetty.http.HttpParser.parseAvailable(
>>>>>> HttpParser.java:230)
>>>>>> at
>>>>>> org.eclipse.jetty.server.AsyncHttpConnection.handle(
>>>>>> AsyncHttpConnection.java:77)
>>>>>> at
>>>>>> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(
>>>>>> SelectChannelEndPoint.java:609)
>>>>>> at
>>>>>> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(
>>>>>> SelectChannelEndPoint.java:45)
>>>>>> at
>>>>>> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(
>>>>>> QueuedThreadPool.java:599)
>>>>>> at
>>>>>> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(
>>>>>> QueuedThreadPool.java:534)
>>>>>> at java.lang.Thread.run(Thread.java:722)
>>>>>>
>>>>>> Here's my service class
>>>>>>
>>>>>> @Path("/basic")
>>>>>> @Produces("text/xml")
>>>>>> public class BasicServiceImpl implements BasicService {
>>>>>> @GET
>>>>>> @Path("/test")
>>>>>> public String test()
>>>>>> {
>>>>>> log.debug("Test() WSMethod called!");
>>>>>> return "This is a test rest call";
>>>>>> }
>>>>>>
>>>>>> }
>>>>>>
>>>>>> The server starts up with this output
>>>>>> Jul 03, 2014 5:24:08 AM org.apache.cxf.endpoint.ServerImpl
>>>>>> initDestination
>>>>>> INFO: Setting the server's publish address to be
>>>>>> http://localhost:9000/
>>>>>> 2014-07-03 05:24:08.279:INFO:oejs.Server:jetty-8.y.z-SNAPSHOT
>>>>>> 2014-07-03 05:24:08.313:INFO:oejs.AbstractConnector:Started
>>>>>> SelectChannelConnector@localhost:9000
>>>>>> 2014-07-03 05:24:08,328 INFO [com.crush.tests.service.Test] - Started
>>>>>> Basic
>>>>>> Web Service!
>>>>>>
>>>>>> I'm trying to make the request via wget
>>>>>> wget http://localhost:9000/basic/test
>>>>>> --2014-07-03 05:13:11--  http://localhost:9000/basic/test
>>>>>> Resolving localhost (localhost)... 127.0.0.1
>>>>>> Connecting to localhost (localhost)|127.0.0.1|:9000... connected.
>>>>>> HTTP request sent, awaiting response... 500 Server Error
>>>>>> 2014-07-03 05:13:11 ERROR 500: Server Error.
>>>>>>
>>>>>> Am I missing something?
>>>>>>
>>>>>>
>>>>>> On Mon, Jun 30, 2014 at 6:31 AM, Chris Bud
>>>>>> <chrisb.business.email@gmail.
>>>>>> com>
>>>>>> wrote:
>>>>>>
>>>>>>    I only copied the source from the demo, I put it into my own
>>>>>> project
>>>>>> and
>>>>>>
>>>>>>  added the maven assembly plugin so all my dependencies were bundled
>>>>>>> into
>>>>>>> a
>>>>>>> single jar.
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Jun 30, 2014 at 6:14 AM, Sergey Beryozkin <
>>>>>>> [email protected]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>    Hi
>>>>>>>
>>>>>>>
>>>>>>>> On 30/06/14 11:08, Chris Bud wrote:
>>>>>>>>
>>>>>>>>    Thanks Sergey, I was able to start the server with both
>>>>>>>> transports-http
>>>>>>>>
>>>>>>>>  and
>>>>>>>>> transports-http-jetty on the classpath.. What I don't understand is
>>>>>>>>> why
>>>>>>>>> this works but with those bundled into a single jar it does not.
>>>>>>>>>
>>>>>>>>>     The demo build produces a jar with the demo classes only.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>  Cheers, Sergey
>>>>>>>>
>>>>>>>>
>>>>>>>>   On Mon, Jun 30, 2014 at 5:56 AM, Sergey Beryozkin <
>>>>>>>>
>>>>>>>>> [email protected]>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>     Sorry, I was wrong, it is a jar after all. The demo is not
>>>>>>>>> meant
>>>>>>>>> to
>>>>>>>>> be
>>>>>>>>>
>>>>>>>>>   deployed into the container, and a such having a CXF http-jetty
>>>>>>>>>
>>>>>>>>>> transport
>>>>>>>>>> Maven dependency is sufficient.
>>>>>>>>>> You can't have it run from java directly, actually you probably
>>>>>>>>>> can
>>>>>>>>>> if
>>>>>>>>>> you
>>>>>>>>>> update a classpath to reference a cxf-rt-transport-http-jetty jar
>>>>>>>>>> shipped
>>>>>>>>>> in the distribution.
>>>>>>>>>>
>>>>>>>>>> Cheers, Sergey
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 30/06/14 10:49, Chris Bud wrote:
>>>>>>>>>>
>>>>>>>>>>     Hi Sergey,
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>  Thanks for the link I tried to implement but still produces the
>>>>>>>>>>> same
>>>>>>>>>>> error.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> java -cp target/sample-service-1.0-jar-with-dependencies.jar
>>>>>>>>>>> com.crush.tests.service.Test
>>>>>>>>>>> Exception in thread "main"
>>>>>>>>>>> org.apache.cxf.service.factory.ServiceConstructionException
>>>>>>>>>>> at
>>>>>>>>>>> org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(
>>>>>>>>>>> JAXRSServerFactoryBean.java:205)
>>>>>>>>>>> at com.crush.tests.service.Test.<init>(Test.java:27)
>>>>>>>>>>> at com.crush.tests.service.Test.main(Test.java:32)
>>>>>>>>>>> Caused by: org.apache.cxf.BusException: No DestinationFactory was
>>>>>>>>>>> found
>>>>>>>>>>> for
>>>>>>>>>>> the namespace http://cxf.apache.org/transports/http.
>>>>>>>>>>> at
>>>>>>>>>>> org.apache.cxf.bus.managers.DestinationFactoryManagerImpl.
>>>>>>>>>>> getDestinationFactory(DestinationFactoryManagerImpl.java:130)
>>>>>>>>>>> at org.apache.cxf.endpoint.ServerImpl.initDestination(
>>>>>>>>>>> ServerImpl.java:78)
>>>>>>>>>>> at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:62)
>>>>>>>>>>> at
>>>>>>>>>>> org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(
>>>>>>>>>>> JAXRSServerFactoryBean.java:159)
>>>>>>>>>>> ... 2 more
>>>>>>>>>>>
>>>>>>>>>>> My Test source
>>>>>>>>>>> public class Test
>>>>>>>>>>> {
>>>>>>>>>>>
>>>>>>>>>>> protected Test() throws Exception
>>>>>>>>>>> {
>>>>>>>>>>> JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
>>>>>>>>>>>              sf.setResourceClasses(SampleServiceImpl.class);
>>>>>>>>>>>              sf.setResourceProvider(SampleServiceImpl.class,
>>>>>>>>>>>                  new SingletonResourceProvider(new
>>>>>>>>>>> SampleServiceImpl()));
>>>>>>>>>>>              sf.setAddress("http://localhost:9000/";);
>>>>>>>>>>>
>>>>>>>>>>> BindingFactoryManager manager =
>>>>>>>>>>> sf.getBus().getExtension(BindingFactoryManager.class);
>>>>>>>>>>> JAXRSBindingFactory factory = new JAXRSBindingFactory();
>>>>>>>>>>> factory.setBus(sf.getBus());
>>>>>>>>>>> manager.registerBindingFactory(JAXRSBindingFactory.JAXRS_
>>>>>>>>>>> BINDING_ID,
>>>>>>>>>>> factory);
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>              sf.create();
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> public static void main(String[] args) throws Exception
>>>>>>>>>>> {
>>>>>>>>>>> new Test();
>>>>>>>>>>> System.out.println("Server ready...");
>>>>>>>>>>> Thread.sleep(5 * 6000 * 1000);
>>>>>>>>>>>              System.out.println("Server exiting");
>>>>>>>>>>>              System.exit(0);
>>>>>>>>>>>
>>>>>>>>>>> }
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> Any other thoughts?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Fri, Jun 27, 2014 at 5:07 PM, Sergey Beryozkin <
>>>>>>>>>>> [email protected]>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>      Hi
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>   On 27/06/14 17:51, Chris Bud wrote:
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>      Hi All,
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>   I'm trying to build a basic jax-rs example using version
>>>>>>>>>>>> 2.7.11.
>>>>>>>>>>>>
>>>>>>>>>>>>>     Using
>>>>>>>>>>>>> the
>>>>>>>>>>>>> server and service code from the example code
>>>>>>>>>>>>> <http://svn.apache.org/viewvc/cxf/trunk/distribution/src/
>>>>>>>>>>>>> main/release/samples/jax_rs/basic/>,
>>>>>>>>>>>>>
>>>>>>>>>>>>> I can build and run it just like the readme instructions say
>>>>>>>>>>>>> (mvn
>>>>>>>>>>>>> -Pserver)
>>>>>>>>>>>>> but if I produce a jar bundled with the dependencies and run
>>>>>>>>>>>>> from
>>>>>>>>>>>>> the
>>>>>>>>>>>>> command line I cannot get the server to start.  I get the
>>>>>>>>>>>>> following
>>>>>>>>>>>>> exception
>>>>>>>>>>>>>
>>>>>>>>>>>>> test-service/target$ java -cp test-service-1.0-jar-with-
>>>>>>>>>>>>> dependencies.jar
>>>>>>>>>>>>> com.test.Server
>>>>>>>>>>>>> Exception in thread "main"
>>>>>>>>>>>>> org.apache.cxf.service.factory.ServiceConstructionException
>>>>>>>>>>>>> at
>>>>>>>>>>>>> org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(
>>>>>>>>>>>>> JAXRSServerFactoryBean.java:190)
>>>>>>>>>>>>> at com.test.Server.<init>(Server.java:24)
>>>>>>>>>>>>> at com.test.Server.main(Server.java:29)
>>>>>>>>>>>>> Caused by: org.apache.cxf.BusException: No DestinationFactory
>>>>>>>>>>>>> was
>>>>>>>>>>>>> found
>>>>>>>>>>>>> for
>>>>>>>>>>>>> the namespace http://cxf.apache.org/transports/http.
>>>>>>>>>>>>> at
>>>>>>>>>>>>> org.apache.cxf.bus.managers.DestinationFactoryManagerImpl.
>>>>>>>>>>>>> getDestinationFactory(DestinationFactoryManagerImpl.java:130)
>>>>>>>>>>>>> at org.apache.cxf.endpoint.ServerImpl.initDestination(
>>>>>>>>>>>>> ServerImpl.java:78)
>>>>>>>>>>>>> at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.
>>>>>>>>>>>>> java:62)
>>>>>>>>>>>>> at
>>>>>>>>>>>>> org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(
>>>>>>>>>>>>> JAXRSServerFactoryBean.java:151)
>>>>>>>>>>>>> ... 2 more
>>>>>>>>>>>>>
>>>>>>>>>>>>> Can anyone point me in the right direction?
>>>>>>>>>>>>>
>>>>>>>>>>>>>       It appears that when running a packaged Jetty based demo
>>>>>>>>>>>>> the
>>>>>>>>>>>>> following
>>>>>>>>>>>>>
>>>>>>>>>>>>>     has to be done:
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>  http://cxf.apache.org/docs/jaxrs-services-configuration.html#
>>>>>>>>>>>> JAXRSServicesConfiguration-ConfiguringJAX-
>>>>>>>>>>>> RSendpointsprogrammaticallywit
>>>>>>>>>>>> houtSpring
>>>>>>>>>>>>
>>>>>>>>>>>> Please see the lines related to registering binding id/factory
>>>>>>>>>>>>
>>>>>>>>>>>> Can you please update Server accordingly, recompile and retry ?
>>>>>>>>>>>>
>>>>>>>>>>>> Cheers, Sergey
>>>>>>>>>>>>
>>>>>>>>>>>>       Thanks,
>>>>>>>>>>>>
>>>>>>>>>>>>     Chris
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>     --
>>>>>>>>>>>>>
>>>>>>>>>>>>>   Sergey Beryozkin
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Talend Community Coders
>>>>>>>>>>>> http://coders.talend.com/
>>>>>>>>>>>>
>>>>>>>>>>>> Blog: http://sberyozkin.blogspot.com
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>     --
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>  Sergey Beryozkin
>>>>>>>>>>
>>>>>>>>>> Talend Community Coders
>>>>>>>>>> http://coders.talend.com/
>>>>>>>>>>
>>>>>>>>>> Blog: http://sberyozkin.blogspot.com
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>    --
>>>>>>>>>
>>>>>>>> Sergey Beryozkin
>>>>>>>>
>>>>>>>> Talend Community Coders
>>>>>>>> http://coders.talend.com/
>>>>>>>>
>>>>>>>> Blog: http://sberyozkin.blogspot.com
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>  --
>>>>> Sergey Beryozkin
>>>>>
>>>>> Talend Community Coders
>>>>> http://coders.talend.com/
>>>>>
>>>>> Blog: http://sberyozkin.blogspot.com
>>>>>
>>>>>
>>>>>
>>>>
>>> --
>>> Sergey Beryozkin
>>>
>>> Talend Community Coders
>>> http://coders.talend.com/
>>>
>>> Blog: http://sberyozkin.blogspot.com
>>>
>>>
>>

Reply via email to