How to deploy an ADF application on Tomcat Server?

cancel
Showing results for 
Search instead for 
Did you mean: 
Active Member II

How to deploy an ADF application on Tomcat Server?

Jump to solution

Hello,

I've developed an ADF application and I'm trying to deploy it on a Tomcat Server (7.0.72 or 7.0.82) under port 3000.

These are the steps what I'm doing:

  1. Generate the application which will be deployed typing the command line "npm run build" which executes the defined script "build": "ng build --base-href /w/" declared in "package.json". After this execution, a folder called "w" has been generated.
  2. Open and check that the file "index.html" under "w" folder has the line <base href="/w/">
  3. Move the file "app.config.json" from "/w/assets/" to "/w/"
  4. Edit the file "app.config.json" setting the "ecmHost" value to "http://localhost:8080" (server where ACS is running)
  5. Copy the "w" folder to the Tomcat server. Concretely, to the folder "webapps"
  6. Add to the file "web.xml" (placed in "conf" folder in the Tomcat Server) the following filters:

<filter>
      <filter-name>CorsFilter</filter-name>
      <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
      <init-param>
            <param-name>cors.allowed.origins</param-name>
            <param-value>http://localhost:8080</param-value>
       </init-param>
       <init-param>
             <param-name>cors.allowed.methods</param-name>
             <param-value>GET,POST,PUT,DELETE,HEAD,OPTIONS</param-value>
       </init-param>
       <init-param>
             <param-name>cors.allowed.headers</param-name>
             <param-value>Access-Control-Allow-Origin,cache-control,Content-Type,X-Requested-  With,Accept,Authorization,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
       </init-param>
       <init-param>
             <param-name>cors.exposed.headers</param-name>
             <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
       </init-param>
       <init-param>
            <param-name>cors.support.credentials</param-name>
            <param-value>true</param-value>
       </init-param>
       <init-param>
            <param-name>cors.preflight.maxage</param-name>
            <param-value>10</param-value>
        </init-param>
</filter>
<filter-mapping>
        <filter-name>CorsFilter</filter-name>
         <url-pattern> /* </url-pattern>
</filter-mapping>

Start the server and the application is deployed. The problem is when I'm logging I'm getting the next error "Request has been terminated Possible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc."

However, when I start the angular cli server on my IDE by "npm start" (which start is "start": "ng serve --proxy-config proxy.conf.json") the application works fine.

Do you know where could the problem be?

Thank you!

1 Solution

Accepted Solutions
Active Member II

Re: How to deploy an ADF application on Tomcat Server?

Jump to solution

Hi Yogesh,

Using the last version of ADF and tomcat version (7.0.82) works well.

Regards,

Werner Nähle

View solution in original post

4 Replies
Member II

Re: How to deploy an ADF application on Tomcat Server?

Jump to solution

I am just starting with ADF. But, one of the requirements in documentaiton is configuring CORS (to allow javascript to make controlled cross-origin resource sharing:

https://community.alfresco.com/community/application-development-framework/blog/2017/06/20/adf-cors-... 

Active Member II

Re: How to deploy an ADF application on Tomcat Server?

Jump to solution

Hi Kendall,

yes, I did too.

Thanks for your answer!

Established Member

Re: How to deploy an ADF application on Tomcat Server?

Jump to solution

Hi Werner,

Did you ever resolve this issue ? We are facing the same issue.


Thanks,

Yogesh prjapati

Active Member II

Re: How to deploy an ADF application on Tomcat Server?

Jump to solution

Hi Yogesh,

Using the last version of ADF and tomcat version (7.0.82) works well.

Regards,

Werner Nähle

View solution in original post