📄 ch13s78.html
字号:
<br>
validate:<br>
<br>
fail_if_not_valid:<br>
<br>
init:<br>
Using jboss.dist=/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss<br>
Using classpath=/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/client/ejb.jar:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/client/jaas.jar:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/client/jbosssx-client.jar:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/client/jboss-client.jar:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/client/jnp-client.jar:/tmp/JBoss-2.2.2_Tomcat-3.2.2/tomcat/lib/servlet.jar:/tmp/jaas/build/classes<br>
<br>
compile:<br>
[mkdir] Created dir: /tmp/jaas/build/classes<br>
[javac] Compiling 7 source files to /tmp/jaas/build/classes<br>
<br>
jar1:<br>
[mkdir] Created dir: /tmp/jaas/build/META-INF<br>
[copy] Copying 1 files to /tmp/jaas/build/META-INF<br>
[copy] Copying 1 files to /tmp/jaas/build/META-INF<br>
[jar] Building jar: /tmp/jaas/build/ssbean1.jar<br>
<br>
war1:<br>
[mkdir] Created dir: /tmp/jaas/build/WEB-INF/classes<br>
[copy] Copying 1 files to /tmp/jaas/build/WEB-INF<br>
[copy] Copying 1 files to /tmp/jaas/build/WEB-INF<br>
[copy] Copying 1 files to /tmp/jaas/build/WEB-INF/classes<br>
[jar] Building jar: /tmp/jaas/build/tutorial1.war<br>
<br>
ear1:<br>
[copy] Copying 1 files to /tmp/jaas/build/META-INF<br>
[jar] Building jar: /tmp/jaas/build/tutorial1.ear<br>
<br>
jar2:<br>
[delete] Deleting directory /tmp/jaas/build/META-INF<br>
[mkdir] Created dir: /tmp/jaas/build/META-INF<br>
[copy] Copying 1 files to /tmp/jaas/build/META-INF<br>
[copy] Copying 1 files to /tmp/jaas/build/META-INF<br>
[jar] Building jar: /tmp/jaas/build/ssbean2.jar<br>
<br>
war2:<br>
[delete] Deleting directory /tmp/jaas/build/WEB-INF<br>
[mkdir] Created dir: /tmp/jaas/build/WEB-INF/classes<br>
[copy] Copying 1 files to /tmp/jaas/build/WEB-INF<br>
[copy] Copying 1 files to /tmp/jaas/build/WEB-INF<br>
[copy] Copying 1 files to /tmp/jaas/build/WEB-INF/classes<br>
[jar] Building jar: /tmp/jaas/build/tutorial2.war<br>
<br>
ear2:<br>
[copy] Copying 1 files to /tmp/jaas/build/META-INF<br>
[jar] Building jar: /tmp/jaas/build/tutorial2.ear<br>
<br>
ears:<br>
[copy] Copying 1 files to /tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/deploy<br>
[copy] Copying 1 files to /tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/deploy<br>
[copy] Copying 1 files to /tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/conf/tomcat<br>
<br>
BUILD SUCCESSFUL<br>
<br>
Total time: 8 seconds</b><br>
</div>
</p><p>This has created two ears(tutorial1.ear, tutorial2.ear)
that contain the ejbs and servlet presented earlier and placed them into the
JBoss server deploy directory. It has also replaced the contents of the JBoss
server auth.conf file with the jaas/server_auth.conf file contents. This file
is the same as that show in <a href="ch13s78.html#server.auth.conf" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13s78.html#server.auth.conf" title="Figure 13.10. The JBoss Server JAAS Login Config File
 ($jboss_home/conf/default/auth.conf)">Figure 13.10</a>.</p></li></ol></li><li><a name="d0e11111"></a><p>Start the JBoss/Tomcat server. Go to the jboss/bin
