Simply follow these following steps- (You can change according to your need)

  1. Go to $JBOSS_HOME/server/default/conf
  2. Run this following command

  3. # keytool -genkey -alias tc-ssl -keyalg RSA -keystore server.keystore -validity 3650


    These following lines will come and you need to input the values beside [Unknown]

    Enter keystore password: xyz123
    What is your first and last name?
    [Unknown]: Something
    What is the name of your organizational unit?
    [Unknown]: Something
    What is the name of your organization?
    [Unknown]: http://www.Something.com
    What is the name of your City or Locality?
    [Unknown]: Kolkata
    What is the name of your State or Province?
    [Unknown]: WB
    What is the two-letter country code for this unit?
    [Unknown]: 91
    Is CN=Something, OU=Something, O=www.Something.com, L=Kolkata, ST=WB, C=91 correct?
    [no]: yes

    Enter key password for
    (RETURN if same as keystore password): xyz123

  4. Check whether the keystore is generated or not

  5. # ls -l
    total 344
    .
    .
    .
    -rw-r--r-- 1 root root 1394 2009-11-12 16:13 server.keystore
    .
    .

  6. Uncomment or add this following part in your $JBOSS_HOME/server/default/deploy/jboss-web.deployer/server.xml
  7. <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
                    maxThreads="150" scheme="https" secure="true"
                    clientAuth="false"
                    strategy="ms" address="${jboss.bind.address}"
                    keystoreFile="${jboss.server.home.dir}/conf/server.keystore"
                    keystorePass="xyz123"
                    truststoreFile="${jboss.server.home.dir}/conf/server.keystore"
                    truststorePass="xyz123"
                    sslProtocol="TLS"/>
    
    
    
    
  8. In your web application’s web.xml add the following lines
  9. <security-constraint>
         <web-resource-collection>
            <web-resource-name>Protected Area, so redirect to HTTPS</web-resource-name>
                <url-pattern>/*</url-pattern>
           </web-resource-collection>
           <user-data-constraint>
                <transport-guarantee>CONFIDENTIAL</transport-guarantee>
            </user-data-constraint>
    </security-constraint>