Help - How do I setup IntellijIdea for tomcat & JSP development?
Hi all,
I download the eval. version of IntellijIdea and am having trouble setting up the environment for JSP development with Tomcat and Apache.
I am currently using Studio one ce, with no problems, so my system setup should be ok. What do I need to do to resolve this?
Thanks
Frank
请先登录再写评论。
I just set up IntelliJ 3.0 myself yesterday and its a bit more confusing than it should be, but its also a lot more flexible and mirrors almost exactly your deployment environment. The real problem is that the IntelliJ instructions for this part just absolutely suck unless you already know what they mean... I had to pretty much figure them out on my own because the help was of no help. Not a good thing for a new user to have to experience.
Nevertheless, here are instructions that will have you running in no time.
1) Go into your project settings (right click on your project and select project settings - easiest way).
2) Click on the Web tab
3) Click the checkbox to enable Web application support
4) Click the add button to add a new web application
5) In the dialog box that pops up, give your web app a name (for your benefit - has no meaning to intellij) and then in the path to document root, choose the directory where your web application files live.
+
My web application lives in c:\projects\logger so that's what I put in here. I gave it a name of logger.
+
At this point your web application is set up and you will be able to compile JSPs and such, but I'm sure you want to run them right within IntelliJ.
6) Go to the run settings for your project
7) Press the plus to tell it you want to run/mount this web application
8) The drop down for web applications will already be defaulted to the web application you just created in your project settings, but since you can create more - just select the one you want to run in this drop down list. For my example I selected logger.
9) Don't worry about the application server, debugee host, and debugee port... the default settings are just fine.
10) Set the root directory of catalina (tomcat 4.0 - they really shouldn't assume that people know what catalina is... not all of us deal with the j2ee container itself). For my windows install I set this to:
C:\Program Files\Apache Tomcat 4.0
On my mac box it is set to
/usr/tomcat4.0.1/
When you set this up the setting for the conf files should automatically configure itself to:
C:\Program Files\Apache Tomcat 4.0\conf
11) Finally set the application context path (they should explain what this is and how its set). I did this by going into the server.xml for my tomcat install and added in a generic context path so my app could run on its own:
Remember this is added to the server.xml file. For my windows install this was in:
C:\Program Files\Apache Tomcat 4.0\conf\server.xml
You're done... go ahead and run your web application. You will get all sorts of useful debug information in the debug window.
Open up a browser and point it at your web application.
Since I have an index.jsp defined in the docroot I specified, I get that JSP running and life is good.
Lemme know if you get stuck somewhere. Hopefully the IntelliJ boys can refine their help section into the above series of steps so its not such an adventure to get JSP support up and running :)
As an additional reference, see the article "Web Application Development
with IntelliJ IDEA 3.0" (http://www.intellij.com/docs/WebApps.pdf).
Kendall
"Gregory Pierce" <gregorypierce@mac.com> wrote in message
news:190147.1041664821362.JavaMail.jrun@is.intellij.net...
than it should be, but its also a lot more flexible and mirrors almost
exactly your deployment environment. The real problem is that the IntelliJ
instructions for this part just absolutely suck unless you already know what
they mean... I had to pretty much figure them out on my own because the help
was of no help. Not a good thing for a new user to have to experience.
>
>
refine their help section into the above series of steps so its not such an
adventure to get JSP support up and running :)
That's a good reference as well, but all of this information belong in the help that comes with IntelliJ and show up when someone presses the help button while trying to configure a web application. The information that is there is woefully inadequate as web applications should be addressed as a whole (set them up, run them, debug them) and not simply as a component of whatever tool page you happen to be on.
I get this error when I try and run the project in IDEA.
I have tried just an empty index.jsp file with HTML statement, and still get this error.
Thanks for the help.
Frank
C:\j2sdk1.4.1_01\bin\javaw.exe -Djava.endorsed.dirs=C:\Program Files\Apache Group\Tomcat 4.1\bin;C:\Program Files\Apache Group\Tomcat 4.1\common\lib -Dcatalina.base=C:\Documents and Settings\Frank Rocco\.IntelliJIdea\system\tomcat_Myapp_fdb99d08 -Dcatalina.home=C:\Program Files\Apache Group\Tomcat 4.1 -Djava.io.tmpdir=C:\Program Files\Apache Group\Tomcat 4.1\temp -classpath C:\j2sdk1.4.1_01\lib\tools.jar;C:\Program Files\Apache Group\Tomcat 4.1\bin\bootstrap.jar;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\activation.jar;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\ant.jar;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\commons-collections.jar;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\commons-dbcp.jar;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\commons-logging-api.jar;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\commons-pool.jar;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\jasper-compiler.jar;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\jasper-runtime.jar;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\jdbc2_0-stdext.jar;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\jndi.jar;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\jta.jar;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\mail.jar;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\naming-common.jar;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\naming-factory.jar;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\naming-resources.jar;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\servlet.jar;C:\Program Files\Apache Group\Tomcat 4.1\common\lib\tools.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\catalina-ant.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\catalina.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\commons-beanutils.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\commons-digester.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\commons-logging.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\commons-modeler.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\jaas.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\jakarta-regexp-1.2.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\mx4j-jmx.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\servlets-common.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\servlets-default.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\servlets-invoker.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\servlets-manager.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\servlets-webdav.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\tomcat-coyote.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\tomcat-http11.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\tomcat-jk.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\tomcat-jk2.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\tomcat-util.jar;C:\Program Files\Apache Group\Tomcat 4.1\server\lib\tomcat-warp.jar org.apache.catalina.startup.Bootstrap start
org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException
at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:558)
at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:355)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:409)
at org.apache.commons.digester.Digester.]]>(Digester.java:345)
at org.apache.catalina.startup.Catalina.createStartDigester(Catalina.java:280)
at org.apache.catalina.startup.Catalina.start(Catalina.java:441)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
Caused by: java.lang.NullPointerException
at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:543)
... 12 more
Process terminated with exit code 0
Hi Frank,
Currently the Tomcat integration plugin only supports Tomcat 4.0.x. Main reason for this (I think) is that Tomcat 4.1.x does not allow jsp source-level debugging.
Try Tomcat 4.0.6.
Maas
Hi,
I am curious why Tomcat 4.1 does not allow JSP source level debugging. That seems like a step backwards.
Is this a "bug" or a "feature" of 4.1?
If it is a bug, I can see Intellij waiting for its resolution before supporting 4.1, but if it is a feature, I wonder what the plan is. Does anyone know what Intellij's position is on this issue? I imagine they have to support new versions of Tomcat at some point, and I was wondering if there was any public road map available.
Thanks,
I wonder if remote debugging with tomcat 4.1 is an option. Has anyone had any success with this approach?
Wow, I am talking to myself a lot today.
Anyway, I did some more poking around and found this very helpful thread:
http://www.intellij.net/forums/thread.jsp?forum=22&thread=18924&tstart=0&trange=15
which addresses all of my previous questions. Sorry for the wasted bandwidth.
Thanks, 4.0.6 seems to have resolved this.
I mainly want to develop jsp, jstl and servlets, do I need to install any plugin's for IDEA now?
Sorry for the dumb questions, but I am new to java,jsp, and am coming from a ASP web development background. (before getting hooked on java)
p.s.
I heard someone in my local bookstore talking and telling his friend that all the books on java will be gone soon as java is on it's way out. I wish I asked him why he said that. I can't believe that. What do you think?
Should I have started another thread for this question?
Regards,
Frank
See this document:
http://www.intellij.com/docs/WebApps.pdf
It should help you out.
Regarding p.s.
Yes, start another thread, but it probably not pertinate to any of the topics here at:
http://www.intellij.net/forums
But be careful because it could also be construed as flamebait.
Here's one survey (posted to Slashdot.org) that suggests that Java is doing OK:
http://www.bitbreather.com/programming_languages.html
I guess I won't start another thread, I do not want anyone getting the wrong idea. I just asked because I am just starting to learn jsp and was worried about what he said and that maybe .net was the cause.
To be honest, I am finding Java more of a challenge to learn, there are just so many ways to do things, like jstl or struts, soon java server faces...
I'm still running into other problems with IDEA.
Here is my latest error.
Best Regards,
Frank
C:\j2sdk1.4.1_01\bin\javaw.exe -Djava.endorsed.dirs=C:\Program Files\Apache Tomcat 4.0\bin;C:\Program Files\Apache Tomcat 4.0\common\lib -Dcatalina.base=C:\Documents and Settings\Frank Rocco\.IntelliJIdea\system\tomcat_Myapp_fdb99d08 -Dcatalina.home=C:\Program Files\Apache Tomcat 4.0 -Djava.io.tmpdir=C:\Program Files\Apache Tomcat 4.0\temp -classpath C:\j2sdk1.4.1_01\lib\tools.jar;C:\Program Files\Apache Tomcat 4.0\bin\bootstrap.jar;C:\Program Files\Apache Tomcat 4.0\common\lib\activation.jar;C:\Program Files\Apache Tomcat 4.0\common\lib\jdbc2_0-stdext.jar;C:\Program Files\Apache Tomcat 4.0\common\lib\jndi.jar;C:\Program Files\Apache Tomcat 4.0\common\lib\jta-spec1_0_1.jar;C:\Program Files\Apache Tomcat 4.0\common\lib\mail.jar;C:\Program Files\Apache Tomcat 4.0\common\lib\naming-common.jar;C:\Program Files\Apache Tomcat 4.0\common\lib\naming-resources.jar;C:\Program Files\Apache Tomcat 4.0\common\lib\servlet.jar;C:\Program Files\Apache Tomcat 4.0\common\lib\tools.jar;C:\Program Files\Apache Tomcat 4.0\common\lib\tyrex-0.9.7.0.jar;C:\Program Files\Apache Tomcat 4.0\common\lib\xerces.jar;C:\Program Files\Apache Tomcat 4.0\server\lib\catalina.jar;C:\Program Files\Apache Tomcat 4.0\server\lib\commons-logging.jar;C:\Program Files\Apache Tomcat 4.0\server\lib\jakarta-regexp-1.2.jar;C:\Program Files\Apache Tomcat 4.0\server\lib\servlets-common.jar;C:\Program Files\Apache Tomcat 4.0\server\lib\servlets-default.jar;C:\Program Files\Apache Tomcat 4.0\server\lib\servlets-invoker.jar;C:\Program Files\Apache Tomcat 4.0\server\lib\servlets-manager.jar;C:\Program Files\Apache Tomcat 4.0\server\lib\servlets-webdav.jar;C:\Program Files\Apache Tomcat 4.0\server\lib\tomcat-ajp.jar;C:\Program Files\Apache Tomcat 4.0\server\lib\tomcat-coyote.jar;C:\Program Files\Apache Tomcat 4.0\server\lib\tomcat-http11.jar;C:\Program Files\Apache Tomcat 4.0\server\lib\tomcat-util.jar;C:\Program Files\Apache Tomcat 4.0\server\lib\warp.jar;C:\Java;C:\j2sdk1.4.1_01\jre\lib\charsets.jar;C:\j2sdk1.4.1_01\jre\lib\jaws.jar;C:\j2sdk1.4.1_01\jre\lib\jce.jar;C:\j2sdk1.4.1_01\jre\lib\jsse.jar;C:\j2sdk1.4.1_01\jre\lib\rt.jar;C:\j2sdk1.4.1_01\jre\lib\sunrsasign.jar;C:\j2sdk1.4.1_01\jre\lib\ext\dnsns.jar;C:\j2sdk1.4.1_01\jre\lib\ext\ldapsec.jar;C:\j2sdk1.4.1_01\jre\lib\ext\localedata.jar;C:\j2sdk1.4.1_01\jre\lib\ext\mysql-connector-java-2.0.14-bin.jar;C:\j2sdk1.4.1_01\jre\lib\ext\sunjce_provider.jar org.apache.catalina.startup.Bootstrap start
Catalina.start: LifecycleException: null.open: java.net.BindException: Address already in use: JVM_Bind:8081
LifecycleException: null.open: java.net.BindException: Address already in use: JVM_Bind:8081
at org.apache.catalina.connector.http.HttpConnector.initialize(HttpConnector.java:1130)
at org.apache.catalina.core.StandardService.initialize(StandardService.java:454)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:553)
at org.apache.catalina.startup.Catalina.start(Catalina.java:780)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
-
Root Cause -
java.net.BindException: Address already in use: JVM_Bind:8081
at org.apache.catalina.connector.http.HttpConnector.open(HttpConnector.java:950)
at org.apache.catalina.connector.http.HttpConnector.initialize(HttpConnector.java:1128)
at org.apache.catalina.core.StandardService.initialize(StandardService.java:454)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:553)
at org.apache.catalina.startup.Catalina.start(Catalina.java:780)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
StandardServer.await: create[8005]: java.net.BindException: Address already in use: JVM_Bind
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:331)
at java.net.ServerSocket.bind(ServerSocket.java:309)
at java.net.ServerSocket.]]>(ServerSocket.java:183)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:276)
at org.apache.catalina.startup.Catalina.start(Catalina.java:794)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
Process terminated with exit code 1
Hi,
Looks like you're trying to start Tomcat while there's still is a Tomcat instance running.
Check the "4: Run" toolwindow and close all Tomcat processes that are still running.
Maas
Thansk, I'll try that.
Regards,
Frank
Yeah, you want to make sure that between runs you shutdown that instance of tomcat you have intellij starting, else tomcat will already be bound to the port when you starting your next run. Unless you're making code changes, there is no reason to run tomcat more than once as any JSP changes get picked up by tomcat automagically.