1. 程式人生 > >JBoss啟動常見的錯誤

JBoss啟動常見的錯誤

1.報錯:java.rmi.server.ExportException: Port already in use: 1098; nested exception is: 
        java.net.BindException: Address already in use: JVM_Bind
此錯誤常在4.2版本中出現。
需要修改的檔案的路徑:jboss-4.2.2.GA\server\default\conf\jboss-service.xml   把1098改為其它號碼即可,一直改到它成功為止

<attribute name="Port">1099</attribute>
      
<attribute name="RmiPort">1098</attribute>

2.報錯:java.net.BindException:   Address   already   in   use:   JVM_Bind:8080
需要修改的檔案的路徑:jboss-4.2.2.GA\server\default\deploy\jboss-web.deployer\server.xml
把8080改為其它號碼即可,一直改到它成功為止,修改後一定記得要儲存.如安裝eclipse外掛可以開啟服務直接修改Port即可。
此錯誤在各個版本都常見。

JBOSS裡面這個異常說明埠1098被其他程序佔用了,檢視佔用程序的方法為:


1)命令列cmd -> netstat -ano | findstr "1098",得到佔用埠1098的pID
2)ctrl+alt+del,進入工作管理員,點選“檢視‘,選擇pid後,檢視是那個程序佔用的,結束即可


3.報錯:Deployment "AttachmentStore" is in error due to: java.lang.IllegalArgumentException: Wrong arguments. new for target java.lang.reflect.Constructor expected=[java.net.URI] actual=[java.io.File]
具體:
...
16:15:28,605 ERROR [AbstractKernelController] Error installing to Instantiated: name=AttachmentStore state=Described  
java.lang.IllegalArgumentException: Wrong arguments. new for target java.lang.reflect.Constructor expected=[java.net.URI] actual=[java.io.File]   
    at org.jboss.reflect.plugins.introspection.ReflectionUtils.handleErrors(ReflectionUtils.java:395)   
    at org.jboss.reflect.plugins.introspection.ReflectionUtils.newInstance(ReflectionUtils.java:153)   
    at org.jboss.reflect.plugins.introspection.ReflectConstructorInfoImpl.newInstance(ReflectConstructorInfoImpl.java:106)   
    at org.jboss.joinpoint.plugins.BasicConstructorJoinPoint.dispatch(BasicConstructorJoinPoint.java:80)   
    at org.jboss.aop.microcontainer.integration.AOPConstructorJoinpoint.createTarget(AOPConstructorJoinpoint.java:282)   
    at org.jboss.aop.microcontainer.integration.AOPConstructorJoinpoint.dispatch(AOPConstructorJoinpoint.java:103)   
    at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241)   
    at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)   
    at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)   
    at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70)   
    at org.jboss.kernel.plugins.dependency.InstantiateAction.installActionInternal(InstantiateAction.java:66)   
    at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)   
    at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)   
    at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)   
    at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)   
    at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)   
    at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)   
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)   
    at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)   
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)   
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)   
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)   
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)   
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBean(AbstractKernelDeployer.java:319)   
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:297)   
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:130)   
    at org.jboss.kernel.plugins.deployment.BasicKernelDeployer.deploy(BasicKernelDeployer.java:76)   
    at org.jboss.bootstrap.microcontainer.TempBasicXMLDeployer.deploy(TempBasicXMLDeployer.java:91)   
    at org.jboss.bootstrap.microcontainer.TempBasicXMLDeployer.deploy(TempBasicXMLDeployer.java:161)   
    at org.jboss.bootstrap.microcontainer.ServerImpl.doStart(ServerImpl.java:138)   
    at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:450)   
    at org.jboss.Main.boot(Main.java:221)   
    at org.jboss.Main$1.run(Main.java:556)   
    at java.lang.Thread.run(Thread.java:619)   
Failed to boot JBoss:   
java.lang.IllegalStateException: Incompletely deployed:   
  
DEPLOYMENTS IN ERROR:   


  Deployment "AttachmentStore" is in error due to: java.lang.IllegalArgumentException: Wrong arguments. new for target java.lang.reflect.Constructor expected=[java.net.URI] actual=[java.io.File]   
  
