将jboss植入项目供开发使用

创建env.bat及jbossctl-dev.bat脚本用于启动jboss,内容如下:

env.bat:

 

SET JAVA_HOME=D:/Program Files/Java/jdk1.6.0_20

SET JBOSS_HOME=D:/jboss-4.0.5.GA

SET WEB_APP_HOME=D:/WebApp/powertrace/deploy

SET JBOSS_SERVER_HOME=D:/WebApp/powertrace/deploy/jboss_server

SET PROJECT_NAME=powertrace

SET PROJECT_HOME=D:/WebApp/powertrace/deploy/target

 

set JAVA_MEM_OPT= -Xms128m -Xmx512m -XX:PermSize=128m

set JBOSS_SERVER_DIR= -Djboss.server.home.dir=%JBOSS_SERVER_HOME% -Djboss.server.home.url=file:%JBOSS_SERVER_HOME%

set JAVA_DEBUG_OPT= -server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8088,server=y,suspend=n

 

REM SET JMX_FILE_ACL="%PROJECT_HOME%\conf\jmx\*.properties"

REM CACLS %JMX_FILE_ACL%  /t /c /p %USERNAME%:f

REM SET TIGER_JMX_OPT= -Dcom.sun.management.config.file=%PROJECT_HOME%\conf\jmx\jmx_monitor_management.properties

REM SET JAVA_OPTS=%JAVA_OPTS% %TIGER_JMX_OPT%

 

jbossctl-dev.bat:

 

@echo off

@if not "%ECHO%" == ""  echo %ECHO%

@if "%OS%" == "Windows_NT"  setlocal

 

set ENV_PATH=.\

if "%OS%" == "Windows_NT" set ENV_PATH=%~dp0%

call %ENV_PATH%\env.bat

 

if exist %JBOSS_SERVER_HOME% (

rd "%JBOSS_SERVER_HOME%" /s /q

)

 

 

if not exist %JBOSS_SERVER_HOME% (

XCOPY  "%JBOSS_HOME%\server\default\." "%JBOSS_SERVER_HOME%\"  /s /e  

    rd "%JBOSS_SERVER_HOME%\deploy\jmx-console.war" /s /q

rd "%JBOSS_SERVER_HOME%\deploy\management" /s /q

rd "%JBOSS_SERVER_HOME%\deploy\jbossweb-tomcat55.sar\ROOT.war" /s /q

rem del "%JBOSS_SERVER_HOME%\conf\jboss-service.xml"

)

 

if  exist %JBOSS_SERVER_HOME%\work (

rd "%JBOSS_SERVER_HOME%/work" /s /q

)

if  exist %JBOSS_SERVER_HOME%\tmp (

rd "%JBOSS_SERVER_HOME%/tmp" /s /q

)

 

 rem COPY "%WEB_APP_HOME%\conf\jboss\conf\jboss-service.xml"  "%JBOSS_SERVER_HOME%\conf\jboss-service.xml" /Y

 rem COPY  "%WEB_APP_HOME%\conf\jboss\deploy\tomcat-jboss-service.xml" "%JBOSS_SERVER_HOME%\deploy\jbossweb-tomcat55.sar\META-INF\jboss-service.xml" /Y

 rem  COPY  "%WEB_APP_HOME%\conf\jboss\deploy\tomcat-server.xml" "%JBOSS_SERVER_HOME%\deploy\jbossweb-tomcat55.sar\server.xml"  /Y

rem COPY  "%WEB_APP_HOME%\conf\jboss\conf\login-config.xml" "%JBOSS_SERVER_HOME%\conf\login-config.xml" /Y

 rem   COPY  "%WEB_APP_HOME%\conf\jboss\deploy\oracle-ds.xml" "%JBOSS_SERVER_HOME%\deploy\oracle-ds.xml" /Y

     COPY  "%PROJECT_HOME%\%PROJECT_NAME%.war"  "%JBOSS_SERVER_HOME%\deploy\%PROJECT_NAME%.war" /Y

 

    REM cls screen 

rem CLS

 

set JAVA_OPTS= %JAVA_OPTS% %JAVA_MEM_OPT% %JBOSS_SERVER_DIR% %JAVA_DEBUG_OPT% 

 

 call %JBOSS_HOME%\bin\run.bat

 

启动jbossctl-dev.bat便可将应用部署到jboss中,debug端口为8088.

 

ps:需要修改jboss的一个文件$JBOSS_HOME/server/default/deploy/jbossweb- tomcat55.sar/META-INF/jboss-service.xml,将UseJBossWebLoader的属性值为 true(默认值为false),否则回报 java.lang.ClassCastException异常,起因可能是Jboss用了Tomcat的Class Loader来加载Web应用的类,修改改属性值是指定JBoss使用JBoss统一的Class Loader来加载Web应用的类.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值