How to run Rampart Samples with Apache Tomcat

This explains how to setup and run standard Apache Rampart samples in an Axis2 instance hosted in Apache Rampart.

Date: Sun, 28th Sep, 2008
Level: Introductory
Reads: 10168 Comments: 5 | Login or register to post comments
Ruchith Fernando
Software Engineer
WSO2 Inc.

Applies To

  • Apache Rampart - 1.4
  • Apache Axis2 - 1.4.1

http://ws.apache.org/axis2/

http://ws.apache.org/rampart/

You need to have the following to try this:

- Apache Axis2 Standard Binary Distribution (Version 1.4.1) - Apache Axis2 WAR (Web Archive) Distribution (Version 1.4.1) - Apache Rampart Standard Binary Distribution (Version 1.4) - Apache Tomcat - Apache Ant - Make sure you have patched your JRE with Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files.

The policy/sample03 of Apache Rampart samples will be used to demonstrate this. You can use the same steps to deploy and run other samples as well.

Step 1:

Extract Apache Axis2 war distribution and copy axis2.war into the "webapps" directory of Apache Tomcat.

Stop Apache Tomcat.

Step 2:

Extract Apache Axis2 Standard binary distribution and Apache Rampart standard binary distribution and,

- Download and copy bcprov-jdk**-140.jar from bouncycastle.org to <extracted-rampart-dist>/lib/ - Set AXIS2_HOME environment variable to the extracted Apache Axis2 Standard binary distribution directory. - Run 'ant' from the samples directory to copy all required jars into the <extracted-rampart-dist>/lib to setup classpath to run the clients. - Update the addressing.mar property of build.xml file of samples/policy to : - To build the service archive, change directory to <extracted-rampart-dist>/samples/policy/ and do $ 'ant service.03'

This will start the simple axis2 server, you can simply stop it using Ctrl+C. If you have Apache Tomcat started at this point there might be a conflict of ports when axis2 server is trying to start!

Step 3:

Now we have the client and the service ready! Lets move the secured service to the Axis2 instance in Tomcat.

- Make sure Tomcat not running - Copy all jar files in <extracted-rampart-dist>/lib/ directory to <tomcat>/webapps/axis2/WEB-INF/lib/ - Copy rampart-1.4.mar to <tomcat>/webapps/axis2/WEB-INF/modules/ - Copy <extracted-rampart-dist>/samples/policy/build/service_repositories/sample03/services/sample03.aar into <tomcat>/webapps/axis2/WEB-INF/services/ - Note that the required keys are packed with the service archive. - Start Apache Tomcat! - If you are running tomcat on port 8080 you should be able to point your browser to http://localhost:8080/axis2/services/listServices and verify that the secured service is successfully hosted!

Step 4: Running the client

- Simply change directory to "<extracted-rampart-dist>/samples/policy/" and do $ ant client.03

Author:

Ruchith Fernando, ruchithf AT apache.org
joset783.yahoo.com's picture

The rampart module is not valid or has not been deployed error.

Hello Ruchith, I tried the sample3 in this tutorial but got the following error while testing it out. I have followed all necessary steps to configure Rampart but still have this error. Please, what might be likely wrong or what am I doing wrong. Thank you. The error stack: Error: org.apache.axis2.deployment.DeploymentException: The rampart module is not valid or has not been deployed. at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:150) at org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:81) at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136) at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:659) at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144) at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:337) at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:241) at org.apache.axis2.deployment.RepositoryListener.startListener(RepositoryListener.java:331) at org.apache.axis2.deployment.scheduler.SchedulerTask.checkRepository(SchedulerTask.java:64) at org.apache.axis2.deployment.scheduler.SchedulerTask.run(SchedulerTask.java:71) at org.apache.axis2.deployment.scheduler.Scheduler$SchedulerTimerTask.run(Scheduler.java:90) at java.util.TimerThread.mainLoop(Unknown Source) at java.util.TimerThread.run(Unknown Source) Caused by: org.apache.axis2.deployment.DeploymentException: The rampart module is not valid or has not been deployed. at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:431) at org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:101) at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:143) ... 12 more Caused by: org.apache.axis2.deployment.DeploymentException: The rampart module is not valid or has not been deployed. at org.apache.axis2.deployment.ServiceBuilder.processModuleRefs(ServiceBuilder.java:678) at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:327) ... 14 more Caused by: org.apache.axis2.deployment.DeploymentException: The rampart module is not valid or has not been deployed. at org.apache.axis2.deployment.ServiceBuilder.processModuleRefs(ServiceBuilder.java:670) ... 15 more
joset783.yahoo.com's picture

Hello, In addition, as part

Hello, In addition, as part of efforts to resolve this problem I added to conf/axis2.xml to engage the Rampart module but got "Internal Server" error afterward. Please, I will appreciate any help you could offer to solve this lingering problem as soon as possible. Thank you.
cgchavero.yahoo.com's picture

Maybe this help... works for me.

In Step 1 the axis2.war file is required but if ypu dont have it tou must buil from binary distribution. In the Apache Axis2 home page this is the instruction for build the war file: "Run the Ant build by executing "ant create.war" inside the AXIS2_HOME/webapps folder" So, there are "an inconsistency" in this proces, so read this: http://markmail.org/message/2b2ngk5pzcoxpzwv?q=list:org.apache.ws.rampart-dev+ModulePolicyExtension#query:list%3Aorg.apache.ws.rampart-dev%20ModulePolicyExtension+page:1+mid:epf7kyw4gfno2lst+state:results I download axis2-codegen-1.4.jar from here: http://www.java2s.com/Code/Jar/ABC/Downloadaxis2codegen14jar.htm And copy the file in: myjavadevdir\java\rampartejemplos\tomcat-5.5.25\webapps\axis2\WEB-INF\lib It Works!!! Cya!
vinfang's picture

Question on Step 2 updating addressing.mar

On the update the addressing.mar part, what value do we update it to? It's just a blank after the colon in your instructions.
pdegregorio's picture

It should be addressing-1.41.mar

As in <property name="addressing.mar" value="addressing-1.41.mar"/> Hope this helps. Peter