Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.6.0
    • Fix Version/s: 2.7.0
    • Component/s: camel-jaxb
    • Labels:
    • Environment:

      Sun Jdk 1.6, Mac OSX

    • Regression:
      Regression

      Description

      This used to work in 2.5.0 but in 2.6.0 it throws:

      Caused by: javax.xml.bind.JAXBException: class com.ask.ugc.camel.Jask3061$Foo nor any of its super class is known to this context.
      	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:594)
      	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:482)
      	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
      	at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
      	at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:75)
      	at org.apache.camel.converter.jaxb.JaxbDataFormat.marshal(JaxbDataFormat.java:117)
      	at org.apache.camel.converter.jaxb.JaxbDataFormat.marshal(JaxbDataFormat.java:96)
      ...
      
      @ContextConfiguration(
              locations = "foo.bar.JaxbBug$ContextConfig",
              loader = JavaConfigContextLoader.class)
      public class JaxbBug extends AbstractTestNGSpringContextTests {
      
          @EndpointInject(uri = "mock:end")
          protected MockEndpoint mockEndpoint;
      
          @Produce(uri = "direct:test")
          protected ProducerTemplate producer;
      
          @Test
          @DirtiesContext
          public void testJaxbMarshalling() throws InterruptedException {
              mockEndpoint.expectedMessageCount(1);
      
              producer.sendBody(new Foo());
      
              mockEndpoint.assertIsSatisfied();
      
          }
      
          @Configuration
          public static class ContextConfig extends SingleRouteCamelConfiguration {
              @Bean
              public RouteBuilder route() {
                  return new RouteBuilder() {
                      @Override
                      public void configure() throws Exception {
                          JaxbDataFormat jaxb = new JaxbDataFormat(JAXBContext.newInstance(Foo.class));
                          from("direct:test").marshal(jaxb).to("mock:end");
      
      
                      }
                  };
              }
          }
      
          @XmlRootElement
          public static class Foo {
              String bar;
      
              public String getBar() {
                  return bar;
              }
      
              public void setBar(String bar) {
                  this.bar = bar;
              }
          }
      
      }
      

        Activity

        Hide
        Claus Ibsen added a comment -

        It must be something with Spring JavaConfig Testing. Using plain camel-test kit works without any problem.

        I suggest to provide a classloader in the JAXBContext.newInstance, so the Foo class can be loaded.

        Show
        Claus Ibsen added a comment - It must be something with Spring JavaConfig Testing. Using plain camel-test kit works without any problem. I suggest to provide a classloader in the JAXBContext.newInstance, so the Foo class can be loaded.
        Hide
        Claus Ibsen added a comment -

        Okay I have a test using JUnit instad of TestNG and it works fine on trunk code. I will add it to camel-jaxb.

        Show
        Claus Ibsen added a comment - Okay I have a test using JUnit instad of TestNG and it works fine on trunk code. I will add it to camel-jaxb.
        Hide
        Claus Ibsen added a comment -

        trunk: 1075707.

        Show
        Claus Ibsen added a comment - trunk: 1075707.
        Hide
        Dragisa Krsmanovic added a comment - - edited

        We have this problem in our web app (Jersey+Spring 3.0.5). It happened when we upgraded Camel from 2.5 to 2.6. The test is just to demonstrate problem.

        This same test passes with Camel 2.5 but fails with Camel 2.6

        Show
        Dragisa Krsmanovic added a comment - - edited We have this problem in our web app (Jersey+Spring 3.0.5). It happened when we upgraded Camel from 2.5 to 2.6. The test is just to demonstrate problem. This same test passes with Camel 2.5 but fails with Camel 2.6

          People

          • Assignee:
            Claus Ibsen
            Reporter:
            Dragisa Krsmanovic
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development