Including mule in a dynamic web project with Tomcat

View: New views
7 Messages — Rating Filter:   Alert me  

Including mule in a dynamic web project with Tomcat

by Gerwin Postma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I am relatively new to mule.
I want to include mule in a dynamic web project, which I created in Eclipse and runs with tomcat.

The application gets data from a web serivce, which I want to transform with mule.
I created some jsp-pages and java classes to implement the logic,
to get the data from the web service.

My problem is, when I want to include mule in my index.jsp, I get the following error from tomcat.

*The requested resource () is not available.*

Here are some parts of my index.jsp and web.xml (in WEB-INF)

index.jsp (for example I want to send the data to an external .txt file)
*<%@ page import="org.mule.module.client.*" %>*
*MuleClient client = new MuleClient();*
*MuleMessage message = client.send("http://localhost:8080/index.jsp", data, null);*

web.xml
*<context-param>*
*<param-name>org.mule.config</param-name>*
*<param-value>/WEB-INF/my-config.xml</param-value>*
*</context-param>*
*<listener>*
*<listener-class>org.mule.config.builders.MuleXmlBuilderContextListener</listener-class>*
*</listener>*

I hope you can help me or describe, what I am making wrong. :)

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Including mule in a dynamic web project with Tomcat

by Dirk Olmes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> The application gets data from a web serivce, which I want to
> transform with mule. I created some jsp-pages and java classes to
> implement the logic, to get the data from the web service.
[...]
> index.jsp (for example I want to send the data to an external .txt
> file) *<%@ page import="org.mule.module.client.*" %>*
> *MuleClient client = new MuleClient();* *MuleMessage message =
> client.send("http://localhost:8080/index.jsp", data, null);*

If I understand your description above correctly, you want to talk to
Mule from within your JSP. But your MuleClient use talks to your JSP
again ... confusing.

Can you show your Mule config?

> web.xml *<context-param>*
> *<param-name>org.mule.config</param-name>*
> *<param-value>/WEB-INF/my-config.xml</param-value>*
> *</context-param>* *<listener>*
> *<listener-class>org.mule.config.builders.MuleXmlBuilderContextListener</listener-class>*
>  *</listener>*

This looks correct.

-dirk

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Including mule in a dynamic web project with Tomcat

by Gerwin Postma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

HI,

thanks for your answer, the link in your post is broken.

I read this section: http://www.mulesoft.org/display/MULE2USER/Embedding+Mule+in+a+Java+Application+or+Webapp
for this reason, i added the code lines, you quoted, to my index.jsp.

Here is my simple config file:

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns:spring="http://www.springframework.org/schema/beans"
                xmlns:http="http://www.mulesource.org/schema/mule/http/2.2"
                xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.2"
                xmlns:file="http://mulesource.org/schema/mule/file/2.2"
                xsi:schemaLocation="
                                http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                                http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
                                http://www.mulesource.org/schema/mule/http/2.2 http://www.mulesource.org/schema/mule/http/2.2/mule-http.xsd
                                http://www.mulesource.org/schema/mule/stdio/2.2 http://www.mulesource.org/schema/mule/stdio/2.2/mule-stdio.xsd
                                http://www.mulesource.org/schema/mule/file/2.2 http://www.mulesource.org/schema/mule/stdio/2.2/mule-file.xsd" >

        <custom-transformer name="HttpRequestToCity" class="HttpRequestToCity" />
        <custom-transformer name="CityToString" class="CityToString" />
        <custom-transformer name="StringToFile" class="StringToFile" />
       
        <model>
                <service name="ProjectOutput">
                        <inbound>
                                <inbound-endpoint address="http://localhost:8080/Project/index.jsp" transformer-refs="HttpRequestToCity" />
                        </inbound>
                        <outbound>
                                <pass-through-router>
                                        <stdio:outbound-endpoint system="OUT" transformer-refs="CityToString StringToFile" />
                                </pass-through-router>
                        </outbound>
                </service>
        </model>
</mule>

At the moment, the data from the web service will be send with the "GET" method to the enpoint address and written to a .txt file.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Including mule in a dynamic web project with Tomcat

by Dirk Olmes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thomas Phillips wrote:
> HI,
>
> thanks for your answer, the link in your post is broken.
>
> I read this section:
> http://www.mulesoft.org/display/MULE2USER/Embedding+Mule+in+a+Java+Application+or+Webapp
>  for this reason, i added the code lines, you quoted, to my
> index.jsp.

Looking at your config and reading your original post again I'm even
more confused now. What exactly are you trying to do? What's the role of
index.jsp? Is it some code of yours? Is it triggered by a form
submission? If so, then the use of MuleClient makes sense.

Then again, looking at your config, I see that you set up an inbound
HTTP endpoint. Do you want to POST your data there?

-dirk

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Including mule in a dynamic web project with Tomcat

by Gerwin Postma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have a http-form in my index.jsp with a select option,
where the data from the web service is listed.
When I submit the form, the data should be send to the inbound endpoint
and then be saved with mule to an text file.

My main problem is to include mule correctly to my project and tomcat.

In my mule config I also get the following error:
*Referrenced file contains errors (http://www.mulesource.org/schema/mule/core/2.2/mule.xsd)*

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Including mule in a dynamic web project with Tomcat

by Gerwin Postma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

finally I solved my problem and now mule is fully integrated in my web application.
But now, I have another issue.

I read through the part of Mule Client in the documentation,

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Including mule in a dynamic web project with Tomcat

by Gerwin Postma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Thomas,
would you share with me how did you solved your problem? I have the same error.

Thanks
ciao
Davide.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email