Dan Allen [
https://community.jboss.org/people/dan.j.allen] created the discussion
"Re: How do we use JBoss Tools with the JBoss AS 7 Fedora package?"
To view the discussion, visit:
https://community.jboss.org/message/739235#739235
--------------------------------------------------------------
The lab results are in!
*Test setup*
I created a fresh Fedora 17 installation on a virtual machine, installed JBoss AS 7 using
yum (yum install jboss-as), installed JBoss Developer Studio 5 Beta 3 and gave another
crack at these use cases.
*Preparing a user instance with jboss-as-cp*
I'm happy to report that jboss-as-cp works as expected. Here's what I did to
create a test a new "user instance":
+*Create instance:*+
*
*
mkdir $HOME/applications
jboss-as-cp -l $HOME/applications/jboss-as-user-instance -c standalone-web.xml
+*Start instance:*+
*
*
JBOSS_BASE_DIR=$HOME/applications/jboss-as-user-instance
/usr/share/jboss-as/bin/standalone.sh -c standalone-web.xml
+*Verify it's running:*+
*
*
links
http://localhost:8080
With that working, I switched over to JBoss Tools to setup the server runtime to work
against that externally managed instance.
*Deploying to the user instance from JBoss Tools*
I began by defining a new server runtime. This can be done one of two ways:
1. Pointing the JBoss Tools runtime scanner at /usr/share/jboss-as and letting it detect
and create both the server runtime and server
2. Adding a new JBoss AS 7.1 server runtime, setting the home directory (of the runtime)
to /usr/share/jboss-as and adding a server to match
It's important to check the box "Server is external managed. Assume server is
started." (for this part, at least).
By default, JBoss Tools is going to use the JBoss deploy folder
(/usr/share/jboss-as/standalone/deployments) to perform deployments. You can see this by
double clicking on the server in the Servers view and switching to the Deployment tab.
That's obviously not what we want. We need JBoss Tools to deploy into our user
instance ($HOME/applications/jboss-as-user-instance/deployments). In theory, this is done
one of two ways:
1. Checking the radio button "Use workspace metadata"
2. Checking the radio button "Use a custom deploy folder"* Deploy Directory:
/home/username/applications/jboss-as-user-instance/deployments
* Temporary Deploy Directory: /home/username/applications/jboss-as-user-instance
In addition to changing where JBoss Tools deploys the application, this also adds a
deployment scanner entry in standalone-web.xml:
Case #1:
<deployment-scanner name="JBossToolsScanner1"
path="/home/username/workspace/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_AS_7.1_Server/deploy"
scan-interval="5000"/>
Case #2:
<deployment-scanner name="JBossToolsScanner1"
path="/home/username/applications/jboss-as-user-instance/deployments"
scan-interval="5000"/>
Save the configuration and start (connect to) the server by clicking the play button in
the Servers tab.
In theory, I should now be able to import a web project (such as numberguess from the
JBoss quickstarts), drag it to the server and it should deploy. However, all I get is
#fail.
JBoss Tools is copying the folders into the deployment directory specified in the server
configuration, but it's failing to copy any files. Here's a listing showing what
it does copy:
./log
./log/server.log
./log/boot.log
./tmp
./tmp/vfs
./tmp/vfs/temp4d99614473916964
./tmp/work
./tmp/work/jboss.web
./tmp/work/jboss.web/default-host
./tmp/auth
./deployments
./deployments/jboss-as-helloworld.war
./deployments/jboss-as-helloworld.war/WEB-INF
./deployments/jboss-as-helloworld.war/WEB-INF/lib
./deployments/jboss-as-helloworld.war/WEB-INF/classes
./deployments/jboss-as-helloworld.war/WEB-INF/classes/org
./deployments/jboss-as-helloworld.war/WEB-INF/classes/org/jboss
./deployments/jboss-as-helloworld.war/WEB-INF/classes/org/jboss/as
./deployments/jboss-as-helloworld.war/WEB-INF/classes/org/jboss/as/quickstarts
./deployments/jboss-as-helloworld.war/WEB-INF/classes/org/jboss/as/quickstarts/helloworld
./deployments/jboss-as-helloworld.war/META-INF
./deployments/jboss-as-helloworld.war/META-INF/maven
./deployments/jboss-as-helloworld.war/META-INF/maven/org.jboss.as.quickstarts
./deployments/jboss-as-helloworld.war/META-INF/maven/org.jboss.as.quickstarts/jboss-as-helloworld
./configuration
./configuration/logging.properties
./configuration/mgmt-users.properties
./configuration/standalone-web.xml
Here is the message in the Eclipse error log:
!ENTRY org.jboss.ide.eclipse.as.core 4 1644298242 2012-06-01 03:11:10.100
!MESSAGE Full publish failed for module jboss-as-helloworld
!SUBENTRY 1 org.eclipse.wst.server.core 4 1644298251 2012-06-01 03:11:10.100
!MESSAGE Error copying file META-INF/MANIFEST.MF: Permission denied
!SUBENTRY 1 org.eclipse.wst.server.core 4 1644298251 2012-06-01 03:11:10.100
!MESSAGE Error copying file
META-INF/maven/org.jboss.as.quickstarts/jboss-as-helloworld/pom.properties: Permission
denied
!SUBENTRY 1 org.eclipse.wst.server.core 4 1644298251 2012-06-01 03:11:10.100
!MESSAGE Error copying file
META-INF/maven/org.jboss.as.quickstarts/jboss-as-helloworld/pom.xml: Permission denied
!SUBENTRY 1 org.eclipse.wst.server.core 4 1644298251 2012-06-01 03:11:10.100
!MESSAGE Error copying file
WEB-INF/classes/org/jboss/as/quickstarts/helloworld/HelloService.class: Permission denied
!SUBENTRY 1 org.eclipse.wst.server.core 4 1644298251 2012-06-01 03:11:10.100
!MESSAGE Error copying file
WEB-INF/classes/org/jboss/as/quickstarts/helloworld/HelloWorldServlet.class: Permission
denied
!SUBENTRY 1 org.eclipse.wst.server.core 4 1644298251 2012-06-01 03:11:10.100
!MESSAGE Error copying file WEB-INF/beans.xml: Permission denied
!SUBENTRY 1 org.eclipse.wst.server.core 4 1644298251 2012-06-01 03:11:10.100
!MESSAGE Error copying file index.html: Permission denied
I have no clue where it's trying to copy the files, but clearly it's trying to put
them someplace it shouldn't. This indicates to me it's trying to write files
outside of my home directory (it's implausable that a file write would fail inside my
home directory, where it should be copying the files).
I hypothesize that JBoss Tools (or something in WST) is not properly sandboxing the
deployment directory from the installation directory.
*Controlling the user instance from JBoss Tools*
With a bit of tweaking, I was able to figure out how to get JBoss Tools to control the
user instance so that it works just like a normal server inside of Eclipse.
* Delete the existing server, then add a new server as before. This time, keep the box
"Server is external managed" +unchecked+.
* Switch to the Deployment tab and check either "Use workspace metadata" or
"Use a custom deploy folder" as explained above
* Switch back to the Overview tab and click on "Open launch configuration"
* Uncheck the box "Always update program arguments related to the runtime"
* In the Program arguments textarea, make sure the --server-config=standalone-web.xml
* In the VM arguments textarea, remove any properties that contain the path
/usr/share/jboss-as and add these properties: -Djboss.home.dir=/usr/share/jboss-as
-Djboss.server.base.dir=${env_var:HOME}/applications/jboss-as-user-instance
* Click OK
* If necessary, save the Server configuration
Make sure JBoss AS is not running in a terminal. Then click on the play button in the
Servers tab. You should see JBoss AS starting up in the Eclipse Console tab.
Unfortunately, deployment still fails with the same error as above. How the server is
started seems unrelated to the deployment problem.
*Conclusion*
We remain at an impasse until we can figure out why JBoss Tools (or WST) is not properly
copying the files to the custom deployment directory.
(If there is a way to get more verbose information from the logs, let me know and I'll
report that information).
*Suggestions*
I like the idea of jboss-as-cp, but I don't think it has the right name. I'd like
to propose the following alternatives:
* jboss-as-instance (consistent with the equivalent command for tcServer)
* jboss-as-create-instance (a bit more explicit about what it's doing)
* jboss-as-new-instance (a bit shorter, just as clear)*
* jboss-as-create (implies instance, if we really want to keep it short)
* my preferred choice so far
It would be nice if JBoss Tools could perform the setup done by jboss-as-cp. It's not
necessary to use the jboss-as-cp as it's just a few copy commands. I envision this as
another checkbox in the Server setup wizard. I don't think this is specific to Linux,
so it's reasonable to make it a general option when defining a JBoss AS 7 server.
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/739235#739235]
Start a new discussion in JBoss Tools at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]