Spring boot ActiveMQ JMS shows Resource does not exist: ServletContext resource [/xsd/product.xsd]











up vote
0
down vote

favorite












Following is my JMSConfig.java



@Configuration
public class JMSConfig {

private static final Logger logger = LoggerFactory.getLogger(JMSConfig.class);

@Bean
public MarshallingMessageConverter createMarshallingMessageConverter(final Jaxb2Marshaller jaxb2Marshaller) {
return new MarshallingMessageConverter(jaxb2Marshaller);
}

@Bean
public Jaxb2Marshaller createJaxb2Marshaller(@Value("${context.path}") final String contextPath,
@Value("${schema.location}") final Resource schemaResource) {

Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
jaxb2Marshaller.setContextPath(contextPath);
try {
jaxb2Marshaller.setSchema(schemaResource);
}catch(Exception e) {
logger.error("Error occurred while getting xsd resource for jaxbsMarshaller. Reason :"+e);
}

Map<String, Object> properties = new HashMap<>();
properties.put(Marshaller.JAXB_FORMATTED_OUTPUT, true);

jaxb2Marshaller.setMarshallerProperties(properties);
return jaxb2Marshaller;
}

}


Following is my consumer schema file:



<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.admin.com/product"
xmlns:tns="http://www.example.org/product"
elementFormDefault="qualified">

<element name="product">
<complexType>
<sequence>
<element name="productName" type="string"></element>
</sequence>
<attribute name="productId" type="string" use="required"></attribute>
</complexType>
</element>
</schema>


Following is my application.properties



# ===============================
# = ACTIVEMQ & JMS
# ===============================
spring.activemq.broker-url=tcp://localhost:61616
outbound.endpoint=ORDER.PROCESSING.D
context.path=com.admin.product
schema.location=xsd/product.xsd


Following is my pom.xml :



<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-jms</artifactId>
<version>5.1.0.RELEASE</version>
</dependency>
<!-- These two dependency is for JMS messeging -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
</dependency>

<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
</dependency>

<dependency>
<groupId>com.admin</groupId>
<artifactId>admin1.5.7</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
</dependency>


Any suggestions on how to remove this error?



When I run my publisher spring boot app I see an error of resource not found which according to is uts not able to locate the schema file which is product.xsd.



Also I have added the consumers depeendency in my publishers pom.xml :



<dependency>
<groupId>com.admin</groupId>
<artifactId>admin1.5.7</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>









