This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Setting up JBoss, IntelliJ, and Java EE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Setting up JBoss, IntelliJ, and Java EE" Watch "Setting up JBoss, IntelliJ, and Java EE" New topic
Author

Setting up JBoss, IntelliJ, and Java EE

Lynn Haley
Greenhorn

Joined: Jun 13, 2009
Posts: 20
Okay, maybe I should have asked for help first.
Im really confused.

I want to run code examples in IntelliJ.
All has been okay so far, but now that I am runnign code that uses Java EE, I have problems.
Cant find javax.servlet.jsp, for example.

I have downloaded JBoss, and the build.xml is referencing jars in JBoss, that I think should be including
the servlet info?

I ran this portion of the build.xml in Ant:



<target name="prepare">
<mkdir dir="${build.dir}"/>
<mkdir dir="${web.root}/WEB-INF/classes"/>
</target>

<path id="project.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
<include name="*.jar"/>
</fileset>
<fileset file="${servlet.jar}"/>
<fileset file="${jsp.jar}"/>
<fileset file="${j2ee.jar}"/>
<fileset file="${jboss.client.jar}"/>
<pathelement path="${build.dir}/classes"/>
</path>


Im so confused. I downloaded Java EE 5 - and put into the path as well.

Im running Vista. Not sure if this is the problem?

Im going to try rebooting, but if I can echo the %PATH% - IntelliJ should see it when I close/re-open? Ugh.




Still no luck.

Lynn
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2841
    
  11

Classpaths can be tricky especially for a beginner. Vista is terrible, but I don't see how we can blame it in this case. It's just a matter of getting everything set up.

It seems strange to me that you're looking for the javax.servlet.jsp package since that's rarely imported into source code. Are you sure that's right? Is there anyone in your team that's already set up this project on IntelliJ? If so, you should copy the setup and study it. If not, then you're stuck going through primers and tutorials to learn how to set up JBoss to work with IntelliJ. (Or just switch to Eclipse. )
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3817

You should provide more details on this. Where are you getting these errors? In compiling?


Are these variables pointing to those jars (servlet jar etc... )?

Lynn Haley wrote: Im so confused. I downloaded Java EE 5 - and put into the path as well.
Im going to try rebooting, but if I can echo the %PATH% - IntelliJ should see it when I close/re-open?


I don't think those are necessary. What matters is the system CLASSPATH or the path your build script looking for those jar files.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Lynn Haley
Greenhorn

Joined: Jun 13, 2009
Posts: 20
Thanks for the responses.

To clarify, I am running through an exercise from a class in which I have to use IntelliJ.
I am trying to setup the examples on my laptop running Vista.

Personally - I prefer Eclipse. Yeah, market share leader!

The example deals with the presentation tier, and involves using tags.
The import statements are:

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

Which are not being found. None of the EE items are being found.

I have modifed the classpath so that it has:

C:\Sun\SDK\bin;C:\sun\jdk6u10\bin

Am I missing something super easy?

I tried with the settings button on IntelliJ to see what it is pointing to, but
I dont see anything intuitive that just indicates where it is using the variables I am setting,
or any place else I might need to set them.

Any help is DEEPLY appreciated.

Lynn








Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3817

I have modifed the classpath so that it has:
C:\Sun\SDK\bin;C:\sun\jdk6u10\bin


That's not necessary. It has nothing to do with CLASSPATH but PATH.



Those are in JSP specification implementation jar file (jsp-api.jar for tomcat). Point your CLASSPATH to that jar also in order to compile.
Lynn Haley
Greenhorn

Joined: Jun 13, 2009
Posts: 20
I must have misread a previous post, my %PATH% and %CLASSPATH% both point to
C:\Sun\SDK\bin;C:\sun\jdk6u10\bin

Yes, the errors are during compilation.

I cannot find the jsp-api.jar that you specified.

I added C:\Sun\SDK\lib;C:\sun\jdk6u10\lib; to my %PATH% - hoping it would pick up what it needed from
the jars there, but no luck.

C:\Sun\SDK is what I downloaded for Java EE 5. Shouldn't it contain everything that I need?
I had to provide the directory of C:\sun\jdk6u10\lib for it to allow me to run the executable to setup Java EE 5, so I thought I was on the right path.

Sorry, pun intended.

Lynn

Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3817

Lynn Haley wrote:I cannot find the jsp-api.jar that you specified.


If you are using SUN's EE then you might have j2ee.jar inside the lib directory. That contains all you need. Just put the jar in the CLASSPATH not in the PATH. Remember, add the jar file with it's name to the CLASSPATH (C:/../j2ee.jar). Are you compiling from the command prompt or using a build script? If the latter then you have to add that jar in to the classpath id which you use to compile.
Lynn Haley
Greenhorn

Joined: Jun 13, 2009
Posts: 20
I'm sorry for being so dense, but I think you have me on the right track!!!

The classroom files I was given have a build.properties file which
is looking for jars in my jboss directory that dont exist.



Not sure if it is a version issue as I just downloaded the latest JBOSS last week.
I cannot find a javax.servlet.jar anywhere. I did find a jboss-javaee.jar
which I will try.

So, I guess I did not need to download Java EE 5, if I have already downloaded JBoss?

Thanks again! Hoping this works!

Lynn






Lynn Haley
Greenhorn

Joined: Jun 13, 2009
Posts: 20
OKAY - so as the subject stated, I was trying to get help with setting up JBOSS, IntelliJ and Java EE.

I have now been able to compile a sample application in IntelliJ - woot!

But now, I am stuck with launching JBoss from run.bat.

THE FIX for IntelliJ sample class being able to compile