directory of your JBoss/Tomcat bundle installation and execute the
run_with_tomcat.sh for *nix platforms and run_with_tomcat.bat for w32
platforms. A number of messages will be displayed on your console. Some of
the key messages you should see are:</p><div class="literallayout"> <br>
<b>bash-2.04$ run_with_tomcat.sh<br>
JBOSS_CLASSPATH=:/lib/tools.jar:run.jar:../lib/crimson.jar<br>
jboss.home = /tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss<br>
Using JAAS LoginConfig: file:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/conf/tomcat/auth.conf<br>
Using configuration "tomcat"<br>
...<br>
[EmbeddedTomcatSX] Starting<br>
[EmbeddedTomcatSX] Starting EmbeddedTomcatSX....<br>
2001-05-25 08:45:45 - ContextManager: Adding context Ctx( /examples )<br>
2001-05-25 08:45:45 - ContextManager: Adding context Ctx( /admin )<br>
[EmbeddedTomcatSX] Starting tomcat. Check logs/tomcat.log for error messages <br>
2001-05-25 08:45:46 - ContextManager: Adding context Ctx( )<br>
2001-05-25 08:45:47 - ContextManager: Adding context Ctx( /test )<br>
2001-05-25 08:45:49 - PoolTcpConnector: Starting HttpConnectionHandler on 8080<br>
[EmbeddedTomcatSX] OK<br>
[EmbeddedTomcatSX] Started<br>
...<br>
[J2EE Deployer Default] Deploy J2EE application: file:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/deploy/tutorial1.ear<br>
[J2EE Deployer Default] Create application tutorial1.ear<br>
[J2EE Deployer Default] inflate and install module tutorial1.war<br>
[J2EE Deployer Default] install module ssbean1.jar<br>
[J2EE Deployer Default] add all ejb jar files to the common classpath<br>
[Container factory] Deploying:file:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/tmp/deploy/Default/tutorial1.ear<br>
[Verifier] Verifying file:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/tmp/deploy/Default/tutorial1.ear/ejb1004.jar<br>
[Container factory] Deploying StatelessSession<br>
[Container factory] lookup securityManager name: java:/jaas/example1<br>
[Container factory] JAAS.Created securityMgr=org.jboss.security.plugins.JaasSecurityManager@114460<br>
[Container factory] JAAS.setCachePolicy, c=null<br>
[Container factory] JAAS.Added example1, org.jboss.security.plugins.JaasSecurityManager@114460 to map<br>
[Container factory] Deploying StatefulSession<br>
[Container factory] lookup securityManager name: java:/jaas/example1<br>
[Bean Cache] Cache policy scheduler started<br>
[Container factory] Deployed application: file:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/tmp/deploy/Default/tutorial1.ear<br>
[J2EE Deployer Default] Starting module tutorial1.war<br>
[Auto deploy] deploy, ctxPath=/jaas-example1, warUrl=file:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/tmp/deploy/Default/tutorial1.ear/web1003/<br>
2001-05-25 08:45:55 - ContextManager: Adding context Ctx( /jaas-example1 )<br>
[Auto deploy] AbstractWebContainer.parseWebAppDescriptors, Begin<br>
[Auto deploy] addEnvEntries<br>
[Auto deploy] linkResourceRefs<br>
[Auto deploy] linkEjbRefs<br>
[Auto deploy] Linking ejb-ref: ejb/SecuredEJB to JNDI name: example1/StatelessSession<br>
[Auto deploy] linkSecurityDomain<br>
[Auto deploy] Linking security/securityMgr to JNDI name: java:/jaas/example1<br>
[Auto deploy] AbstractWebContainer.parseWebAppDescriptors, End<br>
[Auto deploy] Initialized: {WebApplication: /tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/tmp/deploy/Default/tutorial1.ear/web1003/, URL: file:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/tmp/deploy/Default/tutorial1.ear/web1003/, classLoader: AdaptiveClassLoader( ):5909743}<br>
[J2EE Deployer Default] J2EE application: file:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/deploy/tutorial1.ear is deployed.<br>
[Auto deploy] Auto deploy of file:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/deploy/tutorial2.ear<br>
[J2EE Deployer Default] Deploy J2EE application: file:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/deploy/tutorial2.ear<br>
[J2EE Deployer Default] Create application tutorial2.ear<br>
[J2EE Deployer Default] inflate and install module tutorial2.war<br>
[J2EE Deployer Default] install module ssbean2.jar<br>
[J2EE Deployer Default] add all ejb jar files to the common classpath<br>
[Container factory] Deploying:file:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/tmp/deploy/Default/tutorial2.ear<br>
[Verifier] Verifying file:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/tmp/deploy/Default/tutorial2.ear/ejb1006.jar<br>
[Container factory] Deploying StatelessSession<br>
[Container factory] lookup securityManager name: java:/jaas/example2<br>
[Container factory] JAAS.Created securityMgr=org.jboss.security.plugins.JaasSecurityManager@3ac93e<br>
[Container factory] JAAS.setCachePolicy, c=null<br>
[Container factory] JAAS.Added example2, org.jboss.security.plugins.JaasSecurityManager@3ac93e to map<br>
[Container factory] Deploying StatefulSession<br>
[Container factory] lookup securityManager name: java:/jaas/example2<br>
[Container factory] Deployed application: file:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/tmp/deploy/Default/tutorial2.ear<br>
[J2EE Deployer Default] Starting module tutorial2.war<br>
[Auto deploy] deploy, ctxPath=/jaas-example2, warUrl=file:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/tmp/deploy/Default/tutorial2.ear/web1005/<br>
2001-05-25 08:45:57 - ContextManager: Adding context Ctx( /jaas-example2 )<br>
[Auto deploy] AbstractWebContainer.parseWebAppDescriptors, Begin<br>
[Auto deploy] addEnvEntries<br>
[Auto deploy] linkResourceRefs<br>
[Auto deploy] linkEjbRefs<br>
[Auto deploy] Linking ejb-ref: ejb/SecuredEJB to JNDI name: example2/StatelessSession<br>
[Auto deploy] linkSecurityDomain<br>
[Auto deploy] Linking security/securityMgr to JNDI name: java:/jaas/example2<br>
[Auto deploy] AbstractWebContainer.parseWebAppDescriptors, End<br>
[Auto deploy] Initialized: {WebApplication: /tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/tmp/deploy/Default/tutorial2.ear/web1005/, URL: file:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/tmp/deploy/Default/tutorial2.ear/web1005/, classLoader: AdaptiveClassLoader( ):86840}<br>
[J2EE Deployer Default] J2EE application: file:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/deploy/tutorial2.ear is deployed.<br>
...<br>
[Service Control] Started 25 services<br>
[Default] JBoss 2.2.2 Started in 0m:19s</b><br>
</div><p>At this point you have the JBoss server running with
the embeded Tomcat servlet engine and the two tutorial ears have been deployed.</p></li><li><a name="d0e11121"></a><p>Test access to the session bean</p><p>At this point the session beans are deployed and only
users with a role of 'Echo' are allowed to execute all home and remote interface
methods of the StatelessSession and StatefulSession beans. There is one user with a
username 'scott' and a password 'echoman' that has this role. We have another user
with a username 'stark' and a password 'javaman' with roles of 'Java' and 'Coder' that
should not be able to execute any methods of the StatelessSession because he does not
have the required 'Echo' role. He should be able to create and remove StatefulSession
beans and execute the noop method since the role of 'Coder' is allowed these
operations. Lets run through 4 test cases that confirm we have properly secured the
EJBs and servlet using the UsersRolesLoginModule.</p><ol type="a"><li><a name="d0e11127"></a><p>Run the SessionClient as user 'scott' with
password 'echoman'. Do this by executing the following command:</p><div class="literallayout"><br>
<tt><br>
bash-2.04$ ant example1-test0<br>
Searching for build.xml ...<br>
Buildfile: /tmp/jaas/build.xml<br>
<br>
example1-test0:<br>
<br>
validate:<br>
<br>
fail_if_not_valid:<br>
<br>
init:<br>
Using jboss.dist=/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss<br>
Using classpath=/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/client/ejb.jar:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/client/jaas.jar:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/client/jbosssx-client.jar:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/client/jboss-client.jar:/tmp/JBoss-2.2.2_Tomcat-3.2.2/jboss/client/jnp-client.jar:/tmp/JBoss-2.2.2_Tomcat-3.2.2/tomcat/lib/servlet.jar:/tmp/jaas/build/classes<br>
<br>
compile:<br>
<br>
client-test0:<br>
[java] +++ Running SessionClient with username=scott, password=echoman, example=example1<br>
[java] Created LoginContext<br>
[java] Found StatelessSessionHome<br>
[java] Created StatelessSession<br>
[java] Bean.echo('Hello') -> Hello<br>
[java] Found StatefulSessionHome<br>
&nbs
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -