Component Exception












1















I am attempting a tutorial from the book 'MULE_ESB_COOKBOOK' by packt publishing and I have posted this question in another forum too. In the first chapter, there is a 'Deploying your first Hello World application on the Mule server' exercise which I am trying out. The expected output is Hello/(The value I enter as part of the url)



However when I run the application, I am getting the following error in the browser when I enter this: http://localhost:9081. The error message is as follow: "Component that caused exception is: DefaultJavaComponent{helloworldFlow.component.1468192631}. Message payload is of type: NullPayload"



The XML file is as follow:



 <?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="9081" doc:name="HTTP Listener Configuration"/>
<flow name="helloworldFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<component class="com.org.Greeting" doc:name="Java"/>
</flow>
</mule>


The Greeting.java file is as follows:



package com.org;

public class Greeting {

public String sayHi(String str)
{
return "Hello " +str;
}

}


I am not sure why I am getting this error. Hope someone can help, thanks.










share|improve this question

























  • I'd ask for more of the tutorial, but it's dangerous posting published material on SO. This book is also from 2013, so I'm curious as to which AnypointStudio and Mule Runtime you're using.

    – utechtzs
    Nov 21 '18 at 19:07


















1















I am attempting a tutorial from the book 'MULE_ESB_COOKBOOK' by packt publishing and I have posted this question in another forum too. In the first chapter, there is a 'Deploying your first Hello World application on the Mule server' exercise which I am trying out. The expected output is Hello/(The value I enter as part of the url)



However when I run the application, I am getting the following error in the browser when I enter this: http://localhost:9081. The error message is as follow: "Component that caused exception is: DefaultJavaComponent{helloworldFlow.component.1468192631}. Message payload is of type: NullPayload"



The XML file is as follow:



 <?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="9081" doc:name="HTTP Listener Configuration"/>
<flow name="helloworldFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<component class="com.org.Greeting" doc:name="Java"/>
</flow>
</mule>


The Greeting.java file is as follows:



package com.org;

public class Greeting {

public String sayHi(String str)
{
return "Hello " +str;
}

}


I am not sure why I am getting this error. Hope someone can help, thanks.










share|improve this question

























  • I'd ask for more of the tutorial, but it's dangerous posting published material on SO. This book is also from 2013, so I'm curious as to which AnypointStudio and Mule Runtime you're using.

    – utechtzs
    Nov 21 '18 at 19:07
















1












1








1


1






I am attempting a tutorial from the book 'MULE_ESB_COOKBOOK' by packt publishing and I have posted this question in another forum too. In the first chapter, there is a 'Deploying your first Hello World application on the Mule server' exercise which I am trying out. The expected output is Hello/(The value I enter as part of the url)



However when I run the application, I am getting the following error in the browser when I enter this: http://localhost:9081. The error message is as follow: "Component that caused exception is: DefaultJavaComponent{helloworldFlow.component.1468192631}. Message payload is of type: NullPayload"



The XML file is as follow:



 <?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="9081" doc:name="HTTP Listener Configuration"/>
<flow name="helloworldFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<component class="com.org.Greeting" doc:name="Java"/>
</flow>
</mule>


The Greeting.java file is as follows:



package com.org;

public class Greeting {

public String sayHi(String str)
{
return "Hello " +str;
}

}


I am not sure why I am getting this error. Hope someone can help, thanks.










share|improve this question
















I am attempting a tutorial from the book 'MULE_ESB_COOKBOOK' by packt publishing and I have posted this question in another forum too. In the first chapter, there is a 'Deploying your first Hello World application on the Mule server' exercise which I am trying out. The expected output is Hello/(The value I enter as part of the url)



However when I run the application, I am getting the following error in the browser when I enter this: http://localhost:9081. The error message is as follow: "Component that caused exception is: DefaultJavaComponent{helloworldFlow.component.1468192631}. Message payload is of type: NullPayload"



The XML file is as follow:



 <?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="9081" doc:name="HTTP Listener Configuration"/>
<flow name="helloworldFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<component class="com.org.Greeting" doc:name="Java"/>
</flow>
</mule>


The Greeting.java file is as follows:



package com.org;

public class Greeting {

public String sayHi(String str)
{
return "Hello " +str;
}

}


