• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JBoss in Action Hello World App

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys!

I'm trying to get the HelloWorld from chapter 1 of JBoss in Action to work (chapter available free here: http://www.manning.com/jamae/). First of all a bit of context. I am running a Mac Powerbook pro laptop, using the native Unix OS. I'm running maven 3.2.1 and Java 1.7.0_25. I've downloaded jboss-6.1.0.Final. I've changed permissions on the bin/startup.sh file to chmod 777 and when I go to localhost:8080, I do indeed see the appropriate JBoss screen. So, all of that seems dandy. I really wanted to upload images just to show, but this forum seems to only allow URL images. Did I miss something there?

Where I'm having trouble is the exercise where I need to deploy a Hello World program. As far as I can tell I have created a directory structure exactly like the one he wants. However, when I run this command:


Unless I've misunderstood something, that translates to this on my computer:


This is the result produced when I run the command from inside the helloWorldBuild folder:


So, where should these javax.servlet packages it seems to be looking for be? I didn't see them referenced in the code from the book. Are they meant to be in the JBoss directory structure, or should they have been put in the helloWorldBuild directory at some point?

By the way, if this is going to be too much, I would be quite happy to find a step-by-step guide that will teach me how to use JBoss with Eclipse rather than the command line. I'm told this is supposed to be easy, but I'm just not finding it so. I really appreciate your help.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JBoss in Action is specifically for JBoss AS 5.x. And the script were all written for that version. They will not work in later version because the directory layout, and directory contents, have all changed.

Also, be aware that the JBoss in Action scripts make use of Ant, not Maven.

Anyway, the problem is that you don't have the necessary JAR in the path, add jboss-eap-6.1\modules\system\layers\base\javax\servlet\api\main\jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar to the classpath.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure but it looks like Terry is using JBoss AS 6.1.0, a release in the 6.x series, and not JBoss EAP 6.1.0 which is based on community edition 7.x.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nothing like causing confusion by using the same release numbering for two different versions of what is essentially the same product! I'm sure that the Red Hat support folks buy Tylenol by the ton; I do not envy them. :-)

Anyway, for JBoss AS 6.1.0, the classpath needs to include jboss-6.1.0.Final\common\lib\jboss-servlet-api_3.0_spec.jar
 
Terry Flint
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just to add further confusion (sorry), a friend linked me to this video: http://www.youtube.com/watch?v=VzxLTGW2gqE and advised me to use 7.1.1.Final instead. Now I have jboss-as-7.1.1.Final downloaded and all the appropriate screens working. I was even able to make a management user on localhost:9990 this time, which is further than I got before. So, how would I adapt it for version 7.1.1.? I'm assuming the path you recommended for 6.1.0 wouldn't work anymore.
 
Terry Flint
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, this is what I keep getting if I try to run a JBoss project in Eclipse by going Run As > Run on server

"Server JBoss 7.1 Runtime Server failed to start."
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why 7.1.1? If you really want the latest you should be using Wildfly 8.0.0.Final: http://wildfly.org/downloads/

For 7.1.1, add this to the classpath: jboss-as-7.1.1.Final\modules\javax\servlet\api\main\jboss-servlet-api_3.0_spec-1.0.0.Final.jar
For 8.0.0, add this: wildfly-8.0.0.Final\modules\system\layers\base\javax\servlet\api\main\jboss-servlet-api_3.1_spec-1.0.0.Final.jar


Might I offer a suggestion? Use Eclipse only as an intelligent text editor. Do not depend on Eclipse to do anything else; thus to build, launch, deploy, run, etc. always use the command line. The problem is that if all the planets are in alignment and the stars in the correct quadrants, and the moon in the correct phase then everything within Eclipse works just fine, but otherwise everything and anything can go wrong. There are hundreds of posts in the forums where avoiding using Eclipse has resolved issues, here is a recent one: https://coderanch.com/t/631721/tools/Maven-shows-missing-artifact-error (Besides, displaying the final "failed to start" message without providing all of the console output details does nothing to help resolve the issue.)
 
Terry Flint
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I 'm currently not getting the server failed to start message anymore for some reason, but I'll be sure to record it if it happens again today, which I'm sure it will. Nevertheless, the most recent console output when I tried the Eclipse method was:




Also, in cue this is of any use, I've been trying out your wildly recommendation. I may not be keying in the class path entirely correctly. Maybe you can spot the problem from this image where I have all the relevant files open (I've temporarily moved them to the desktop for clarity's sake).
Here is the link: http://postimg.org/image/fkc9jvxr5/

 
Terry Flint
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also worth noting is that this is now happening every single time I open Eclipse. A pop-up window displays saying "Building workspace has encountered a problem. Errors occurred during the build". Clicking the details button will reveal this message:

 
Terry Flint
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The issue above has been resolved by the way, though I did have to resort to re-installing to get around it.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic