Try Playground
Show / Hide Table of Contents

Deploying Applications for Java Sessions

Assuming your cache server IP is 20.200.20.40, the client.ncconf file should look as follows:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<cache-server retry-interval="1" connection-retries="5" local-server-ip=" " port="9800" connection-timeout="5" client-request-timeout="90" retry-connection-delays="0"/>
<cache id="demoCache" default-readthru-provider=" " client-cache-id=" " load-balance="true" default-writethru-provider=" " client-cache-syncmode="optimistic">
<server name="20.200.20.40"/>
</cache>
</configuration>

Please follow the steps mentioned below to deploy an application on the server.

Apache Tomcat

For Tomcat 9, use J2EE and add the following Maven <dependency> in the pom.xml file.

<dependency>
    <groupId>com.alachisoft.ncache</groupId>
    <artifactId>ncache-javax-sessions</artifactId>
    <version>x.x.x</version>
</dependency>

For Tomcat 10+, use Jakarta and add the following Maven <dependency> in the pom.xml file.

<dependency>
    <groupId>com.alachisoft.ncache</groupId>
    <artifactId>ncache-sessions</artifactId>
    <version>x.x.x</version>
</dependency>
Note

To use Maven packages for the NCache Professional, change the <artifactId>: <artifactId>ncache-professional-sessions</artifactId>

The steps remain the same but the location of the files might change depending upon the Tomcat version. %TOMCAT_HOME% refers to the location where Tomcat is installed.

  • Open the command prompt, and change the directory to %TOMCAT_HOME%/bin.

  • NCache uses log4j for logging. Place log4j at %TOMCAT_HOME%/lib.

  • Create a new text document with the following contents and save it with the name of log4j.properties in the %TOMCAT_HOME%/lib folder.

log4j.rootLogger=DEBUG, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=${catalina.home}/logs/tomcat.log
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
  • Open the command prompt, change the directory to %TOMCAT_HOME%/bin, and execute the startup.bat file. This will start the server.

  • Move the GuessGame.war file to the directory %TOMCAT_HOME%/webapps.

  • Open a web browser and try to access http://host:port/GuessGame/index.jsp, where the host will be the address/IP of the machine where Tomcat is installed (in the case of the local machine it should be localhost) and the port where Tomcat is listening to the request. The default port for Tomcat is 8080.

WildFly

%WILDFLY_HOME% refers to the location where WildFly is installed.

  1. NCache uses log4j for logging. WildFly by default uses log4j for logging so no need to move it.

  2. Deploy the GuessGame.war file, it must be copied into the correct directory so WildFly can find it. Then move the file to the directory %WILDFLY_HOME%/server/default/delpoy or you can also directly deploy from the WildFly admin console.

  3. Open a web browser and try to access http://host:port/GuessGame/index.jsp, where the host will be the address/IP of the machine where WildFly is installed (in case of the local machine it should be the localhost) and the port where WildFly is listening for the request. The default port for WildFly is 8080.

WebLogic

%WEBLOGIC_HOME% refers to the location where WebLogic is installed. %DOMAIN_NAME% is the already created domain on the server.

  1. NCache uses log4j for logging. Place the log4j at the following location: %WEBLOGIC_HOME%/user_projects/domains/%DOMAIN_NAME%/lib and restart the server.

  2. Move the GuessGame.war file to the directory %WEBLOGIC_HOME%/user_projects/domains/%DOMAIN_NAME%/autodeploy.

  3. Open a web browser and try to access http://host:port/GuessGame/index.jsp, where the host will be the address/IP of the machine where the WebLogic is installed (in case of the local machine it should be the localhost) and the port where the WebLogic is listening to the request. The default port for WebLogic is 7001.

WebSphere

%WEBSPHERE_HOME% refers to the location where the WebSphere is installed.

  1. NCache uses log4j for logging. Place the log4j at the following location and restart the server: %WEBSPHERE_HOME%/AppServer/lib/ext.

  2. If WebSphere is installed properly, you will be able to access the admin console through a browser with the help of http://ip-address:port/ibm/console/

  3. By default, 9060 is the port used by WAS. Make sure that you are using the correct port if you changed it during installation.

  4. You can go to Applications -> New Application -> New Enterprise Application.

  5. Specify the path of the GuessGame.war file and click Next. You can locate the GuessGame.war at the following location: %NC_HOME%/samples/sessions/dist.

  6. Select Fast Path installation mode and click Next.

  7. Specify the Application Name and Application Directory both as GuessGame and click Next.

  8. Map the application to the server, select GuessGame.war from the list with the default settings and click Next.

  9. Map the application to the virtual host, Select GuessGame.war from the list with the default settings, and click Next.

  10. Map the context root to the application, type 'GuessGame' into the textbox resulting in '/GuessGame' as the contents of the textbox and click Next.

  11. Click Finish to complete the deployment.

  12. Go to Applications -> Application Types -> WebSphere Enterprise Applications.

  13. You should see the GuessGame application in the list, select the GuessGame application by clicking on the checkbox.

  14. Click Start at the top left. You should see a green icon indicating that the application has started.

  15. Open a web browser and try to access http://host:port/GuessGame/index.jsp, where the host will be the address/IP of the machine where the WebSphere is installed (in case of the local machine it should be the localhost) and the port where the WebSphere is listening for the request. Make sure that you are using the correct port. The default port for WebSphere is 9080.

See Also

Adding Libraries
Multi-site Java Session Support
Error Logging

In This Article
  • Apache Tomcat
  • WildFly
  • WebLogic
  • WebSphere
  • See Also

Contact Us

PHONE

+1 (214) 764-6933   (US)

+44 20 7993 8327   (UK)

 
EMAIL

sales@alachisoft.com

support@alachisoft.com

NCache
  • NCache Enterprise
  • NCache Professional
  • Edition Comparison
  • NCache Architecture
  • Benchmarks
Download
Pricing
Try Playground

Deployments
  • Cloud (SaaS & Software)
  • On-Premises
  • Kubernetes
  • Docker
Technical Use Cases
  • ASP.NET Sessions
  • ASP.NET Core Sessions
  • Pub/Sub Messaging
  • Real-Time ASP.NET SignalR
  • Internet of Things (IoT)
  • NoSQL Database
  • Stream Processing
  • Microservices
Resources
  • Magazine Articles
  • Third-Party Articles
  • Articles
  • Videos
  • Whitepapers
  • Shows
  • Talks
  • Blogs
  • Docs
Customer Case Studies
  • Testimonials
  • Customers
Support
  • Schedule a Demo
  • Forum (Google Groups)
  • Tips
Company
  • Leadership
  • Partners
  • News
  • Events
  • Careers
Contact Us

  • EnglishChinese (Simplified)FrenchGermanItalianJapaneseKoreanPortugueseSpanish

  • Contact Us
  •  
  • Sitemap
  •  
  • Terms of Use
  •  
  • Privacy Policy
© Copyright Alachisoft 2002 - 2025. All rights reserved. NCache is a registered trademark of Diyatech Corp.
Back to top