I am not sure why I am getting this error. Hope someone can help, thanks.







java mule esb






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 19:42









utechtzs

30619




30619










asked Nov 21 '18 at 18:25









javapersonjavaperson

297




297













  • I'd ask for more of the tutorial, but it's dangerous posting published material on SO. This book is also from 2013, so I'm curious as to which AnypointStudio and Mule Runtime you're using.

    – utechtzs
    Nov 21 '18 at 19:07





















  • I'd ask for more of the tutorial, but it's dangerous posting published material on SO. This book is also from 2013, so I'm curious as to which AnypointStudio and Mule Runtime you're using.

    – utechtzs
    Nov 21 '18 at 19:07



















I'd ask for more of the tutorial, but it's dangerous posting published material on SO. This book is also from 2013, so I'm curious as to which AnypointStudio and Mule Runtime you're using.

– utechtzs
Nov 21 '18 at 19:07







I'd ask for more of the tutorial, but it's dangerous posting published material on SO. This book is also from 2013, so I'm curious as to which AnypointStudio and Mule Runtime you're using.

– utechtzs
Nov 21 '18 at 19:07














2 Answers
2






active

oldest

votes


















0














This is expected because you are not passing any input to your Java class.

Try setting some input using set-payload component before java class component:



 <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="9081" doc:name="HTTP Listener Configuration"/>
<flow name="helloworldFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<set-payload value="Anirban" doc:name="Set Payload"/>
<component class="com.org.Greeting" doc:name="Java"/>
</flow>