share|improve this question


























    up vote
    0
    down vote

    favorite












    Following is my JMSConfig.java



    @Configuration
    public class JMSConfig {

    private static final Logger logger = LoggerFactory.getLogger(JMSConfig.class);

    @Bean
    public MarshallingMessageConverter createMarshallingMessageConverter(final Jaxb2Marshaller jaxb2Marshaller) {
    return new MarshallingMessageConverter(jaxb2Marshaller);
    }

    @Bean
    public Jaxb2Marshaller createJaxb2Marshaller(@Value("${context.path}") final String contextPath,
    @Value("${schema.location}") final Resource schemaResource) {

    Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
    jaxb2Marshaller.setContextPath(contextPath);
    try {
    jaxb2Marshaller.setSchema(schemaResource);
    }catch(Exception e) {
    logger.error("Error occurred while getting xsd resource for jaxbsMarshaller. Reason :"+e);
    }

    Map<String, Object> properties = new HashMap<>();
    properties.put(Marshaller.JAXB_FORMATTED_OUTPUT, true);

    jaxb2Marshaller.setMarshallerProperties(properties);
    return jaxb2Marshaller;
    }

    }


    Following is my consumer schema file:



    <?xml version="1.0" encoding="UTF-8"?>
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.admin.com/product"
    xmlns:tns="http://www.example.org/product"
    elementFormDefault="qualified">

    <element name="product">
    <complexType>
    <sequence>
    <element name="productName" type="string"></element>
    </sequence>
    <attribute name="productId" type="string" use="required"></attribute>
    </complexType>
    </element>
    </schema>


    Following is my application.properties



    # ===============================
    # = ACTIVEMQ & JMS
    # ===============================
    spring.activemq.broker-url=tcp://localhost:61616
    outbound.endpoint=ORDER.PROCESSING.D
    context.path=com.admin.product
    schema.location=xsd/product.xsd


    Following is my pom.xml :



    <dependency>
    <groupId>org.springframework.integration</groupId>
    <artifactId>spring-integration-jms</artifactId>
    <version>5.1.0.RELEASE</version>
    </dependency>
    <!-- These two dependency is for JMS messeging -->
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-activemq</artifactId>
    </dependency>

    <dependency>
    <groupId>org.apache.activemq</groupId>
    <artifactId>activemq-broker</artifactId>
    </dependency>

    <dependency>
    <groupId>com.admin</groupId>
    <artifactId>admin1.5.7</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    </dependency>
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-oxm</artifactId>
    </dependency>


    Any suggestions on how to remove this error?



    When I run my publisher spring boot app I see an error of resource not found which according to is uts not able to locate the schema file which is product.xsd.



    Also I have added the consumers depeendency in my publishers pom.xml :



    <dependency>
    <groupId>com.admin</groupId>
    <artifactId>admin1.5.7</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    </dependency>









    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Following is my JMSConfig.java



      @Configuration
      public class JMSConfig {

      private static final Logger logger = LoggerFactory.getLogger(JMSConfig.class);

      @Bean
      public MarshallingMessageConverter createMarshallingMessageConverter(final Jaxb2Marshaller jaxb2Marshaller) {
      return new MarshallingMessageConverter(jaxb2Marshaller);
      }

      @Bean
      public Jaxb2Marshaller createJaxb2Marshaller(@Value("${context.path}") final String contextPath,
      @Value("${schema.location}") final Resource schemaResource) {

      Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
      jaxb2Marshaller.setContextPath(contextPath);
      try {
      jaxb2Marshaller.setSchema(schemaResource);
      }catch(Exception e) {
      logger.error("Error occurred while getting xsd resource for jaxbsMarshaller. Reason :"+e);
      }

      Map<String, Object> properties = new HashMap<>();
      properties.put(Marshaller.JAXB_FORMATTED_OUTPUT, true);

      jaxb2Marshaller.setMarshallerProperties(properties);
      return jaxb2Marshaller;
      }

      }


      Following is my consumer schema file:



      <?xml version="1.0" encoding="UTF-8"?>
      <schema xmlns="http://www.w3.org/2001/XMLSchema"
      targetNamespace="http://www.admin.com/product"
      xmlns:tns="http://www.example.org/product"
      elementFormDefault="qualified">

      <element name="product">
      <complexType>
      <sequence>
      <element name="productName" type="string"></element>
      </sequence>
      <attribute name="productId" type="string" use="required"></attribute>
      </complexType>
      </element>
      </schema>


      Following is my application.properties



      # ===============================
      # = ACTIVEMQ & JMS
      # ===============================
      spring.activemq.broker-url=tcp://localhost:61616
      outbound.endpoint=ORDER.PROCESSING.D
      context.path=com.admin.product
      schema.location=xsd/product.xsd


      Following is my pom.xml :



      <dependency>
      <groupId>org.springframework.integration</groupId>
      <artifactId>spring-integration-jms</artifactId>
      <version>5.1.0.RELEASE</version>
      </dependency>
      <!-- These two dependency is for JMS messeging -->
      <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-activemq</artifactId>
      </dependency>

      <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>activemq-broker</artifactId>
      </dependency>

      <dependency>
      <groupId>com.admin</groupId>
      <artifactId>admin1.5.7</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      </dependency>
      <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-oxm</artifactId>
      </dependency>


      Any suggestions on how to remove this error?



      When I run my publisher spring boot app I see an error of resource not found which according to is uts not able to locate the schema file which is product.xsd.



      Also I have added the consumers depeendency in my publishers pom.xml :



      <dependency>
      <groupId>com.admin</groupId>
      <artifactId>admin1.5.7</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      </dependency>









      share|improve this question













      Following is my JMSConfig.java



      @Configuration
      public class JMSConfig {

      private static final Logger logger = LoggerFactory.getLogger(JMSConfig.class);

      @Bean
      public MarshallingMessageConverter createMarshallingMessageConverter(final Jaxb2Marshaller jaxb2Marshaller) {
      return new MarshallingMessageConverter(jaxb2Marshaller);
      }

      @Bean
      public Jaxb2Marshaller createJaxb2Marshaller(@Value("${context.path}") final String contextPath,
      @Value("${schema.location}") final Resource schemaResource) {

      Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
      jaxb2Marshaller.setContextPath(contextPath);
      try {
      jaxb2Marshaller.setSchema(schemaResource);
      }catch(Exception e) {
      logger.error("Error occurred while getting xsd resource for jaxbsMarshaller. Reason :"+e);
      }

      Map<String, Object> properties = new HashMap<>();
      properties.put(Marshaller.JAXB_FORMATTED_OUTPUT, true);

      jaxb2Marshaller.setMarshallerProperties(properties);
      return jaxb2Marshaller;
      }

      }


      Following is my consumer schema file:



      <?xml version="1.0" encoding="UTF-8"?>
      <schema xmlns="http://www.w3.org/2001/XMLSchema"
      targetNamespace="http://www.admin.com/product"
      xmlns:tns="http://www.example.org/product"
      elementFormDefault="qualified">

      <element name="product">
      <complexType>
      <sequence>
      <element name="productName" type="string"></element>
      </sequence>
      <attribute name="productId" type="string" use="required"></attribute>
      </complexType>
      </element>
      </schema>


      Following is my application.properties



      # ===============================
      # = ACTIVEMQ & JMS
      # ===============================
      spring.activemq.broker-url=tcp://localhost:61616
      outbound.endpoint=ORDER.PROCESSING.D
      context.path=com.admin.product
      schema.location=xsd/product.xsd


      Following is my pom.xml :



      <dependency>
      <groupId>org.springframework.integration</groupId>
      <artifactId>spring-integration-jms</artifactId>
      <version>5.1.0.RELEASE</version>
      </dependency>
      <!-- These two dependency is for JMS messeging -->
      <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-activemq</artifactId>
      </dependency>

      <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>activemq-broker</artifactId>
      </dependency>

      <dependency>
      <groupId>com.admin</groupId>
      <artifactId>admin1.5.7</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      </dependency>
      <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-oxm</artifactId>
      </dependency>


      Any suggestions on how to remove this error?



      When I run my publisher spring boot app I see an error of resource not found which according to is uts not able to locate the schema file which is product.xsd.



      Also I have added the consumers depeendency in my publishers pom.xml :



      <dependency>
      <groupId>com.admin</groupId>
      <artifactId>admin1.5.7</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      </dependency>






      java spring spring-boot jms activemq






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 11 at 7:21









      Varun Singh

      247




      247





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53246662%2fspring-boot-activemq-jms-shows-resource-does-not-exist-servletcontext-resource%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53246662%2fspring-boot-activemq-jms-shows-resource-does-not-exist-servletcontext-resource%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Florida Star v. B. J. F.

          Danny Elfman

          Lugert, Oklahoma