Presentation is loading. Please wait.

Presentation is loading. Please wait.

JBOSS 入门 行癫. Agenda  JBOSS Install & Monitor  Naming On JBOSS  Web Application  Security On JBOSS  Clustering On JBOSS  Application Deploy for JBOSS.

Similar presentations


Presentation on theme: "JBOSS 入门 行癫. Agenda  JBOSS Install & Monitor  Naming On JBOSS  Web Application  Security On JBOSS  Clustering On JBOSS  Application Deploy for JBOSS."— Presentation transcript:

1 JBOSS 入门 行癫

2 Agenda  JBOSS Install & Monitor  Naming On JBOSS  Web Application  Security On JBOSS  Clustering On JBOSS  Application Deploy for JBOSS  TaoBao Practise On JBOSS

3 JBoss Install  Directory Structure

4 JBoss Install  The Default Server Configuration File Set

5 JBoss Install & Monitor

6

7

8 Naming on JBOSS  Naming A naming service’s primary function is to map people- friendly names to objects, such as addresses, identifiers, or objects typically used by computer programs.  JNDI The java Naming and Directory Interface(JNDI) is an application programming interface that provides nameing and directory functionality to application written using the Java programming language.

9 Naming on JBOSS  JNDI Architecture

10 Naming on JBOSS  JNDI on JBOSS

11 Naming on JBOSS  Key components in the JBossNS architecture  Port  RmiPort  BindAddress  RmiBindAddress  Backlog  ClientSocketFactory  ServerSocketFactory  JNPServerSocketFactory

12 Naming On JBOSS  USING JNDI  The standard naming context factory  Java.naming.factory.initial  Java.naming.provider.url  Java.naming.factory.url.pkgs  Jnp.socketFactory  Jnp.timeout  Jnp.sotimeout

13 JNDI  ENC – enterprise naming context  Naming scope in JBoss: names under java:comp, names under java:,and any other name. The java:comp context and its subcontexts are only available to the application component associated with that particular context. Subcontexts and object bindings directly under java: are only visible within the JBoss server virtual machine and not to remote clients. Any other context or object binding is available to remote clients, provided the context or object supports serialization. Resource Manager Connection Factory References: Each resource-ref element describers a single resource manager connection factory reference. The resource- ref element consists of the following child elements: ------------------------------------------------------------------------- An optional description element. A res-ref-name element. A res-type element. A res-auth element. ------------------------------------------------------------ JDBC DataSource references should be declared in the java:comp/env/jdbc subcontext. JMS connection factories should be declared in the java:comp/env/jms subcontext. JavaMail connection factories should be declared in the java:comp/env/mai subcontext. URL connection factories should be declared in the java:comp/env/url subcontext.

14 Web Application  Using Tomcat 5  Support servlet 2.4 and jsp 2.0 specifaction DefaultSecurityDomain Java2ClassLoadingCompliance UseJBossWebLoader LenientEjbLink ManagerClass UserJK Domain

15  JSP2.0  JSP Custom Tag Pooling  Background JSP compilation  Recompile JSP when included page changes  JDT used to compile JSP pages

16 Web Application  The server.xml  The Connector element  acceptCount  connectionTimeout  enableLookups  maxThreads  maxSpareThreads  minSpareThreads  URIEncoding  useBodyEncodingForURI

