[JBoss AS 7 Development] - CLI deployment archive
by Alexey Loubyansky
Alexey Loubyansky [https://community.jboss.org/people/aloubyansky] created the document:
"CLI deployment archive"
To view the document, visit: https://community.jboss.org/docs/DOC-18945
--------------------------------------------------------------
Sometimes installing an application and setting up an environment for it may consist of deploying multiple application archives and modifying server configurations (adding new services, adjusting some settings, etc). Doing all this by hand every time you need to deploy and undeploy the application could be a tedious task. One thing that could help here is https://community.jboss.org/docs/DOC-16728 batches. Another one, which was introduced specifically to make it easier to install/uninstall complex applications, is CLI deployment archive.
A CLI deployment archive is a JAR file with *.cli* extension containing application archives that should be deployed and CLI script files containing commands and operations: one script file contains commands and operations that deploy the application archives and set up the environment and the other one undeploys the application archives and cleans up the environment.
Let's look at a simple example. Suppose, we have a simple CLI archive with three WAR files and two scripts
[xxx@xxx xxx]$ jar -tf test.cli
deployment0.war
deployment1.war
deployment2.war
deploy.scr
undeploy.scr
deploy.scr:
deploy deployment0.war
deploy deployment1.war
deploy deployment2.war
undeploy.scr:
undeploy deployment0.war
undeploy deployment1.war
undeploy deployment2.war
This archive can be deployed with a simple deploy command
[standalone@localhost:9999 /] deploy test.cli
#1 deploy deployment0.war
#2 deploy deployment1.war
#3 deploy deployment2.war
[standalone@localhost:9999 /]
By default, the deploy command handler will look for the +deploy.scr+ script file in the archive, so unless the script is named differently, there is no need to specify the script name.
Undeploying is easy as well
[standalone@localhost:9999 /] undeploy --path=test.cli
#1 undeploy deployment0.war
#2 undeploy deployment1.war
#3 undeploy deployment2.war
[standalone@localhost:9999 /]
Note, that you should specify the path to the archive as a value of the +--path+ argument of the +undeploy+ command. If you try +undeploy test.cli+ it will try looking for +test.cli+ among the registered deployed application archives and will fail. Only +deployment0.war+, +deployment1.war+ and +deployment2.war+ will be registered deployments. Argument-wise, it's a little inconsistent with the +deploy+ command but, although, +deploy test.cli+ is a shortcut for
[standalone@localhost:9999 /] deploy --path=test.cli
#1 deploy deployment0.war
#2 deploy deployment1.war
#3 deploy deployment2.war
[standalone@localhost:9999 /]
In this complete form, this scenario is consistent, i.e. you use +--path+ for both +deploy+ and +undeploy+ commands.
As with the +deploy+, +undeploy+ will look for the +undeploy.scr+ in the CLI arhive to uninstall the application and clean-up the environment. If your scripts are named differently (perhaps, you have different install/uninstall scripts in the same archive) you can use the +--script+ argument to specify which one you want to execute.
Let's add couple of alternative scripts to our archive.
[xxx@xxx xxx]$ jar -tf test.cli
deployment0.war
deployment1.war
deployment2.war
deploy.scr
undeploy.scr
install.scr
uninstall.scr
+install.scr+ deploys only two deployments out of three
deploy deployment0.war
deploy deployment1.war
And +uninstall.scr+ undeploys them
undeploy deployment0.war
undeploy deployment1.war
Now we can choose our non-default script to install
[standalone@localhost:9999 /] deploy --path=test.cli --script=install.scr
#1 deploy deployment0.war
#2 deploy deployment1.war
[standalone@localhost:9999 /]
and uninstall the applications
[standalone@localhost:9999 /] undeploy --path=test.cli --script=uninstall.scr
#1 undeploy deployment0.war
#2 undeploy deployment1.war
[standalone@localhost:9999 /]
--------------------------------------------------------------
Comment by going to Community
[https://community.jboss.org/docs/DOC-18945]
Create a new document in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&c...]
11 years, 10 months
Re: [jboss-dev-forums] [JBoss AS 7 Development] - JBoss AS7 Securing Passwords
by herb
herb [https://community.jboss.org/people/herb] commented on the document
"JBoss AS7 Securing Passwords"
To view all comments on this document, visit: https://community.jboss.org/docs/DOC-17248#comment-10306
--------------------------------------------------
The above code sample seams not to work with AS7.1.1.Final:
You've an import:
* import* org.jboss.as.server.services.security.VaultUtil;
but package org.jboss.as.server.services.security does not contain a class VaultUtil (found in modules/org/jboss/as/server/main/jboss-as-server-7.1.1.Final.jar).
There's a VaultTool.class in package org.jboss.as.security.vault (found in modules/org/jboss/as/security/main/jboss-as-security-7.1.1.Final.jar), but this class does not contain a getValueAsString() method?!
--------------------------------------------------
11 years, 10 months
[PicketBox Development] - JBoss AS7: Security : Custom Login Modules
by Ondrej Lukas
Ondrej Lukas [https://community.jboss.org/people/olukas] modified the document:
"JBoss AS7: Security : Custom Login Modules"
To view the document, visit: https://community.jboss.org/docs/DOC-17357
--------------------------------------------------------------
When you write your own custom login module (or Authorization Module or Audit Provider or Mapping Provider), then you have two choices as to where the class files exist in JBoss AS7.1
h2. Options
h2.
1. Package them as part of your EE archives (such as WEB-INF/classes or WEB-INF/lib)
2. Place in a separate module in the modules directory of JBoss AS 7.1
Option 1 is covered in https://community.jboss.org/docs/DOC-16811 http://community.jboss.org/wiki/JBossAS7SecurityDomainModel
Option 2 is described here with an example:
Assume we have a web application called form-auth.war which utilizes form authentication. It is attached to the article.
It uses a security domain form-auth that will be defined in standalone/configuration/standalone.xml as follows:
<security-domain name="form-auth" cache-type="default">
<authentication>
<login-module code="custom.MyLoginModule" flag="required" module="custom_module">
<module-option name="usersProperties" value="users.properties"/>
<module-option name="rolesProperties" value="roles.properties"/>
</login-module>
</authentication>
</security-domain>
In the example, we have a custom login module called "custom.MyLoginModule" which resides in a custom jboss module called as custom_module. The module attribute on the login-module xml element specifies where the login module code resides.
CLI: security-domain can be created as follows:
/subsystem=security/security-domain=form-auth:add
/subsystem=security/security-domain=form-auth/authentication=classic:add(login-modules=[{"code"=>"custom.MyLoginModule", "flag"=>"required", "module"=>"custom_module", "module-options"=>[("usersProperties"=>"users.properties"), ("rolesProperties"=>"roles.properties")]}])
Note: You will have to download the attached custom_module.zip and unzip it in the modules directory of AS7.1
jboss-as-7.1.0.Alpha2-SNAPSHOT/modules$ ls -la
drwxrwxr-x. 3 anil anil 4096 Nov 16 14:53 asm
drwxrwxr-x. 3 anil anil 4096 Nov 16 14:53 ch
drwxrwxr-x. 5 anil anil 4096 Nov 16 14:53 com
drwxrwxr-x. 3 anil anil 4096 Nov 16 14:57 custom_module
drwxrwxr-x. 3 anil anil 4096 Nov 16 14:53 gnu
drwxrwxr-x. 3 anil anil 4096 Nov 16 14:53 javaee
drwxrwxr-x. 25 anil anil 4096 Nov 16 14:54 javax
drwxrwxr-x. 3 anil anil 4096 Nov 16 14:53 jline
drwxrwxr-x. 3 anil anil 4096 Nov 16 14:53 juddi
drwxrwxr-x. 3 anil anil 4096 Nov 16 14:53 net
drwxrwxr-x. 23 anil anil 4096 Nov 16 14:54 org
drwxrwxr-x. 3 anil anil 4096 Nov 16 14:54 sun
If everything is ok, when you start AS7.1, then you should be able to access http://localhost:8080/form-auth/ http://localhost:8080/form-auth/
Username: anil
Password: anil
The source code for *+"custom.MyLoginModule"+* login module is packaged in the jar of custom_module.zip.
It is also given here:
package custom;
import javax.security.auth.login.LoginException;
import org.jboss.security.auth.spi.UsersRolesLoginModule;
public class MyLoginModule extends UsersRolesLoginModule {
public boolean login() throws LoginException
{
return super.login();
}
}
h2.
h2. Things to remember
* When you create your own module, *do not forget to add dependency on "org.picketbox" and "javax.api" in the module.xml of your custom module*.
h2.
h2. References
* https://issues.jboss.org/browse/AS7-2675 https://issues.jboss.org/browse/AS7-2675
--------------------------------------------------------------
Comment by going to Community
[https://community.jboss.org/docs/DOC-17357]
Create a new document in PicketBox Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&c...]
11 years, 10 months
[JBoss AS 7 Development] - How to change the database from h2database to oracle
by Roman Goeldi
Roman Goeldi [https://community.jboss.org/people/shakallaka] created the discussion
"How to change the database from h2database to oracle"
To view the discussion, visit: https://community.jboss.org/message/750420#750420
--------------------------------------------------------------
Hi,
I'm a student and I'm new to Java EE 6 and JBoss AS 7. In my holidays I work for a little company and have some issues with creating a new ear application. Unfortunately they work with another JBoss version in the company, and they aren't much experienced with it, so I have to get on with it for the most part by myself.
Ok, here is what I've got:
eclipse indigo, jboss tools, jboss as 7.1.0.Final
Here is what I want:
A Java EE 6 Application with JBoss AS 7 to access a oracle database, but the client side should be rich client (nothing with JSF)
I made my own Project with a new Java EE Project from JBoss Central and now want to change the database from h2database to oracle db
is this actually possible?
Or do I need something entire different?
can I delete the FinalBalanceStructure-web project or do I need that?
I first edited the datasource in myProject-ear/src/main/application/META-INF:
my datasource:
<?xml version="1.0" encoding="UTF-8"?>
<datasources xmlns="http://www.jboss.org/ironjacamar/schema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
<datasource jndi-name="java:jboss/datasources/FinalBalanceStructureDS"
pool-name="FinalBalanceStructure" enabled="true"
use-java-context="true">
<connection-url>jdbc:oracle:oci:@myTNSDatabaseName</connection-url>
<driver>oracle</driver>
<security>
<user-name>myUserName</user-name>
<password>myPassword</password>
</security>
</datasource>
</datasources>
then I created a new datasource in the administration window of the server and enabled it, so that the standalone.xml looks like:
.
.
.
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
.
.
.
<datasource jta="false" jndi-name="java:jboss/datasources/FinalBalanceStructureDS" pool-name="FinalBalanceStructure" enabled="true" use-ccm="false">
<connection-url>jdbc:oracle:oci:@myTNSDatabaseName</connection-url>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<driver>ojdbc6.jar</driver>
<security>
<user-name>myUserName</user-name>
<password>myPassword</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
<background-validation-millis>0</background-validation-millis>
</validation>
<statement>
<prepared-statement-cache-size>0</prepared-statement-cache-size>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
<xa-datasource...
.
.
.
</xa-datasource>
<drivers>
<driver name="oracle" module="com.oracle.db">
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
I also created module.xml and ojdbc6 in JBossHome\modules\com\oracle\db\main
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.oracle.db">
<resources>
<resource-root path="ojdbc6.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
I also added jboss-client-7.1.0.Final.jar to my ejb projects buildpath libraries
Now I tried to deploy it and get the following error:
> 11:59:50,778 INFO [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016005: Starting Services for CDI deployment: FinalBalanceStructure-ear.ear
> 11:59:50,809 INFO [org.jboss.weld.Version] (MSC service thread 1-2) WELD-000900 1.1.5 (AS71)
> 11:59:50,825 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."FinalBalanceStructure-ear.ear".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."FinalBalanceStructure-ear.ear".INSTALL: Failed to process phase INSTALL of deployment "FinalBalanceStructure-ear.ear"
> at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.0.Final.jar:7.1.0.Final]
> at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
> at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [rt.jar:1.6.0_33]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.6.0_33]
> at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_33]
> Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS010464: Exception deploying datasource java:jboss/datasources/FinalBalanceStructureDS
> at org.jboss.as.connector.deployers.processors.DsXmlDeploymentInstallProcessor.deploy(DsXmlDeploymentInstallProcessor.java:125)
> at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.0.Final.jar:7.1.0.Final]
> ... 5 more
> Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.naming.context.java.jboss.datasources.FinalBalanceStructureDS is already registered
> at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:154) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
> at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:227) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
> at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:560) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
> at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
> at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2228) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
> at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
> at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2228) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
> at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:307) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
> at org.jboss.as.connector.deployers.processors.DsXmlDeploymentInstallProcessor.startDataSource(DsXmlDeploymentInstallProcessor.java:309)
> at org.jboss.as.connector.deployers.processors.DsXmlDeploymentInstallProcessor.deploy(DsXmlDeploymentInstallProcessor.java:123)
> ... 6 more
>
> 11:59:51,075 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "FinalBalanceStructure-ear.ear" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"FinalBalanceStructure-ear.ear\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"FinalBalanceStructure-ear.ear\".INSTALL: Failed to process phase INSTALL of deployment \"FinalBalanceStructure-ear.ear\""},"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.comp.FinalBalanceStructure-ear.\"FinalBalanceStructure-ejb-0.0.1-SNAPSHOT\".MemberRegistration.Validatorjboss.naming.context.java.comp.FinalBalanceStructure-ear.\"FinalBalanceStructure-ejb-0.0.1-SNAPSHOT\".MemberRegistrationMissing[jboss.naming.context.java.comp.FinalBalanceStructure-ear.\"FinalBalanceStructure-ejb-0.0.1-SNAPSHOT\".MemberRegistration.Validatorjboss.naming.context.java.comp.FinalBalanceStructure-ear.\"FinalBalanceStructure-ejb-0.0.1-SNAPSHOT\".MemberRegistration]","jboss.naming.context.java.comp.FinalBalanceStructure-ear.\"FinalBalanceStructure-ejb-0.0.1-SNAPSHOT\".MemberRegistration.ValidatorFactoryjboss.naming.context.java.comp.FinalBalanceStructure-ear.\"FinalBalanceStructure-ejb-0.0.1-SNAPSHOT\".MemberRegistrationMissing[jboss.naming.context.java.comp.FinalBalanceStructure-ear.\"FinalBalanceStructure-ejb-0.0.1-SNAPSHOT\".MemberRegistration.ValidatorFactoryjboss.naming.context.java.comp.FinalBalanceStructure-ear.\"FinalBalanceStructure-ejb-0.0.1-SNAPSHOT\".MemberRegistration]"]}
Did I miss some configurations?
I tried to get a working ear project since 1 week and im getting really desperate.
Thanks for your help.
Roman
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/750420#750420]
Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 10 months