Bug 1018197

Summary: deployment of jboss-servlet-security ruins the app
Product: OpenShift Online Reporter: Oleg Fayans <ofayans>
Component: ImageAssignee: Ben Parees <bparees>
Status: CLOSED NOTABUG QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 1.xCC: amarecek, bhatiam, bparees, chunchen, libra-bugs, ofayans, xtian
Target Milestone: ---Keywords: UpcomingRelease
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-15 17:37:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
jar file none

Description Oleg Fayans 2013-10-11 12:19:38 UTC
Created attachment 811036 [details]
jar file

Description of problem:
When I try to deploy jboss-servlet-security.war to jbossas-7 app, the app gets unavailable and app-restart does not help
Version-Release number of selected component (if applicable):

OpenShift build N 2.0.34


How reproducible:
Always

Steps to Reproduce:
1. git clone git:jboss-jdf/jboss-as-quickstart.git
2. cd jboss-as-quickstart/servlet-security
3. mvn build
4. rhc app create myapp jbossas-7
5. touch %app_home%/deployments/jboss-as-xml-dom4j.war.dodeploy
6. cp jboss-as-quickstart/servlet-security/target/jboss-servlet-security.war %app_home%/deployments/
7. git add. ; git commit -am "test" ; git push 

Actual results:
The app becomes unavailable

Expected results:
The app is available and you can access %app_url%/jboss-servlet-security



Additional info:

You need to have a working maven installation and jboss-eap-6.1.1.GA-maven-repository installed in your ~/.m2/ folder. If you don't have it, just use attached jboss-servlet-security.war file

Comment 1 Hiro Asari 2013-10-25 19:23:47 UTC
Is this supposed to work? Using the attached WAR file, I see this in server.log:

2013/10/25 14:23:05,775 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "jboss-servlet-security.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.web.deployment.default-host./jboss-servlet-security.realmjboss.security.security-domain.servlet-security-quickstartMissing[jboss.web.deployment.default-host./jboss-servlet-security.realmjboss.security.security-domain.servlet-security-quickstart]"]}

Comment 2 chunchen 2013-10-29 10:51:20 UTC
It can work before, but now it is also reproduced on devenv_3958.

I have tried to add jboss-as-xml-dom4j.war.dodeploy or jboss-servlet-security.war.dodeploy to %app_home%/deployments/ directory, all they can not work well for now.

Comment 3 Ben Parees 2014-01-09 23:37:49 UTC
you can't deploy this war by itself, it has dependencies on modifications to the jboss standalone.xml (adding a new security domain), as well as adding users to the jboss deployment.

did this work previously?

Comment 4 chunchen 2014-01-14 09:45:30 UTC
@Ben Parees, It can work previously since I created the related case about on August 2013, and tested it on that time, it work well.

Comment 5 Ben Parees 2014-01-14 14:39:15 UTC
@chunchen: can you provide me w/ the description of the related test case and any necessary artifacts?  I'd like to try that test case before revisiting what is described in comment 1.

Comment 6 chunchen 2014-01-15 03:20:38 UTC
@Ben Parees, my test case steps are similar with the bug's "Steps to Reproduce", and it does not need extra artifacts, as below:

1. Clone jbossas quickstarts  from github
git clone https://github.com/jboss-jdf/jboss-as-quickstart.git

2. Go to hibernate3 and mvn build
cd jboss-eap-quickstart/servlet-security
mvn package

3. Create a jbossas-7 app
rhc app create cas00 jbossas-7

4. Copy "jboss-servlet-security.war" to deployments/ dir

cd cas00
cp /path/to/jboss-as-quickstart/servlet-security/target/jboss-servlet-security.war  ./deployments/

5. Touch "$war_name.dodeploy" file in deployments/ dir
touch ./deployments/jboss-as-servlet-security.war.dodeploy

6. Git push the war package
git add .; git commit -amp; git push

7. Port forward this app and access http://127.0.0.1:8080/jboss-servlet-security

Comment 7 Ben Parees 2014-01-15 17:37:23 UTC
I'm not sure how these steps would have worked historically, since the quickstart readme makes it clear that you need to modify your JBoss install to:
1) add a new security domain
2) define the users  - Note that I did not actually need to do this second step to get the quickstart to work.

It looks like the quickstart was changed in october 2012 to use a custom security domain instead of "other" (which does exist in the default standalone.xml) so that is when I would have expected this test case to have broken...   not sure why it would have worked in august unless it was run using an old version of the quickstart files.


Following the readme and adapting the instructions for openshift, I was able to make this work.  The additional step needed, prior to pushing the war file, are:

1) edit .openshift/config/standalone.xml in the app repo to add the new domain described in the README.md:

 <security-domains>
                            <security-domain name="servlet-security-quickstart" cache-type="default">
              <authentication>
                    <login-module code="Database" flag="required">
                      <module-option name="dsJndiName" value="java:jboss/datasources/ServletSecurityDS"/>
                    <module-option name="principalsQuery" value="SELECT PASSWORD
 FROM USERS WHERE USERNAME = ?"/>
                    <module-option name="rolesQuery" value="SELECT R.NAME, 'Roles' FROM USERS_ROLES UR INNER JOIN ROLES R ON R.ID = UR.ROLE_ID INNER JOIN USERS U ON U.ID = UR.USER_ID WHERE U.USERNAME = ?"/>
                </login-module>
            </authentication>
        </security-domain>


3) in your app repo, push the new standalone.xml and war file:
  git commit -am . ; git push 

The quickstart will now work as expected.