17 Web Application  Using Apache with Tomcat LoadModule jk_module libexec/mod_jk.so AddModule mod_jk.c JkWorkersFile /tmp/workers.properties JkLogFile /tmp/mod_jk.log JkLogLevel debug JkMount /jbosstest/* ajp13

18 Web Application  /opt/taobao/install/httpd/modules/mod_jk.so  JkWorkerProperty worker.list=local  JkWorkerProperty worker.local.type=ajp13  JkWorkerProperty worker.local.host=localhost  JkWorkerProperty worker.local.port=8009  JkWorkerProperty worker.local.socket_timeout=30  JkWorkerProperty worker.local.socket_keepalive=1  JkWorkerProperty worker.local.recycle_timeout=15  JkLogFile /home/admin/cai/logs/denali_jk.log  JkLogLevel info  JkOptions +ForwardURICompat  JkMount /auction/checkcode local  JkMount /services/tbassistant local  JkMount /services/tbassistant2 local  JkMount /*.htm local  JkMount /*.jhtml local  JkMount /*.php local  JkMount /*.esi local  JkMount /*.vhtml local  JkMount /*.do local

19 Security on JBOSS

20  Define a Security Domain The conf/login-config.xml file is the central configuration point for security in JBoss.

21 Security On JBoss  To set the security domain, we need to introduce another Jboss-specific deployment descriptor : jboss-web.xml java:/jaas/todo

22 Security On JBoss  Using Hashed Password java:/DefaultDS select passwd from USERS where login=? select role, 'Roles' from USER_ROLES where login=? MD5 BASE64

23 Security On JBoss The login-config.xml entry for the EncryptDBPassword? would look like:? admin 5dfc52b51bd35553df8592078de921bc jboss.jca:service=LocalTxCM,name=DefaultDS If you use a xa-datasource then the module-option name="managedConnectionFactoryName" should be: jboss.jca:service=XATxCM,name=DefaultDS

24 Security On JBoss  Using SecureIdentityLoginModule Encode password: java -cp lib/jboss-jmx.jar:lib/jboss-common.jar:server/default/lib/jboss- jca.jar:server/default/lib/jbosssx.jar org.jboss.resource.security.SecureIdentityLoginModule taobao123 DefaultDS jdbc:oracle:thin:@dev-db:1000:abc 15 20 10 EncryptDBPassword

25 Web Clustering  Clustering: EJB 、 JMS 、 JNDI 、 WEB  Web Cluster: load balance 、 state synchronization  Request-Based: session replication  User-Based: session sticky

26 Clustering  worker.list=loadbalancer,server1,server2  # Define the first node...  worker.server1.port=8009  worker.server1.host=172.16.0.116  worker.server1.type=ajp13  worker.server1.lbfactor=1  worker.server1.local_worker=1  worker.server1.cachesize=10  # Define the first node...  worker.server2.port=8009  worker.server2.host=172.16.32.88  worker.server2.type=ajp13  worker.server2.lbfactor=1  worker.server2.local_worker=1  worker.server2.cachesize=10  # Now we define the load-balancing behaviour  worker.loadbalancer.type=lb  worker.loadbalancer.balanced_workers=server1,server2  worker.loadbalancer.sticky_session=1

27 Web Clusting  Configure JBoss edit the JBOSS_HOME/server/all/deploy/jbossweb-tomcat50.sar/server.xml file:... true

28 JMS & MDB  JBoss Messaging Overview  Invocation Layer (IL) UIL2 IL JVM IL HTTP IL Security Manager Destination Manager Message Cache State Manager Persistence Manager DBC2 persistence manager Null Persistence Manager Destinations Queues Topics

29 JMS & MDB  JBoss Messaging Configuration and MBeans  org.jboss.mq.server.MessageCache CacheStore: The JMX ObjectName of the service that will act as the cache store. The cache store is used by the MessageCache to move messages to persistent storage. The value you set here typically depends on the type of persistence manager you are using. HighMemoryMark: The amount of JVM heap memory in megabytes that must be reached before the MessageCache starts to move messages to secondary storage. MaxMemoryMark: The maximum amount of JVM heap memory in megabytes that the MessageCache considers to be the max memory mark. As memory usage approaches the max memory mark, the MessageCache will move messages to persistent storage so that the number of messages kept in memory approaches zero.

30 JMS & MDB  EJB-JAR.XML CommandDispatcherMDB com.alibaba.biz.command.dispatcher.ejb.mdb.CommandDispatcherBean Container javax.jms.Queue serviceConfig java.lang.String classpath/denali-biz-service.xml jms/QCF javax.jms.QueueConnectionFactory Container

31 JMS & MDB  Jboss.xml CommandDispatcherSLSB ejb/CommandDispatcherSLSB CommandDispatcherMDB queue/B Standard Message Driven Bean jms/QCF ConnectionFactory

32 JMS & MDB  jvm-il-service.xml  uil2-service.xml ConnectionFactory java:/ConnectionFactory

33 Application Deploy  Jboss-service.xml <mbean code="org.jboss.deployment.scanner.URLDeploymentScanner" name="jboss.deployment:type=DeploymentScanner,flavor=URL"> deploy/ <!-- Example URLs: deploy/ scans ${jboss.server.url}/deploy/, which is local or remote depending on the URL used to boot the server ${jboss.server.home}/deploy/ scans ${jboss.server.home)/deploy, which is always local file:/var/opt/myapp.ear deploy myapp.ear from a local location file:/var/opt/apps/ scans the specified directory http://www.test.com/netboot/myapp.ear deploys myapp.ear from a remote location http://www.test.com/netboot/apps/ scans the specified WebDAV location -->

34 Directory Structure  Directory Structure ├─ htdocs static content ├─ conf dynamic config file │ └─ tpl ├─ bin script ├─ lib linux lib ├─ oracle oracle database tnsnames │ └─ network │ └─ admin └─ logs └─ cronolog

35  Running multiple instances on a given machine ports-01../conf/bindings.xml org.jboss.services.binding.XMLServicesStoreFactory

36  Database connection pool configure : genesisDataSource jdbc:oracle:oci:@genesis true 50 oracle.jdbc.driver.OracleDriver 2 5 50 Oracle9i p4p EncryptDB1Password

37 讨论与交流


Download ppt "JBOSS 入门 行癫. Agenda  JBOSS Install & Monitor  Naming On JBOSS  Web Application  Security On JBOSS  Clustering On JBOSS  Application Deploy for JBOSS."

Similar presentations


Ads by Google