我的eclipse版本是4.4.1,Tomcat的版本是8.0.17,JBoss 的版本是jboss-as-7.1.1.Final,jdk版本是1.7.0_75。
安装JBoss AS7 参考我上一篇博文http://blog.csdn.net/u014541763/article/details/44541887
安装JBoss Tools:
在eclipse菜单找到help-->install new software-->在work with右边点击add后,在Location输入http://download.jboss.org/jbosstools/updates/development,点击ok
pending等一会儿。
展开Abridged JBoss Tools,选中JBossAS Tools,自动为你选择最新版本,注意只需安装这个就可以了,其他不要勾选。
然后就是同意安装,下载等待,反正我是等了十几分钟才安装好。
2.在eclipse中启动JBoss
在项目空闲位置,右击鼠标-->new-->other-->server-->server-->选择JBoss AS 7.1-->next-->create new runtime-->选择Alternate JRE 选中jdk1.7.0_75,还有选择Jboss的安装路径-->next-->finish
在eclipse下方servers中选中JBoss AS7,点绿色的start
一、发现无法启动,首先弹出一个提示。
解决办法:进入eclipse启动时选择的工作区间(就是你的项目所在位置)
qingyan@Croesus:~$ cd ~/KuaiPan/javaEE_Web/.metadata/.plugins/org.eclipse.wst.server.core
qingyan@Croesus:~/KuaiPan/javaEE_Web/.metadata/.plugins/org.eclipse.wst.server.core$ sudo gedit servers.xml
出现:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<servers>
<server auto-publish-setting="2" auto-publish-time="1" configuration-id="/Servers/Tomcat v8.0 Server at localhost-config" deployDir="wtpwebapps" hostname="localhost" id="Tomcat v8.0 Server at localhost" name="Tomcat v8.0 Server at localhost" runtime-id="Apache Tomcat v8.0" server-type="org.eclipse.jst.server.tomcat.80" server-type-id="org.eclipse.jst.server.tomcat.80" start-timeout="45" stop-timeout="15" testEnvironment="true" timestamp="6">
<list key="modules" value0="Demo::org.eclipse.jst.jee.server:Demo::jst.web::3.1"/>
</server>
<server auto-publish-time="1" hostname="localhost" id="JBoss AS 7.11427077577059" name="JBoss AS 7.1" org.jboss.ide.eclipse.as.core.server.EXPOSE_MANAGEMENT_SERVICE="true" org.jboss.ide.eclipse.as.core.server.IGNORE_LAUNCH_COMMANDS="false" org.jboss.ide.eclipse.as.core.server.attributes.shutdownPollerKey="org.jboss.ide.eclipse.as.core.runtime.server.WebPoller" org.jboss.ide.eclipse.as.core.server.attributes.startupPollerKey="org.jboss.ide.eclipse.as.core.runtime.server.WebPoller" org.jboss.ide.eclipse.as.core.server.deployDirectoryType="server" org.jboss.ide.eclipse.as.core.server.serverMode="local" runtime-id="JBoss 7.1 Runtime 2" server-type="org.jboss.ide.eclipse.as.71" server-type-id="org.jboss.ide.eclipse.as.71" start-timeout="450" stop-timeout="450" timestamp="1"/>
</servers>
//将第一次出现start-timeout的地方将时间改为600:
start-timeout="600" stop-timeout="600" testEnvironment="true" timestamp="6">
二、又出了问题 :java.io.FileNotFoundException: /usr/local/jboss-as-7.1.1.Final/standalone/log/boot.log (没有那个文件或目录)
Unable to set property fileName on class org.jboss.logmanager.handlers.FileHandler: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.jboss.logmanager.PropertyConfigurator.configureProperties(PropertyConfigurator.java:187)
at org.jboss.logmanager.PropertyConfigurator.configureHandler(PropertyConfigurator.java:312)
at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:128)
at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:86)
at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:246)
at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:231)
at java.util.logging.LogManager$2.run(LogManager.java:320)
at java.util.logging.LogManager$2.run(LogManager.java:318)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:318)
at java.util.logging.LogManager.getLogManager(LogManager.java:300)
at java.util.logging.Logger.<init>(Logger.java:265)
at java.util.logging.LogManager$RootLogger.<init>(LogManager.java:1468)
at java.util.logging.LogManager$RootLogger.<init>(LogManager.java:1466)
at java.util.logging.LogManager$1.run(LogManager.java:204)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.<clinit>(LogManager.java:181)
at org.jboss.modules.Main.main(Main.java:275)
Caused by: java.io.FileNotFoundException: /usr/local/jboss-as-7.1.1.Final/standalone/log/boot.log (没有那个文件或目录)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
at org.jboss.logmanager.handlers.FileHandler.setFile(FileHandler.java:152)
at org.jboss.logmanager.handlers.FileHandler.setFileName(FileHandler.java:183)
... 22 more
09:54:43,386 信息 [org.jboss.modules] JBoss Modules version 1.1.1.GA
//解决办法
参照我上一篇博文http://blog.csdn.net/u014541763/article/details/44541887
//执行
//启动jboss as7
qingyan@Croesus:/usr/local/jboss-as-7.1.1.Final/bin$ sudo ./standalone.sh
//只要启动过JBoss后就会生成 /usr/local/jboss-as-7.1.1.Final/standalone/log/boot.log 这个文件,其实还多了其他几个文件
三、又出现新问题了:Caused by: java.io.FileNotFoundException: /usr/local/jboss-as-7.1.1.Final/standalone/log/boot.log (权限不够)
Unable to set property fileName on class org.jboss.logmanager.handlers.FileHandler: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.jboss.logmanager.PropertyConfigurator.configureProperties(PropertyConfigurator.java:187)
at org.jboss.logmanager.PropertyConfigurator.configureHandler(PropertyConfigurator.java:312)
at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:128)
at org.jboss.logmanager.PropertyConfigurator.configure(PropertyConfigurator.java:86)
at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:246)
at org.jboss.logmanager.LogManager.readConfiguration(LogManager.java:231)
at java.util.logging.LogManager$2.run(LogManager.java:320)
at java.util.logging.LogManager$2.run(LogManager.java:318)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:318)
at java.util.logging.LogManager.getLogManager(LogManager.java:300)
at java.util.logging.Logger.<init>(Logger.java:265)
at java.util.logging.LogManager$RootLogger.<init>(LogManager.java:1468)
at java.util.logging.LogManager$RootLogger.<init>(LogManager.java:1466)
at java.util.logging.LogManager$1.run(LogManager.java:204)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.logging.LogManager.<clinit>(LogManager.java:181)
at org.jboss.modules.Main.main(Main.java:275)
Caused by: java.io.FileNotFoundException: /usr/local/jboss-as-7.1.1.Final/standalone/log/boot.log (权限不够)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
at org.jboss.logmanager.handlers.FileHandler.setFile(FileHandler.java:152)
at org.jboss.logmanager.handlers.FileHandler.setFileName(FileHandler.java:183)
... 22 more
//解决办法
qingyan@Croesus:/usr/local/jboss-as-7.1.1.Final/standalone/log$ sudo chmod 777 boot.log
四、问题:Caused by: java.lang.IllegalStateException: JBAS014922: Directory /usr/local/jboss-as-7.1.1.Final/standalone/data/content is not writable
10:48:02,066 信息 [org.jboss.modules] JBoss Modules version 1.1.1.GA
10:48:02,865 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
10:48:03,319 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting
10:48:03,544 ERROR [org.jboss.msc.service.fail] MSC00001: Failed to start service jboss.as: org.jboss.msc.service.StartException in service jboss.as: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_75]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_75]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_75]
Caused by: java.lang.IllegalStateException: JBAS014922: Directory /usr/local/jboss-as-7.1.1.Final/standalone/data/content is not writable
at org.jboss.as.repository.ContentRepository$Factory$ContentRepositoryImpl.<init>(ContentRepository.java:123)
at org.jboss.as.repository.ContentRepository$Factory.addService(ContentRepository.java:97)
at org.jboss.as.server.ApplicationServerService.start(ApplicationServerService.java:134) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
... 3 more
//解决办法
qingyan@Croesus:/usr/local/jboss-as-7.1.1.Final/standalone/data$ sudo chmod -R 777 content/
五、问题又出现了:ERROR [org.jboss.msc.service.fail] MSC00001: Failed to start service jboss.deployment-mount-provider: org.jboss.msc.service.StartException in service jboss.deployment-mount-provider: JBAS015843: Failed to create temp file provider
10:50:20,899 信息 [org.jboss.modules] JBoss Modules version 1.1.1.GA
10:50:22,218 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
10:50:22,618 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting
10:50:23,007 ERROR [org.jboss.msc.service.fail] MSC00001: Failed to start service jboss.deployment-mount-provider: org.jboss.msc.service.StartException in service jboss.deployment-mount-provider: JBAS015843: Failed to create temp file provider
at org.jboss.as.server.deployment.DeploymentMountProvider$Factory$ServerDeploymentRepositoryImpl.start(DeploymentMountProvider.java:111) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_75]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_75]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_75]
//猜想:应该是中间变量无法创建
发现standalone下有个目录为tmp,应该就是无法在这里操作,而出现错了
//解决办法
qingyan@Croesus:/usr/local/jboss-as-7.1.1.Final/standalone$ sudo chmod -R 777 tmp/
六、如果还有什么权限不够的话,执行下面这句话,就能成功了!
qingyan@Croesus:/usr/local/jboss-as-7.1.1.Final$ sudo chmod -R 777 standalone/
上面的三、四、五问题就不会出现了。