The issue had been the build.properties file I was given pointed to a directory of
JBoss for jars that do not exist in the most recent version of JBoss.

Namely:



needed to be:






OKAY....so now my attempts at launchign JBoss from the command line

I think my issue is that JBoss and what I downloaded from Sun for Java EE 5 are not playing well together.

I am attempting to start JBoss by running c:\jboss\bin\run.bat

It shows:

JAVA_HOME is not set. Unexpected results may occur.
Set JAVA_HOME to the directory of your local JDK to avoid this message.
===============================================================================

JBoss Bootstrap Environment

JBOSS_HOME: c:\jboss

JAVA: java

JAVA_OPTS: -Dprogram.name=run.bat -Xms128m -Xmx512m -XX:MaxPermSize=256m -Dsun.rmi.dgc.client.gcIn
terval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000

CLASSPATH: ;c:\jboss\bin\run.jar


I dont understand why the CLASSPATH is not the same as what I have set in the environment variable.

I tried adding JAVA_HOME to point to c:\sun\jdk6u10
but then trying to use run.bat - nothing seems to happen, and I am just returned to the command prompt.

I dont want to be a bother to this list, or to Vijitha Kumara, who has provided much help, but I am not sure how to make this work at this time. I have tried Googling for how to setup JBoss to work when you use run.bat - with no apparent help.

Now, I would like to have a deeper understanding of how this all fits together. I believe I had to download the JEE 5 so that I can compile source which will be using JEE APIs and that JBOSS itself has already been compiled and I am just using it to support the servlet calls, etc that I am trying to make with my sample classes.

Please correct me if I am wrong, and if its just a matter of looking at a helpful website, kindly point me to it.

THANKS

Lynn
Lynn Haley
Greenhorn

Joined: Jun 13, 2009
Posts: 20
Here is the output, containing error messages related to not being able to bind - address in use.
(again, when i try to use JAVA_HOME, the run.bat seemingly fails to do anything)

Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18546
    
  40

java.net.BindException: Address already in use: JVM_Bind /127.0.0.1:8080
at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:504)
at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:176)
at org.apache.catalina.connector.Connector.initialize(Connector.java:1029)
at org.apache.catalina.core.StandardService.initialize(StandardService.java:679)


This error means that the application tried to bind a socket at a address -- likely a server socket -- and failed because some other application already had that address.

If this is happening consistently, I recommend that you look at the other services that you have running to look for a conflict. Or you can configure JBoss to use a different address.

If this is only happening during a "bounce", it could be that the previous jboss applications haven't been completely cleaned yet (given up all its resources). Waiting a minute before a restart may work.


BTW, the subject of this topic seemed to have completely changed... What does a socket bind error have to do with missing jar files?

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Lynn Haley
Greenhorn

Joined: Jun 13, 2009
Posts: 20
Thank you, Henry.

I was able to use netstat and see there are other services on :8080.
Not sure what these are, or how to troubleshoot that, so I would like to now change JBoss to use another port.

Are there any guides that have been put together on how to troubleshoot this stuff?
Im usually pretty good at finding the answers through Google, but so far, have only advanced my
cause through the forum, and thankful for it!

The original subject is still the same: Setting up JBoss, IntelliJ, and Java EE

It seems the last thing will be to get JBoss to launch without errors, and I will be able
to breathe a sigh of relief.

Lynn

Lynn Haley
Greenhorn

Joined: Jun 13, 2009
Posts: 20


Was able to find some reference to changing this in the jar file.
http://lkamal.blogspot.com/2006/09/jboss-4-how-to-change-port-8080-in.html

I changed it here:
C:\jboss\server\default\deploy\http-invoker.sar\META-INF\jboss-service.xml
and
here:
C:\jboss\server\default\deploy\jbossweb.sar\server.xml


Less, errors, feeling less stressed.
Is anyone ever able to get this going straight from the download?

Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3817

Seems it's still not working? Haven't you set the JAVA_HOME (environment variable) to your JDK installation yet?

Lynn Haley wrote: So, I guess I did not need to download Java EE 5, if I have already downloaded JBoss?


No, You don't need to. But you have to find the correct jar(s) in JBOSS which your CLASSPATH should be pointing to for the compilation to succeed.
Lynn Haley
Greenhorn

Joined: Jun 13, 2009
Posts: 20
Hi Vijitha,

As I wrote above (I know super long post now) I put JAVA_HOME in as an env variable, pointing to my SDK, and when I tried to use jboss's run.bat - nothing happened. Removing JAVA_HOME made it work again.

I am so frustrated. I'm not an idiot, and I am not lazy, but so far my efforts in searching for a good how-to / troubleshooting guide in setting up my environment have been fruitless.

Any help is appreciated.

Lynn
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3817

Lynn Haley wrote:I put JAVA_HOME in as an env variable, pointing to my SDK, and when I tried to use jboss's run.bat - nothing happened.


How did you run it ? Double clicking ? or from command prompt ? I faced some weird behavior when running bat (mysqld) by double clicking. If you haven't tried the latter just try it, as you are saying nothing happen. I'm running out of suggestions here .


Lynn Haley
Greenhorn

Joined: Jun 13, 2009
Posts: 20
i tried both by double-clicking it, and also at the command prompt.

Yeah, frustrating!
 
Consider Paul's rocket mass heater.
 
subject: Setting up JBoss, IntelliJ, and Java EE
 
Similar Threads
Build failed- ejb3.deployer not found
JIBX - ant script for jar.
${env.JBOSS_HOME}\client not found.
Ant Build Failing -- Need a way to pick jar file during run time.
Spring : DefaultAnnotationHandlerMapping not mapping URL using annotation