辅导:Java技术(EOS对应JBOSS相关配置介绍)
来源:优易学  2011-10-10 12:43:11   【优易学:中国教育考试门户网】   资料下载   IT书店
  EOS自带的JBOSS325和目前的JBOSS版本是有不小的区别的,Examda提示: 主要介绍EOS部署在JBOSS4以上版本的配置技巧
ERROR: invalid console appender config detected, console stream is looping
  配置介绍
  日志的配置
  JBOSS4集成了log4j,所以在启动eos后,发现日志出现一下错误:ERROR: invalid console appender config detected, console stream is looping
  这主要是EOS应用自己的 log4j和jboss集成的log4j冲突,解决方法是:
  使用jboss的log4j,转移eos的log配置到jboss的 server/default/conf/log4j.xml里:类似以下配置:
  <appender class="org.jboss.logging.appender.RollingFileAppender" name="R">
  <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
  <param name="File" value="${EOS_HOME}/logs/eoslog.log"/>
  <param name="Append" value="true"/>
  <param name="MaxFileSize" value="5000KB"/>
  <param name="MaxBackupIndex" value="50"/>
  <layout class="org.apache.log4j.PatternLayout">
  <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
  </layout> </appender>
  <logger name="defaultAppID.com.primeton.tp.core.bizservice">
  <level value="DEBUG" />
  <appender-ref ref="R" />
  </logger>
  修改server/default/conf/jboss-service.xml
  <mbean code="org.jboss.logging.Log4jService"
  name="jboss.system:type=Log4jService,service=Logging"
  xmbean-dd="resource:xmdesc/Log4jService-xmbean.xml">
  <attribute name="ConfigurationURL">resource:log4j.xml</attribute>
  <attribute name="CatchSystemOut">false</attribute>
  <!—— Set the org.apache.log4j.helpers.LogLog.setQuiteMode. As of log4j1.2.8
  this needs to be set to avoid a possible deadlock on exception at the
  appender level. See bug#696819.
  ——>
  <attribute name="Log4jQuietMode">true</attribute>
  <!—— How frequently in seconds the ConfigurationURL is checked for changes ——>
  <attribute name="RefreshPeriod">60</attribute>
  </mbean>
  修改server/default/deploy/jbossweb-tomcat55.sar/META-INF/jboss-service.xml
  <attribute name="Java2ClassLoadingCompliance">true</attribute>
  <!—— A flag indicating if the JBoss Loader should be used. This loader
  uses a unified class loader as the class loader rather than the tomcat
  specific class loader.
  The default is false to ensure that wars have isolated class loading
  for duplicate jars and jsp files.
  ——>
  <attribute name="UseJBossWebLoader">true</attribute>
  事务控制的配置
  
Jboss事务处理也有相应配置:server/default/conf/jboss-service.xml
  <mbean code="org.jboss.tm.TransactionManagerService"
  name="jboss:service=TransactionManager"
  xmbean-dd="resource:xmdesc/TransactionManagerService-xmbean.xml">
  <attribute name="TransactionTimeout">300</attribute> <!—— set to false to disable transaction demarcation over IIOP ——>
  <attribute name="GlobalIdsEnabled">true</attribute>
  <depends optional-attribute-name="XidFactory">jboss:service=XidFactory</depends>
  <!—— Transaction Integrity Checking ——>
  <!—— Force a rollback if another thread is associated with the transaction at commit ——>
  <!——depends optional-attribute-name="TransactionIntegrityFactory"
  proxy-type="org.jboss.tm.integrity.TransactionIntegrityFactory"> <mbean code="org.jboss.tm.integrity.FailIncompleteTransaction"
  name="jboss:service=TransactionManager,plugin=TransactionIntegrity"/>
  </depends——> </mbean>
  如果要一台机器使用多个jboss server那么需要修改的文件server/default/conf/jboss-service.xml server/default/deploy/jbossweb-tomcat55.sar/server.xml
  server/default/deploy/jbossweb-tomcat55.sar/server.xml配置要点
  <Connector port="8080" address="${jboss.bind.address}"
  maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
  emptySessionPath="true"
  enableLookups="false" redirectPort="8443" acceptCount="100"
  connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="GBK"/>
  注:acceptCount是排队请求的数量;应该将线程数(最大线程数)设置比最大预期负载(同时并发的点击)多25%(经验规则);应该将minSpareThread设置比正常负载多一些;
  应该将maxSpareThread设置比峰值负载多一些;
  minSpareThread指“启动以后,总是保持该数量的线程空闲等待”;
  maxSpareThread指“如果超过了minSpareThread,然后总是保持该数量的线程空闲等待”
  删除不需要的valve和日志;如果不使用JBoss的安全,删除JBoss的安全valve;预编译JSP(内置的编译器编译速度相当快,对于小的站点就没有必要预先编译了)
  关闭sever/slim/jbossweb-tomcat50.sar/conf/web.xml中的development模式;URIEncoding="GBK" 基本解决了乱码问题
  安全连接配置
  <!—— SSL/TLS Connector configuration using the admin devl guide keystore ——>
  <Connector port="8443" address="${jboss.bind.address}"
  maxThreads="100" strategy="ms" maxHttpHeaderSize="8192"
  emptySessionPath="true"
  scheme="https" secure="true" clientAuth="false"
  keystoreFile="${jboss.server.home.dir}/conf/chap8.keystore"
  keystorePass="changeit" sslProtocol = "TLS" />

责任编辑:小草

文章搜索:
 相关文章
热点资讯
资讯快报
热门课程培训