DEPLOYMENTS MISSING DEPENDENCIES:   
  Deployment "ProfileServicePersistenceDeployer" is missing the following dependencies:   
    Dependency "AttachmentStore" (should be in state "Installed", but is actually in state "**ERROR**")   
  Deployment "ProfileServiceDeployer" is missing the following dependencies:   
    Dependency "AttachmentStore" (should be in state "Installed", but is actually in state "**ERROR**")   
  Deployment "ProfileService" is missing the following dependencies:   
    Dependency "ProfileServiceDeployer" (should be in state "Installed", but is actually in state "Instantiated")   
    Dependency "jboss.kernel:service=KernelController" (should be in state "Installed", but is actually in state "**ERROR**")   
  Deployment "ProfileServiceBootstrap" is missing the following dependencies:   
    Dependency "ProfileService" (should be in state "Installed", but is actually in state "Instantiated")   
    Dependency "jboss.kernel:service=Kernel" (should be in state "Installed", but is actually in state "**ERROR**")   
  
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.internalValidate(AbstractKernelDeployer.java:278)   
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.validate(AbstractKernelDeployer.java:174)   
    at org.jboss.bootstrap.microcontainer.ServerImpl.doStart(ServerImpl.java:142)   
    at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:450)   
    at org.jboss.Main.boot(Main.java:221)   
    at org.jboss.Main$1.run(Main.java:556)   
    at java.lang.Thread.run(Thread.java:619)   
16:15:29,515 INFO  [ServerImpl] Runtime shutdown hook called, forceHalt: true  
16:15:29,523 INFO  [ServerImpl] Shutdown complete   
Shutdown complete   
Halting VM  


此錯誤常在5.1版本中出現。
這個錯誤是配置檔案profile.xml內的一個bug,檔案路徑為:$JBOSS_HOME/server/<serverName>/conf/bootstrap/profile.xml
把其中的節點:
<bean name="AttachmentStore" class="org.jboss.system.server.profileservice.repository.AbstractAttachmentStore">
 <constructor><parameter><inject bean="BootstrapProfileFactory" property="attachmentStoreRoot" /></parameter></constructor>
修改為:
<bean name="AttachmentStore" class="org.jboss.system.server.profileservice.repository.AbstractAttachmentStore">
 <constructor><parameter class="java.io.File"><inject bean="BootstrapProfileFactory" property="attachmentStoreRoot" /></parameter></constructor>

4.錯誤資訊:
ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to Start: name=jboss:service=NamingProviderURLWriter state=Create mode=Manual requiredState=Installed
java.io.IOException: Access is denied

解決辦法:停止windows的Indexing Service服務。出現錯誤原因如下:
It seemed that a file was being locked for some reason, and that file was obviously necessary for JBoss to start. Some further investigation (ok, I admit, I just tried to delete all of JBoss with the faith that it would fail on the locked file), it turns out that file was some file called jnp-service.url in the data directory of the default server. After downloading and installing the handy Unlocker tool (http://ccollomb.free.fr/unlocker/), it turns out that cidaemon.exe (aka the Windows Indexing Service) was locking the file for some reason. Turning off the Indexing Service solved that problem.

The second issue came when I attempted to deploy my WAR file with my JAX-WS service into my new JBoss server. Again, I could not get it to deploy, and a review of the log files showed
"vfsfile:/C:/dev/Workspaces/BeliefNet/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_5.1_Server/deploy/RAFTSOA.war/" is in error due to the following reason(s): java.lang.StringIndexOutOfBoundsException: String index out of range: -1
A strange and cryptic error indeed. As you can see, I was using the JBoss tools integration with Eclipse, so I tried just exporting the WAR file and copying it manually to the JBoss deploy directory, but still no luck. With nightmares of "pouring through source code to see what JBoss is doing when it throws this exception" dancing in my head, luckily Google gave a bunch of pieces to the puzzle to what might be causing this. It turns out that JBoss requires all servlets and such to be inside a package. This was not the case when I was just deploying in Tomcat alone, but luckily this is among the easiest problems to fix.
Happy to say, after those issues were resolved, my sample JAX-WS application is up and running. Now I just have to unlock the puzzle of JAX-WS, JAXB, and how everything lives in harmony to create a viable SOA solution....

5.啟動正常在但是使用JBoss Tool3.1的外掛JBossAS Tool釋出無效(JBoss5.1 Runtime Server釋出無效),但是在預設Runtime路徑“workspace\.metadata\.plugins\org.jboss.ide.eclipse.as.core\JBoss_5.1_Runtime_ServerXXX”內可以看到釋出的專案,啟動JBoss卻無法訪問釋出資訊,這個問題鬱悶了我兩天,最終發現一個令人無語的問題,那就是在建立JBoss的專案的時候專案物理路徑內不能存在空格,比如路徑“Ejb3 Project”等帶有空格目錄的專案釋出後將無法被JBoss正確載入(真佩服這幫程式設計師)。

解決辦法:在開發JBoss的專案時候專案路徑一定不要帶空格或者其它比較少用的特殊字元,JBoss對路徑特別敏感。

OK,可以正常啟動了。