1、访问端口配置
编辑%jboss-4.0.2%\server\default\deploy\jbossweb-tomcat55.sar\server.xml
将8080改为你希望访问的端口(8888)
<!-- A HTTP/1.1 Connector on port 8080 -->
<Connector port="8888" address="${jboss.bind.address}"
maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
emptySessionPath="true"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8"/>
2、虚拟目录配置:
编辑%jboss-4.0.2%\server\default\deploy\jbossweb-tomcat55.sar\server.xml
在</Host>之前增加:
<Context path="/test" docBase="F:\\test" debug="1" reloadable="true" override="true" crossContext="true"/>
其中path 为虚拟目录名,docBase为硬盘路径(可为绝对路径)reloadable为类变更时是否重新加载
3、解决附件汉字问题:
a.编辑
%jboss-4.0.2%\server\default\deploy\jbossweb-tomcat55.sar\server.xml
在Connector 属性最后增加:URIEncoding="UTF-8"
<!-- A HTTP/1.1 Connector on port 8080 -->
<Connector port="8888" address="$"
maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
emptySessionPath="true"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8"/> b.页面处理
将生成的附件名称进行编码转换:
<%
String n2="Redhat9中文官方文档.rar";
n2=java.net.URLEncoder.encode(n2,"UTF-8");
%>
<a href="Redhat9">http://192.168.1.112:8080/zlsf/<%=n2%>">Redhat9中文官方文档</a>
4、解决汉字问题。
在:项目/WEB-INFweb.xml中增加:
<filter>
<filter-name>Set Character Encoding</filter-name>
<filter-class>filters.SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>GBK</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Set Character Encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
其中
<param-value>GBK</param-value>这里要设置GBK,而不是UTF8。为了解决标单提交后的中文问题。
filters.SetCharacterEncodingFilter 类文件在TOMCAT lib 目录下filters.jar文件中。 你只需要把filters.jar放入你应用目录下的LIB中即可。
5、虚拟主机配置
a.编辑
%jboss-4.0.2%\server\default\deploy\jbossweb-tomcat55.sar\server.xml
在</Engine>之前添加:
<Host name="">
<Alias></Alias>--〉别名,通过这个名字可以访问下的应用。 <Alias>ytiic.com</Alias>--〉同上
<!-- Default context parameters -->
<DefaultContext cookies="true" crossContext="true" override="true"/>
</Host>
b.在这个目录下:%jboss-4.0.2%\server\default\deploy
创建一个目录:test.war(你的虚拟目录加.war)之后在其下创建WEB-INF目录
在WEB-INF下创建:jboss-web.xml 文件,内容如下:
<jboss-web>
<context-root>/</context-root>
<virtual-host></virtual-host>
</jboss-web>
虚拟主机配置完成!
当jboss启动后,会自动对应2个配置文件中的虚拟主机名。
6、数据库配置:
去这个 %jboss-4.0.2%\docs\examples\jca 目录找一个你想用的数据库文件:
拷贝到%jboss-4.0.2%\server\default\deploy 下,打开编辑。
在%jboss-4.0.2%\server\default\deploy目录下自己建了一个文件:
test这个名字自己定义,后面需要保留。
test-ds.xml
内容如下:
< xml version="1.0" encoding="UTF-8" >
<!--
===================================================================== -->
<!-- -->
<!-- JBoss Server Configuration -->
<!-- -->
<!--
===================================================================== -->
<!-- $Id: mssql-ds.xml,v 1.3 2004/09/15 14:37:40 loubyansky Exp $ -->
<!--
======================================================================-->
<!-- New ConnectionManager setup for Microsoft SQL Server 2000 driver -->
<!-- You may download the latest Microsoft JDBC driver from *Microsoft* -->
<!-- /downloads/default.asp url=/downloads/sample.asp url=/MSDN- FILES/027/001/779/msdncompositedoc.xml&frame=true -->
<!--
===================================================================== -->
<datasources>
<local-tx-datasource>
<jndi-name>test</jndi-name>
<connection-url>jdbc:mysql://192.168.1.1/test</connection-url>
<driver-class>org.gjt.mm.mysql.Driver</driver-class>
<user-name>root</user-name>
<password>password</password>
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
-->
<!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use --> <min-pool-size>5</min-pool-size>
<!-- The maximum connections in a pool/sub-pool -->
<max-pool-size>20</max-pool-size>
<!-- sql to call on an existing pooled connection when it is obtained from pool
<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
-->
<!-- The time before an unused connection is destroyed -->
<!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use-->
<!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections -->
<idle-timeout-minutes>1</idle-timeout-minutes>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>mysql</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
数据库配置完成。
连接数据源名为:java:/test
================================= 所有配置完成!!
注意问题:
(1)、你的应用下的LIB库不要和%jboss-4.0.2%\server\default\lib 下的类库相冲突。
(2)、数据库配置参考:%jboss-4.0.2%\docs\examples\jca 下的文件
7、禁止文件目录列表
编辑%jboss-4.0.2%\server\default\deploy\jbossweb-tomcat55.sar\conf\web.xml 把listing设置为false
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class> <init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
第二篇:修改JBOSS端口
解决两个JBOSS部署在同一台服务器时端口占用问题
当两个JBOSS部署在同一台服务器上时,需要修改下面的端口值
1, jboss-4.2.2.GA\server\default\deploy\ejb3.deployer\META-INF下打开jboss-service.xml文件
第12行修改3873的端口值
<mbean code="org.jboss.remoting.transport.Connector"
name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3"> <depends>jboss.aop:service=AspectDeployer</depends>
<attribute name="InvokerLocator">socket://${jboss.bind.address}:3873</attribute> <attribute name="Configuration">
<handlers>
<handler
2, jboss-4.2.2.GA\server\default\deploy\jboss-web.deployer下打开server.xml文件 修改80,8009,8443的
端口值
a. 第22行修改80端口;
b. 第25行修改8443端口;
<Connector port="80" address="${jboss.bind.address}"
maxThreads="250" maxHttpHeaderSize="8192"
emptySessionPath="true" protocol="HTTP/1.1"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8" /> c. 第39行修改8009端口;
emptySessionPath="true" enableLookups="false" redirectPort="9445" />
<Engine name="jboss.web" defaultHost="localhost">
3, jboss-4.2.2.GA\server\default\conf下打开jboss-service.xml文件,修改8083,1098,1099,4444,4445,
4446的端口值
a. 第210行修改8083端口;
<mbean code="org.jboss.web.WebService"
name="jboss:service=WebService">
<!-- The Bind address and Port -->
<attribute name="BindAddress">${jboss.bind.address}</attribute>
<attribute name="Port">8083</attribute>
<!-- The address to use for the host portion of the RMI codebase URL -->
<attribute name="Host">${java.rmi.server.hostname}</attribute>
<!-- Should non-EJB .class files be downloadable -->
<attribute name="DownloadServerClasses">true</attribute>
b. 第257行修改1098端口
<!-- The port of the RMI naming service, 0 == anonymous -->
<attribute name="RmiPort">1098</attribute>
<!-- The RMI service bind address. Empty == all addresses
-->
c. 第251行修改1099的端口值
<attribute name="Port">1099</attribute>
d. 第426行修改4444端口值
<mbean code="org.jboss.invocation.jrmp.server.JRMPInvoker"
name="jboss:service=invoker,type=jrmp">
<attribute name="RMIObjectPort">4444</attribute>
<attribute name="ServerAddress">${jboss.bind.address}</attribute>
e. 第450行修改4445的端口值
<mbean code="org.jboss.invocation.pooled.server.PooledInvoker"
name="jboss:service=invoker,type=pooled">
<attribute name="NumAcceptThreads">1</attribute>
<attribute name="MaxPoolSize">300</attribute>
<attribute name="ClientMaxPoolSize">300</attribute>
<attribute name="SocketTimeout">60000</attribute>
<attribute name="ServerBindAddress">${jboss.bind.address}</attribute>
<attribute name="ServerBindPort">4445</attribute>
<attribute name="ClientConnectAddress">${jboss.bind.address}</attribute>
<attribute name="ClientConnectPort">0</attribute>
<attribute name="ClientRetryCount">1</attribute>
<attribute name="EnableTcpNoDelay">false</attribute>
f. 第510行修改4446的端口值
<attribute name="socketTimeout" isParam="true">600000</attribute>
<attribute name="serverBindAddress">${jboss.bind.address}</attribute>
<attribute name="serverBindPort">4446</attribute>
4, jboss-4.2.2.GA\server\default\conf打开jboss-minimal.xml文件,修改1099的端口值,与第3步中的修
改一致
第76行修改1099的值
<attribute name="Port">1099</attribute>
5,jboss-4.2.2.GA\server\default\deploy\jms下打开uil2-service.xml,修改8093的端口值
第22行修改8093的端口值
<attribute name="ServerBindPort">8093</attribute>