Configured jetty server in mule esb

2019-09-16 17:19发布

问题:

I want to Configured embedded jetty server in mule esb.

I have tried many thing but unable to get success. Please give me step how to configured.

I want to make webinf folder in which I can host servlet file and jsp file. I have seen online book example, but It is not working in my mulestudio.

I am getting folder structure error. I have also tried to search but didn't get any working example.

回答1:

In mule-config.xml add the fillowing :-

 <?xml version="1.0" encoding="UTF-8"?>
    <mule xmlns="http://www.mulesoft.org/schema/mule/core"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:jetty="http://www.mulesoft.org/schema/mule/jetty"
          xsi:schemaLocation="
            http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
            http://www.mulesoft.org/schema/mule/jetty http://www.mulesoft.org/schema/mule/jetty/current/mule-jetty.xsd">

        <jetty:connector name="jettyConnector">
            <jetty:webapps directory="${app.home}/webapps" port="8083"/>
        </jetty:connector>

    </mule>

create a webapps folder in src/main/app folder of your project where you have WEB-INF and HTML/JSP files same as you have in other server



回答2:

Adding a complete SSL example. It's been quite a while since the question was asked, but I hope this will help someone.

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" 
    xmlns:jetty="http://www.mulesoft.org/schema/mule/jetty" 
    xmlns:jetty-ssl="http://www.mulesoft.org/schema/mule/jetty-ssl" 
    xmlns:context="http://www.springframework.org/schema/context"
    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.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
    http://www.mulesoft.org/schema/mule/jetty-ssl http://www.mulesoft.org/schema/mule/jetty-ssl/current/mule-jetty-ssl.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-current.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
    http://www.mulesoft.org/schema/mule/jetty http://www.mulesoft.org/schema/mule/jetty/current/mule-jetty.xsd
    http://www.mulesoft.org/schema/mule/jetty-ssl http://www.mulesoft.org/schema/mule/jetty/current/mule-jetty-ssl.xsd">

    <context:property-placeholder location="${mule.env}.properties" />

    <jetty-ssl:connector name="jettySslConnector" doc:name="Jetty">
        <jetty-ssl:tls-key-store   
            path="${ssl.keystore.path}" 
            keyAlias="${ssl.keystore.alias}" 
            storePassword="${ssl.keystore.keypassword}" 
            keyPassword="${ssl.keystore.keypassword}" 
            type="jks" />
        <jetty-ssl:webapps 
            directory="${app.home}/webapps" 
            port="${https.port}" />
    </jetty-ssl:connector>

</mule>