camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kuro <962...@gmail.com>
Subject RestSwaggerProcessor causes NullPointerException
Date Fri, 26 Feb 2016 23:57:04 GMT
Camel ver : 2.16.2

RestSwaggerProcessor causes NullPointerException when I access
`http://localhost:8888/api/api-doc`

error log 
----------------------------------
[Camel (camel-1) thread #0 - NettyEventExecutorGroup] WARN
org.apache.camel.swagger.RestSwaggerProcessor - Error rendering Swagger API
due null
java.lang.NullPointerException
	at
org.apache.camel.swagger.RestSwaggerReader$VerbOrdering.compare(RestSwaggerReader.java:358)
	at
org.apache.camel.swagger.RestSwaggerReader$VerbOrdering.compare(RestSwaggerReader.java:339)
	at java.util.TimSort.binarySort(TimSort.java:292)
	at java.util.TimSort.sort(TimSort.java:217)
	at java.util.Arrays.sort(Arrays.java:1512)
	at java.util.ArrayList.sort(ArrayList.java:1454)
	at java.util.Collections.sort(Collections.java:175)
	at
org.apache.camel.swagger.RestSwaggerReader.parse(RestSwaggerReader.java:94)
	at
org.apache.camel.swagger.RestSwaggerReader.read(RestSwaggerReader.java:83)
	at
org.apache.camel.swagger.RestSwaggerSupport.renderResourceListing(RestSwaggerSupport.java:191)
	at
org.apache.camel.swagger.RestSwaggerProcessor.process(RestSwaggerProcessor.java:95)
	at
org.apache.camel.component.rest.RestApiProducer.process(RestApiProducer.java:36)
	at
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:141)
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
	at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
	at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
	at
org.apache.camel.component.netty4.handlers.ServerChannelHandler.processAsynchronously(ServerChannelHandler.java:138)
	at
org.apache.camel.component.netty4.handlers.ServerChannelHandler.channelRead0(ServerChannelHandler.java:109)
	at
org.apache.camel.component.netty4.http.handlers.HttpServerChannelHandler.channelRead0(HttpServerChannelHandler.java:211)
	at
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
	at
org.apache.camel.component.netty4.http.handlers.HttpServerMultiplexChannelHandler.channelRead0(HttpServerMultiplexChannelHandler.java:113)
	at
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
	at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318)
	at
io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:42)
	at
io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:309)
	at
io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:36)
	at
io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
	at java.lang.Thread.run(Thread.java:745)

----------------------------------

Here is my code.

    @Override
    public void configure() throws Exception {
        
restConfiguration().component("netty4-http").bindingMode(RestBindingMode.json)
                .enableCORS(true)
                .contextPath("/api").port(8888).host("localhost")
                .endpointProperty("mapHeaders", "true")
                .endpointProperty("urlDecodeHeaders", "true")
                .apiContextPath("/api-doc")
                .apiProperty("cors", "true");

        rest("/api")

                .get()
                     .to("direct:get")
                .put()
                    .to("direct:put")
                .delete()
                    .description("del", "del", "")
                    .to("direct:del")
                .options()
                      .to("direct:options");
     }

-----------------

I found ModelHelper class makes incorrect Xml.

org.apache.camel.model.ModelHelper
public static String dumpModelAsXml(......)

return value
---------------------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<rests xmlns="http://camel.apache.org/schema/spring">
    <rest path="/api">
        <get routeId="route1">
            <to uri="direct:get" customId="true" id="route1"/>
        </get>
        <put  routeId="route2">
            <to uri="direct:put" customId="true" id="route2"/>
        </put>
        <delete routeId="del" customId="true" id="del">
            <to uri="direct:del" customId="true" id="del"/>
        </delete>
        <verb routeId="route3">
            <to uri="direct:options" customId="true" id="route3"/>
        </verb>
    </rest>
</rests>




--
View this message in context: http://camel.465427.n5.nabble.com/RestSwaggerProcessor-causes-NullPointerException-tp5778340.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message