问题1:Jsp exception,错误代码:Unable to initialize TldLocationsCache: invalid entry size
解决方式:
注解掉 jboss-4.0.5.GA\server\slim\deploy\jbossweb-tomcat55.sar\conf\web.xml
<!--
<init-param>
<param-name>engineOptionsClass</param-name>
<param-value>org.jboss.web.tomcat.tc5.jasper.JspServletOptions</param-value>
</init-param>
-->
问题2:两个工程冲突
解决方式:
修改\jboss-4.0.5.GA\server\slim\deploy\jbossweb-tomcat55.sar\META-INF\jboss-service.xml
<attribute name="Java2ClassLoadingCompliance">true</attribute>
<attribute name="UseJBossWebLoader">true</attribute>
修改之后记录日志是可以了,因为相同的jar只加载了一次
把上面UseJBossWebLoader个值改为false就不会出现该问题了
问题3:Jboss JNDI 数据库连接池配置
在这里以mysql为例,根据自己的摸索。简单介绍一下:
把mysql的jdbc驱动.jar包放到jboss的server\default\lib下去。
在 jboss\server\default\deploy下新建文件mysql-ds.xml,
也可从jboss-3.2.3\docs\examples\jca copy 修改
想配置多个连接池只要多加一个<local-tx-datasource></local-tx-datasource>
其中内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>MySqlDS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=GBK</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password>john</password>
</local-tx-datasource>
</datasources>
然后再java程序就可以调用数据源:MySqlDS
以下问题是摘自网上http://fyxz.spaces.live.com/blog/cns!CBEDC4D365B47B7!208.entry
方法:
jboss-4.2.0GA\server\default\deploy\jboss-web.deployer\META-INF\jboss-service.xml
set UseJBossWebLoader=true
症状2:ERROR: invalid console appender config detected, console stream is looping
方法:
jboss-4.2.0GA\server\default\conf\jboss-service.xml
<!-- ==================================================================== -->
<!-- Log4j Initialization -->
<!-- ==================================================================== -->
<mbean code="org.jboss.logging.Log4jService"
name="jboss.system:type=Log4jService,service=Logging"
xmbean-dd="resource:xmdesc/Log4jService-xmbean.xml">
<attribute name="ConfigurationURL">resource:jboss-log4j.xml</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="CatchSystemOut">false</attribute>
<attribute name="Log4jQuietMode">true</attribute>
<!-- How frequently in seconds the ConfigurationURL is checked for changes -->
<attribute name="RefreshPeriod">60</attribute>
</mbean>
症状3:datasource not found , can not get the datasource from the jndi
方法:
jboss-4.2.0.GA\server\default\deploy\mysql-ds.xml
add below line
<use-java-context>false</use-java-context>
症状4:数据库中文乱码
方法:
1. 确认你的数据库都是以utf8作为存储编码
2. 以datasource配置做例子
配置 connetion-url 的时候加上如下红色代码
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: mysql-ds.xml 41016 2006-02-07 14:23:00Z acoliver $ -->
<!-- Datasource config for MySQL using 3.0.9 available from:
http://www.mysql.com/downloads/api-jdbc-stable.html
-->
<datasources>
<local-tx-datasource>
<jndi-name>jforumMysqlDS</jndi-name>
<use-java-context>false</use-java-context>
<connection-url>jdbc:mysql://127.0.0.1:3306/map?autoReconnect=true&characterEncoding=utf8&useUnicode=true&useNewIO=false&zeroDateTimeBehavior=convertToNull&useServerPrepStmts=false&dumpQueriesOnException=true&jdbcCompliantTruncation=false</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password></password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<!-- should only be used on drivers after 3.22.1 with "ping" support
<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
-->
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
-->
<!-- sql to call on an existing pooled connection when it is obtained from pool - MySQLValidConnectionChecker is preferred for newer drivers
<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
-->
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
方法: add "-b 0.0.0.0" at the startup command line
/var/app/jboss-4.2.0.GA/bin/run.sh -b 0.0.0.0 &
症状6: Change web port (修改web端口)
方法:
update the file at ......\jboss-4.2.0GA\server\default\deploy\jboss-web.deployer\server.xml