share|improve this answer































    0














    You Java class is wrong. To invoke a Java class in Mule 3.x it has to implement the Mule org.mule.api.lifecycle.Callable interface. See the example at https://docs.mulesoft.com/mule-runtime/3.9/java-component-reference#basic-hello-world-java-component-class



    I'm guessing the complete error in the log points to the correct issue.






    share|improve this answer
























    • That is not correct.. Why should he implement callable when mule 3.x can access the java method by setting the input payload? Yes there can be a issue in method resolver exception incase of multiple java method (can be resolved by method resolver in that case),but since it's only single method it will easily be picked and will display response. This is a valid java class. He can invoke this java class in different ways. The way he is doing now and adding input payload and also using spring beans with invoke component. He doesn't require callable interface.

      – Anirban Sen Chowdhary
      Nov 22 '18 at 11:48











    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',
    autoActivateHeartbeat: false,
    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%2f53418381%2fcomponent-exception%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    This is expected because you are not passing any input to your Java class.

    Try setting some input using set-payload component before java class component:



     <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="9081" doc:name="HTTP Listener Configuration"/>
    <flow name="helloworldFlow">
    <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
    <set-payload value="Anirban" doc:name="Set Payload"/>
    <component class="com.org.Greeting" doc:name="Java"/>
    </flow>





    share|improve this answer




























      0














      This is expected because you are not passing any input to your Java class.

      Try setting some input using set-payload component before java class component:



       <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="9081" doc:name="HTTP Listener Configuration"/>
      <flow name="helloworldFlow">
      <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
      <set-payload value="Anirban" doc:name="Set Payload"/>
      <component class="com.org.Greeting" doc:name="Java"/>
      </flow>





      share|improve this answer


























        0












        0








        0







        This is expected because you are not passing any input to your Java class.

        Try setting some input using set-payload component before java class component:



         <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="9081" doc:name="HTTP Listener Configuration"/>
        <flow name="helloworldFlow">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
        <set-payload value="Anirban" doc:name="Set Payload"/>
        <component class="com.org.Greeting" doc:name="Java"/>
        </flow>





        share|improve this answer













        This is expected because you are not passing any input to your Java class.

        Try setting some input using set-payload component before java class component:



         <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="9081" doc:name="HTTP Listener Configuration"/>
        <flow name="helloworldFlow">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
        <set-payload value="Anirban" doc:name="Set Payload"/>
        <component class="com.org.Greeting" doc:name="Java"/>
        </flow>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 21 '18 at 18:47









        Anirban Sen ChowdharyAnirban Sen Chowdhary

        6,24842867




        6,24842867

























            0














            You Java class is wrong. To invoke a Java class in Mule 3.x it has to implement the Mule org.mule.api.lifecycle.Callable interface. See the example at https://docs.mulesoft.com/mule-runtime/3.9/java-component-reference#basic-hello-world-java-component-class



            I'm guessing the complete error in the log points to the correct issue.






            share|improve this answer
























            • That is not correct.. Why should he implement callable when mule 3.x can access the java method by setting the input payload? Yes there can be a issue in method resolver exception incase of multiple java method (can be resolved by method resolver in that case),but since it's only single method it will easily be picked and will display response. This is a valid java class. He can invoke this java class in different ways. The way he is doing now and adding input payload and also using spring beans with invoke component. He doesn't require callable interface.

              – Anirban Sen Chowdhary
              Nov 22 '18 at 11:48
















            0














            You Java class is wrong. To invoke a Java class in Mule 3.x it has to implement the Mule org.mule.api.lifecycle.Callable interface. See the example at https://docs.mulesoft.com/mule-runtime/3.9/java-component-reference#basic-hello-world-java-component-class



            I'm guessing the complete error in the log points to the correct issue.






            share|improve this answer
























            • That is not correct.. Why should he implement callable when mule 3.x can access the java method by setting the input payload? Yes there can be a issue in method resolver exception incase of multiple java method (can be resolved by method resolver in that case),but since it's only single method it will easily be picked and will display response. This is a valid java class. He can invoke this java class in different ways. The way he is doing now and adding input payload and also using spring beans with invoke component. He doesn't require callable interface.

              – Anirban Sen Chowdhary
              Nov 22 '18 at 11:48














            0












            0








            0







            You Java class is wrong. To invoke a Java class in Mule 3.x it has to implement the Mule org.mule.api.lifecycle.Callable interface. See the example at https://docs.mulesoft.com/mule-runtime/3.9/java-component-reference#basic-hello-world-java-component-class



            I'm guessing the complete error in the log points to the correct issue.






            share|improve this answer













            You Java class is wrong. To invoke a Java class in Mule 3.x it has to implement the Mule org.mule.api.lifecycle.Callable interface. See the example at https://docs.mulesoft.com/mule-runtime/3.9/java-component-reference#basic-hello-world-java-component-class



            I'm guessing the complete error in the log points to the correct issue.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 22 '18 at 1:48









            Alejandro DobniewskiAlejandro Dobniewski

            885713




            885713













            • That is not correct.. Why should he implement callable when mule 3.x can access the java method by setting the input payload? Yes there can be a issue in method resolver exception incase of multiple java method (can be resolved by method resolver in that case),but since it's only single method it will easily be picked and will display response. This is a valid java class. He can invoke this java class in different ways. The way he is doing now and adding input payload and also using spring beans with invoke component. He doesn't require callable interface.

              – Anirban Sen Chowdhary
              Nov 22 '18 at 11:48



















            • That is not correct.. Why should he implement callable when mule 3.x can access the java method by setting the input payload? Yes there can be a issue in method resolver exception incase of multiple java method (can be resolved by method resolver in that case),but since it's only single method it will easily be picked and will display response. This is a valid java class. He can invoke this java class in different ways. The way he is doing now and adding input payload and also using spring beans with invoke component. He doesn't require callable interface.

              – Anirban Sen Chowdhary
              Nov 22 '18 at 11:48

















            That is not correct.. Why should he implement callable when mule 3.x can access the java method by setting the input payload? Yes there can be a issue in method resolver exception incase of multiple java method (can be resolved by method resolver in that case),but since it's only single method it will easily be picked and will display response. This is a valid java class. He can invoke this java class in different ways. The way he is doing now and adding input payload and also using spring beans with invoke component. He doesn't require callable interface.

            – Anirban Sen Chowdhary
            Nov 22 '18 at 11:48





            That is not correct.. Why should he implement callable when mule 3.x can access the java method by setting the input payload? Yes there can be a issue in method resolver exception incase of multiple java method (can be resolved by method resolver in that case),but since it's only single method it will easily be picked and will display response. This is a valid java class. He can invoke this java class in different ways. The way he is doing now and adding input payload and also using spring beans with invoke component. He doesn't require callable interface.

            – Anirban Sen Chowdhary
            Nov 22 '18 at 11:48


















            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53418381%2fcomponent-exception%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

            Costa Masnaga

            Fotorealismo

            Sidney Franklin