JBoss初学问题小记

     前一段时间,因为一个调研项目的关系,开始学习JBoss和AXIS WebService方面的相关知识。这其中碰到了一些菜鸟级别的问题,可是周围的人都没有懂JBoss的,上网也找不到什么资料,只好自己瞎琢磨了。不久,由于各种原因,这个调研中止了,很遗憾。 做个小结,也算是对自己这段时间的一点回顾吧。
   经过多方了解,知道以下jboss资料是很好的,应该在网上都可以找到的:
《jboss管理与开发核心技术》
《Getting Started with Jboss4》
《基于JBoss 4.x 的J2EE 1.4 应用开发指南》
《OReilly.Jboss.A.Developers.Notebook.Jun.2005》
《OReilly.JBoss.at.Work.A.Practical.Guide.Oct.2005》


碰到了些问题,如下:

1.怎么把Tomcat下部署的应用(比如../Tomcat 5.0/webapps/Axis)放到JBoss下呢?
  只要把这个包(Axis)拷贝到JBoss下的deploy目录下,并把它的名字后缀加个.war(如Axis.war)就可以运行了。
 
2.如何在Jboss一启动就自动加载运行某个类?
  这是属于Jboss的MBean服务里的定时服务。通过配置conf目录下的jboss-service.xml文件,增加如下信息即可实现:
  <!-- Scheduler Initialization 定时操作                                                                   -->
<!--============================================================ -->
   <mbean code="org.jboss.varia.scheduler.Scheduler"
 name="jboss.Receiver.util:service=Scheduler">

 <attribute name="StartAtStartup">true</attribute>
 <attribute name="SchedulableClass">com.metarnet.test.ReceiverNew</attribute>
 <attribute name="SchedulableArguments"></attribute>
 <attribute name="SchedulableArgumentTypes"></attribute>
 <attribute name="InitialStartDate">NOW</attribute>
 <attribute name="SchedulePeriod">5000</attribute>
 <attribute name="InitialRepetitions">20</attribute>
 <!--name为任意但唯一,com.piosan.util.PiosanTimer为class名 -->
 </mbean>

   <!--SchedulableArguments的值为传递参数,如果没有参数则为空,在SchedulableArgumentTypes中体现了 -->
    <!--SchedulePeriod 的值为每隔5秒操作一次,以毫秒为单位 -->
<!--The Scheduler MBean service defines the manageable interface for a scheduler that allows you to request an org.jboss.util.Schedulable implementation be run periodically by the service.
The configurable attributes of the Scheduler service include the following:


SchedulableClass: The fully qualified class name of the org.jboss.util.Schedulable implementation to use with the Scheduler.


SchedulableArguments: The comma separated list of arguments for the Schedulable class. This list must have as many elements as the Schedulable Argument Type list; otherwise, the start of the Scheduler will fail. Currently only basic data types, string, and classes with a constructor with a string as only argument are supported.


SchedulableArgumentTypes: The comma separated list of argument types for the Schedulable class. This will be used to find the right constructor, and to create the right instances with which to call the constructor. This list must have as many elements as the Schedulable Arguments list; otherwise, the start of the Scheduler will fail. Currently only basic data types, string, and classes with a constructor with a string as only argument are supported.


SchedulePeriod: The time between two scheduled calls (after the initial call) in milliseconds. This value must be greater than 0.


InitialRepetitions: The number of periods for which the instance will be scheduled. Set to –1 for unlimited repetitions-->
以上为各个字段的解释。

3.用了apache 的pubscribe开源代码部分,发现在producer调用consumer的notify后总是出现如下错误,后来找了半天才发现
原来是开源代码的bug,由于pubscribe这个开源项目已经暂停,还好对系统没有什么影响,只好作罢。
java.lang.NullPointerException
>>        at
>>org.apache.axis.MessageContext.setCurrentMessage(MessageContext.java:630)
>>        at
>>org.apache.axis.MessageContext.setMessage(MessageContext.java:648)
>>        at
>>org.apache.ws.resource.handler.ResourceHandler.handleResponse(ResourceHandler.java:239)
>>        at
>>org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:210)
>>        at
>>org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
>>        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
>>        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
>>        at
>>org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
>>        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
>>        at
>>org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>>        at
>>org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>>        at
>>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
>>        at
>>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
>>        at
>>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
>>        at
>>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>>        at
>>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>>        at
>>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>>        at
>>org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>>        at
>>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>>        at
>>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>>        at
>>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>>        at
>>org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
>>        at
>>org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
>>        at
>>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>>        at
>>org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
>>        at
>>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>>        at
>>org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
>>        at
>>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
>>        at
>>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>>        at
>>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>>        at
>>org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
>>        at
>>org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
>>        at
>>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
>>        at
>>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
>>        at
>>org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
>>        at
>>org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
>>        at
>>org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
>>        at
>>org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值