Eclipse中JBOSS莫名其妙自动关闭

经常会碰到在Eclipse启动时JBOSS时,JBOSS顺利启动后自动就关闭了, 如下提示框


(注意要点击details按钮,看一下,是不是上面的原因)

由于Eclipse对于所有Java 服务器设定的超时为50秒,因此如果JBOSS的启动时间超过50秒就会被关掉。

解决这个问题要分两种情况,

一.如果确实是机器比较慢,服务器启动到一关停止,则设置服务器启动时间.


1.JBOSS 的超时可以通过其安装目录/server/default/conf/jboss-service.xml的TransactionTimeout属性来设定。默认为Normal,一般够用了。


2.如果要在Eclipse中直接启动应用,则需要在ECLIPSE中设置: Windows>Peferences>Server ,在 Server timeout delay 下拉框中选择Unlimited.


二.当把启动时间设置为Unlimited后,服务器一直处理starting的状态,这时需要检查配置.

原因主要是由于配置不一致造成的,检查下 eclipse中Jboss server的配置,位置在workspace\.metadata\.plugins\org.eclipse.wst.server.core下的server.xml(也可以在Server view单击JBOSS,在其中设置相关端口)

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<servers>
  <server hostname="localhost" id="JBoss v4.0 at localhost" name="JBoss v4.0 at localhost" runtime-id="JBoss v4.0" server-type="org.eclipse.jst.server.generic.jboss4" server-type-id="org.eclipse.jst.server.generic.jboss4" start-timeout="50" stop-timeout="15" timestamp="1">
    <map jndiPort="1099" key="generic_server_instance_properties" port="8080" serverAddress="127.0.0.1" serverConfig="default"/>
    <list key="modules" value0="order_query::org.eclipse.jst.j2ee.server:order_query::jst.web::2.4"/>
    <list key="Generic_Server_Modules_List" value0="org.eclipse.jst.j2ee.server:order_query"/>
  </server>
</servers>

 

     确定这里的Jndi port 和port是否和jboss中的对应配置相同,如果不相同,就会导致虽然JBoss已经启动完成,然而eclipse不能查询到服务器的状态,所以在eclipse中服务器一直显示为starting状态,最后超时。

    查看jboss中的配置jbosspath\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" server="www.yeepay.com" />

确保这里的端口号为8080 

最后查看jndi的端口号,位置 jbosspath\server\default\conf中的 jboss-service.xml

 

   <!-- JNDI                                                                 -->
   <!-- ==================================================================== -->

   <mbean code="org.jboss.naming.NamingService"
      name="jboss:service=Naming"
      xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">
      <!-- The call by value mode. true if all lookups are unmarshalled using
      the caller's TCL, false if in VM lookups return the value by reference.
      -->
      <attribute name="CallByValue">false</attribute>
      <!-- The listening port for the bootstrap JNP service. Set this to -1
        to run the NamingService without the JNP invoker listening port.
      -->
      <attribute name="Port">1099</attribute>

 

确保这里的1099和eclipse中的一致。

总结, 即你在JBOSS和ECLIPSE的Server view中修改的端口必须保持一致.如果不一致,那么在ECLIPSE中启动view时,服务器一直处于starting状态,直到超时,把服务器关闭.

猜你喜欢

转载自qingfeng825.iteye.com/blog/1631319