[ANN] Jetty Integration Plug-in

Jetty Integration Plug-in version 0.1.0 is available for download using
IDEA's internal Plugin Manager or directly from the IDEA plug-ins
website at http://plugins.intellij.net/plugin/?id=1311.

The plug-in requires IDEA 6.0 (i.e. build 5766) or newer and supports
Jetty 6.1.0 or newer (see below for an explanation of this requirement).
The IDEA 'until' build number has been set to 6999 as (minimal) testing
with Selena build 6667 revealed no problems.

The plug-in is released under the terms of version 2.0 of the Apache
licence and source code is both included with the binary distribution
and available separately via the IDEA plug-ins website.

Users who have configured IDEA to use Tomcat for web application
deployment should have no trouble following the same process to use Jetty.

1. IDE Settings -> Application Servers

Use the Add button to open the Jetty Server dialog and browse to the
Jetty installation location. The dialog will indicate the Jetty version
detected and prevent unsupported versions from being selected.

A minimal set of libraries from the Jetty installation is attached to
the application server definition but IDEA allows this to be freely
edited. This may be configurable at application server definition time
in future releases.

2. Run -> Edit Configurations... (or use the toolbar dropdown control)

The Run/Debug Configurations dialog allows local and remote Jetty Server
configurations to be created.

Jetty 6.1.0 or newer is required since hot (un)deployment of web
contexts is not supported in earlier versions. However, the plug-in
does not yet make use of this feature, so a web module war file or
exploded directory must be built and deployed prior to using an IDEA
Run/Debug configuration to launch Jetty.

The suggested way to work for now is to use the Java EE Build Settings
tab (on the Project Structure dialog) for the web modules you'd like to
deploy to create a war file or exploded directory directly in Jetty's
'webapps' directory (i.e. in $/webapps). Hotswap will work
while debugging but hot deployment/undeployment will not. The node
shown on the Debug toolwindow's Console tab for each web module will
currently always indicate its status as 'unknown' (i.e. will show the
icon containing a question mark).

The plug-in includes platform-specific scripts for starting and stopping
Jetty. Unfortunately, the Jetbrains plug-in manager has undone work to
preserve the execute bit on the Unix/Linux shell script in the uploaded
zip archive. Users on Unix(-like) systems should manually set the
execute bit on:

${idea.plugins.path}/JettyIntegration/bin/jetty.sh

If the execute bit is not set then launching a run or debug
configuration will result in IDEA reporting an error.

I'm only personally able to test on GNU/Linux (my preference, and the
plug-in's development platform) and XP. My knowledge of DOS batch files
is extremely limited so the jetty.bat file included with the plug-in can
most probably be improved (although it seems to work just fine). I'd be
very grateful for feedback from any Mac users who try the plug-in as to
whether or not the jetty.sh script works for them.

Feedback and feature requests are welcome and encouraged, either in this
newsgroup/forum or via email (to the address in my sig or in the plug-in
details).

Already planned for future releases:

- support for hot deployment/undeployment;
- shared use of a (possibly read-only) Jetty installation amongst
multiple developers.

More ambitious possibilities include a UI to support generation/editing
of Jetty's configuration files (jetty.xml etc.), along the lines of
IDEA's existing UI for web.xml.

--
Mark Scott
mark@codebrewer.com

36 comments
Comment actions Permalink

Jetty Integration Plug-in version 0.1.1 is available for download using
IDEA's internal Plugin Manager or directly from the IDEA plug-ins
website at http://plugins.intellij.net/plugin/?id=1311.

This release includes some bugfixes but no new functionality.

Fixed: plugins.intellij.net shows no plug-in description.
Fixed: jetty.bat fails when Jetty and IDEA are installed on different
Windows drives.
Fixed: jetty.sh is not executable after plug-in installation.

--
Mark Scott
mark@codebrewer.com

0
Comment actions Permalink

Jetty Integration Plug-in version 0.2.0 is available for download using
IDEA's internal Plugin Manager or directly from the IDEA plug-ins
website at http://plugins.intellij.net/plugin/?id=1311.

This release includes one new feature and a couple of minor changes that
will interest only those who want access to the plug-in's source code or
to open it as an IDEA project.


New: Permit Jetty's configuration files to be specified.

Jetty's runtime configuration is, by default, controlled by the
configuration file $/etc/jetty.xml. However, an arbitrary set of configuration files can be explicitly specified instead, and Jetty will process them in order. The Jetty application server configuration UI now contains a list for configuration files, and buttons for modifying the list. When a new definition is created then all valid configuration files found in $/etc are added to the list and marked active (this blanket
approach could probably be refined, or a better initial order and/or
active state defined).

When a Jetty run or debug configuration is launched then the files
marked active for the chosen application server configuration are used
to configure Jetty (the order is from the top to the bottom of the list).

Associating the configuration files with the run/debug configuration
instead arguably makes just as much (or perhaps more) sense but proved
to be difficult (inasmuch as it doesn't seem possible to listen for
changes to the selected appserver in a run/debug configuration).

The current implementation would allow, for example, different Jetty
application server configurations to be specified:

"Vanilla Jetty" :

- no active config files or just jetty.xml active

"Jetty with JAAS" :

- jetty.xml
- jetty-jaas.xml

"Jetty with JMX, JAAS and SSL" :

- jetty-jmx.xml
- jetty.xml
- jetty-jaas.xml
- jetty-ssl.xml


Fixed: plugins.intellij.net makes bundling source code with a binary
distribution unnecessary.

The website provides a specific link for downloading the latest source
code for a particular plug-in so the source archive has been removed
from the binary. Consequently, each release of the plug-in is smaller
than its predecessor - who says new features == bloat? :)


Fixed: IDEA project files are not included in source code archive.

.ipr and .iml files (created in IDEA 6.0.4) are now included (and should
presumably be opened in a devkit-enabled IDEA). The plug-in uses the
(excellent) Copyright plug-in so expect changes to the project files if
it's not installed.


Feedback welcome!

--
Mark Scott
mark@codebrewer.com

0
Comment actions Permalink

Mark, any plans to update this for the latest Selena EAPs?

0
Comment actions Permalink

Hi Hani,

Hani Suleiman wrote:

Mark, any plans to update this for the latest Selena EAPs?


Apologies. I really should get around to that, especially since I got
hot (un)deployment of contexts working a while back.

Are you getting a NoClassDefFoundError? With some mild hacking it
should actually work OK with the latest builds. See
<http://www.intellij.net/forums/thread.jspa?messageID=5190964> and my reply.

--
Mark Scott
mark@codebrewer.com

0
Comment actions Permalink

I havent tried it. I think the issue will be a bit more than just adding the dependency, as the J2eeModuleProperties class has gone away, and is now replaced with the Facet classes, so some refactoring is needed before it'd work again.

0
Comment actions Permalink

Hani Suleiman wrote:

I havent tried it. I think the issue will be a bit more than just
adding the dependency, as the J2eeModuleProperties class has gone
away, and is now replaced with the Facet classes, so some refactoring
is needed before it'd work again.


Ah, OK, I hadn't realised that. Lame excuse: I'm not using IDEA's web
support at the moment so the significance of that particular change had
passed me by. I'll try to get to it soon. Thanks for the pointer.

--
Mark Scott
mark@codebrewer.com

0
Comment actions Permalink

Jetty Integration Plug-in version 0.3.0 is available for download using
IDEA's internal Plugin Manager or directly from the IDEA plug-ins website
at http://plugins.intellij.net/plugin/?id=1311.

This release of the plug-in has been built for IDEA 6.0 (build 5766 or
newer) and IDEA 7.0 (Milestone 2, build 7126, or newer), and includes one
new feature:

New: Support hot deployment of web contexts.

Hot deployment currently expects a Jetty server with an ID of "Server" to
be specified in an active Jetty configuration file - such an ID exists in
Jetty's default jetty.xml file. Future plug-in releases may parse the
active configuration file and be able to deal with a non-default ID.

Source code is now once again included in the binary distribution since
the plug-in repository doesn't permit more than one source archive to be
made available (and seems generally broken with respect to source archive
updates anyway).

--
Mark Scott
mark@codebrewer.com

0
Comment actions Permalink

Excellent! Sadly though I get an error (with a clean jetty dir, nothing deployed except for a datasoure and modified web port to 8000):

2007-08-19 19:48:45.594::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
2007-08-19 19:48:46.823::WARN: Config error at 2007-08-19 19:48:46.824::WARN: Config error at /webapps-plusfalsetruefalse/etc/webdefault.xml ]]>
2007-08-19 19:48:46.824::WARN: EXCEPTION
java.lang.IllegalStateException: No object for id=Contexts
at org.mortbay.xml.XmlConfiguration.refObj(XmlConfiguration.java:634)
at org.mortbay.xml.XmlConfiguration.itemValue(XmlConfiguration.java:907)
at org.mortbay.xml.XmlConfiguration.value(XmlConfiguration.java:828)
at org.mortbay.xml.XmlConfiguration.set(XmlConfiguration.java:275)

0
Comment actions Permalink

On Mon, 20 Aug 2007 03:50:01 +0000, Hani Suleiman wrote:

Excellent! Sadly though I get an error (with a clean jetty dir, nothing deployed except for a datasoure and modified web port to 8000):

2007-08-19 19:48:45.594::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
2007-08-19 19:48:46.823::WARN: Config error at <Set name="contexts"><Ref id="Contexts"/></Set>
2007-08-19 19:48:46.824::WARN: Config error at <Call name="addLifeCycle"><Arg>
<New ><Set name="contexts"><Ref id="Contexts"/></Set><Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/webapps-plus</Set><Set name="parentLoaderPriority">false</Set><Set name="extract">true</Set><Set name="allowDuplicates">false</Set><Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set><Set name="configurationClasses"><Ref id="plusConfig"/></Set></New>
</Arg></Call>
2007-08-19 19:48:46.824::WARN: EXCEPTION
java.lang.IllegalStateException: No object for id=Contexts
at org.mortbay.xml.XmlConfiguration.refObj(XmlConfiguration.java:634)
at org.mortbay.xml.XmlConfiguration.itemValue(XmlConfiguration.java:907)
at org.mortbay.xml.XmlConfiguration.value(XmlConfiguration.java:828)
at org.mortbay.xml.XmlConfiguration.set(XmlConfiguration.java:275)


Hmm... I'm struggling to think how the plug-in could be causing this.
The config file snippets in the warning message aren't generated by the
plug-in. Does Jetty run correctly if you launch it with the same config
outside IDEA?

Which config files have you edited (jetty.xml, presumably), and which have
you got marked active in the appserver configuration (jetty.xml &
jetty-plus.xml?)?

Is there still a ContextHandlerCollection with the ID "Contexts" created
somewhere (I should have mentioned the plug-in depends on that fact too,
but I don't think you've reached that point yet).

--
Mark Scott
mark@codebrewer.com

0
Comment actions Permalink

Hello !
1. On windows in .bat file the path to java exacutable should be quoted in
double quotes.
Because in my case the JAVA_HOME contains spaces.

2. Also what i should do to not put into jetty launch command context
deployer generated by plugin ?
in my case i only need to run my jetty from it\'s home directory that is
already configured.
And because .bat script adding another jetty config it breaks the command
line and jetty can not be run.

--
Best Regards
Evgeny K. Shepelyuk

0
Comment actions Permalink

Hello Evgeny,

Evgeny Shepelyuk wrote:

Hello !
1. On windows in .bat file the path to java exacutable should be quoted
in double quotes.
Because in my case the JAVA_HOME contains spaces.


OK, I can fix that. I guess you edited the idea.bat file as a workaround?

2. Also what i should do to not put into jetty launch command context
deployer generated by plugin ?


That's not a use case I considered. I can make it optional (in the same
way as, say, the Tomcat integration makes deployment of the Tomcat
Manager webapp optional) but is it really necessary to do this?

in my case i only need to run my jetty from it\'s home directory that is
already configured.
And because .bat script adding another jetty config it breaks the
command line and jetty can not be run.


Can you tell me how the command line is broken? What happens when you
launch a run or debug configuration?

Is one of the following true?

1. you have IDEA configured to build your web modules/facets in the
$/webapps directory; or

2. you have Jetty configured to statically load your web modules/facets
from wherever IDEA builds them; or

3. you don't deploy any IDEA web modules/facets to Jetty?

I can see how the new support for hot deployment breaks in situations 1
and 2 - you'll get each web module/facet deployed twice. If this is the
case then isn't the best solution to change the static configuration and
let the hot deployment take its place?

Maybe there's another case I haven't considered?

If you do want to remove the hot deployment descriptor file that's added
then you can do so by editing the plug-in's idea.bat file and modifying
the JETTY_OPTS environment variable that's passed to Jetty on startup.
The variable has the following form on startup (all on one line, sorry
for the line-wrapping) :

-DSTOP.PORT=0 -jar start.jar $ ... $
${idea.system.path}/jetty_$/context-deployer.xml

where config files 1 to N are the active files in the appserver
configuration. You would check for the string starting with
-DSTOP.PORT=0 and remove everything after the final space character
(i.e. the full path to the context-deployer.xml file).

The check for -DSTOP.PORT=0 is necessary because the same batch file is
also used to stop Jetty (with a different value for JETTY_OPTS). I've
no idea how easy this would be in a DOS batch file though.

--
Mark Scott
mark@codebrewer.com

0
Comment actions Permalink

Hello Mark !

Evgeny Shepelyuk wrote:

>> Hello
>> 1. On windows in .bat file the path to java exacutable should be quoted
>> in double quotes.
>> Because in my case the JAVA_HOME contains spaces.
>

OK, I can fix that. I guess you edited the idea.bat file as a
workaround?

Yes exactly :)

>> 2. Also what i should do to not put into jetty launch command context
>> deployer generated by plugin ?
>

Can you tell me how the command line is broken? What happens when you
launch a run or debug configuration?



"D:\java\j2sdk 1.5\bin\java.exe" -DSTOP.PORT=0 -jar start.jar
D:\java\tools\jetty-6.1.5\etc\jetty.xml C:\Documents and
Settings\jk\.IntelliJIdea70\system\jetty_test586f7da012\context-deployer.xml

And java is unable to execute this

-DSTOP.PORT=0 -jar start.jar $ ... $
${idea.system.path}/jetty_$/context-deployer.xml


i think only thing that is needed is to fix my problem is to quote every
CONFIG_FILE_N and plugin's context-deployer.xml in double quotes :)

And another issue apearing

2007-08-20 17:49:50.509::WARN: Config error at C:\Documents and Settings\jk\.IntelliJIdea70\system\jetty_test586f7da012\c ontexts1 ]]>
2007-08-20 17:49:50.509::WARN: EXCEPTION
java.lang.IllegalStateException: No object for id=Contexts
at
org.mortbay.xml.XmlConfiguration.refObj(XmlConfiguration.java:634)
at
org.mortbay.xml.XmlConfiguration.itemValue(XmlConfiguration.java:907)
at
org.mortbay.xml.XmlConfiguration.value(XmlConfiguration.java:828)
at org.mortbay.xml.XmlConfiguration.set(XmlConfiguration.java:275)
at
org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:237)
at
org.mortbay.xml.XmlConfiguration.newObj(XmlConfiguration.java:615)
at
org.mortbay.xml.XmlConfiguration.itemValue(XmlConfiguration.java:906)
at
org.mortbay.xml.XmlConfiguration.value(XmlConfiguration.java:828)
at org.mortbay.xml.XmlConfiguration.call(XmlConfiguration.java:512)
at
org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:241)
at
org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:203)
at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:937)
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:585)
at org.mortbay.start.Main.invokeMain(Main.java:183)
at org.mortbay.start.Main.start(Main.java:497)
at org.mortbay.start.Main.main(Main.java:115)
2007-08-20 17:49:50.509::INFO: Shutdown hook executing
2007-08-20 17:49:50.524::INFO: Shutdown hook complete
--
Best Regards
Evgeny K. Shepelyuk

0
Comment actions Permalink

Hello Evgeny,

Evgeny Shepelyuk wrote:

i think only thing that is needed is to fix my problem is to quote every
CONFIG_FILE_N and plugin's context-deployer.xml in double quotes :)


Spaces in filenames! :')

And another issue apearing

2007-08-20 17:49:50.509::WARN: Config error at <Call
name="addLifeCycle"><Arg>
<New ><Set
name="contexts">
<Ref id="Contexts"/>
</Set><Set name="configurationDir">C:\Documents and
Settings\jk\.IntelliJIdea70\system\jetty_test586f7da012\c
ontexts</Set><Set name="scanInterval">1</Set></New>
</Arg></Call>
2007-08-20 17:49:50.509::WARN: EXCEPTION
java.lang.IllegalStateException: No object for id=Contexts


Not quite the same as the exception reported by Hani. In your case the
XML fragment is generated by the plug-in, and it seems that Jetty's
reading the context-deployer.xml file it even though its path contains a
space? I'll do some testing on Windows and see if I can reproduce the
problem. Maybe the default jetty.xml has changed recently - I see you
have 6.1.5 whereas I'm using 6.1.3.

--
Mark Scott
mark@codebrewer.com

0
Comment actions Permalink

Hmm! The error looks the same to me! It's unable to find Contexts, for one reason or another.

Should I be adding all the config files (what the plugin does by default), am I missing any, should I exclude any?

0
Comment actions Permalink

Hani Suleiman wrote:

Hmm! The error looks the same to me! It's unable to find Contexts, for one reason or another.


Yeah, you're right, the stacktraces are the same. What I was getting at
is that the XML fragments giving rise to the exceptions are different.
In your case it's a fragment from jetty-plus.xml, in Evgeny's case it's
a fragment from the file generated dynamically by the plug-in.

Should I be adding all the config files (what the plugin does by default), am I missing any, should I exclude any?


Ah, I think you've identified the problem.

The list of Jetty config files in the appserver config dialog serves two
purposes:

- files marked as active are passed to Jetty on its commandline (via
the JETTY_OPTS environment variable);

- files are passed in the order given in the list, topmost first.

So I think the problem you're seeing is that jetty-plus.xml precedes
jetty.xml and the element having id Contexts is referenced from the
former before Jetty processes the latter.

I think you should re-order the config files so that jetty.xml is at the
top of the list and also de-activate any config files you don't need. I
don't know where you defined your datasource - looks like jetty-plus.xml
may be intended for that? Make whichever file it is active as well if
it's not jetty.xml. Please let me know if that fixes things.

I think the plug-in should continue to list every valid config file it
finds in Jetty's etc directorty but it should put jetty.xml at the top
and probably make only that file active - I think that would cover most
users' needs.

I knew I should have written some help doc...

Sorry for the inconvenience.

--
Mark Scott
mark@codebrewer.com

0
Comment actions Permalink

20.08.07 ? 19:45 Mark Scott ? ????? ?????? ?????(?):

Hello Evgeny,

>

Evgeny Shepelyuk wrote:

>
>> i think only thing that is needed is to fix my problem is to quote
>> every CONFIG_FILE_N and plugin's context-deployer.xml in double quotes
>> :)
>

Spaces in filenames! :')

>
>> And another issue apearing
>> 2007-08-20 17:49:50.509::WARN: Config error at > name="addLifeCycle"> >> > name="contexts"> >> >> C:\Documents and >> Settings\jk\.IntelliJIdea70\system\jetty_test586f7da012\c >> ontexts1 >> >> 2007-08-20 17:49:50.509::WARN: EXCEPTION >> java.lang.IllegalStateException: No object for id=Contexts >]]>

Not quite the same as the exception reported by Hani. In your case the
XML fragment is generated by the plug-in, and it seems that Jetty's
reading the context-deployer.xml file it even though its path contains a
space? I'll do some testing on Windows and see if I can reproduce the
problem. Maybe the default jetty.xml has changed recently - I see you
have 6.1.5 whereas I'm using 6.1.3.

>

Nope that exception is occuring when i run the jetty manually
From idea with origina; scritp jetty never starts
I've just copied execution cmd, fixed it and than excecuted in shell.

--
Best Regards
Evgeny K. Shepelyuk

0
Comment actions Permalink

Great, messing with the config files fixed it. While fiddling about with them though, I did get this error once:

java.lang.NumberFormatException: For input string: "Disconnected from server"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:447)
at java.lang.Integer.parseInt(Integer.java:497)
at org.codebrewer.idea.jetty.JettyServerInstance$2.onTextAvailable(JettyServerInstance.java:96)
at sun.reflect.GeneratedMethodAccessor185.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.execution.process.ProcessHandler$5.invoke(ProcessHandler.java:197)
at $Proxy88.onTextAvailable(Unknown Source)
at com.intellij.execution.process.ProcessHandler.notifyTextAvailable(ProcessHandler.java:158)
at

Also,shouldn't the default be to load the files in whatever order jetty does, and to only enable those included by jetty's default start.jar? Since people who are passing in extra config files are changing the default behaviour ,and so will know to do so in the plugin. As a new user though if I just download jetty, I should get the same behaviour from the plugin as I do from command line.

0
Comment actions Permalink

Pardon my ignorance, but how exactly does one go about setting up a hot deployment using the Web facet in IDEA 7.0M2? I was thinking to tell my module to compile files into WEB-INF/classes and write a custom jetty.xml, bypassing the whole facet deployment altogether. That strikes me as a kludgy way of doing this. Under the facet deployment configuration, however, all I see are WAR and exploded directory -- neither of which appear to afford me hot deployment.

Any guidance on this would be much appreciated.

Thanks,
Kevin

0
Comment actions Permalink

Hani Suleiman wrote:

I did get this error once:

java.lang.NumberFormatException: For input string: "Disconnected from server"


Thanks for reporting. The plug-in's Jetty startup detection could
clearly be more robust - I'll fix this.

Also,shouldn't the default be to load the files in whatever order
jetty does, and to only enable those included by jetty's default
start.jar?


Yeah, I agree - I made effectively that point in another post when I
said the default should be to mark only jetty.xml as active.

Since people who are passing in extra config files are
changing the default behaviour ,and so will know to do so in the
plugin. As a new user though if I just download jetty, I should get
the same behaviour from the plugin as I do from command line.


Agreed.

--
Mark Scott
mark@codebrewer.com

0
Comment actions Permalink

Hi Kevin,

Kevin Menard wrote:

Pardon my ignorance, but how exactly does one go about setting up a
hot deployment using the Web facet in IDEA 7.0M2? I was thinking to
tell my module to compile files into WEB-INF/classes and write a
custom jetty.xml, bypassing the whole facet deployment altogether.
That strikes me as a kludgy way of doing this. Under the facet
deployment configuration, however, all I see are WAR and exploded
directory -- neither of which appear to afford me hot deployment.


The short answer is that the plug-in will take care of it for you - it
doesn't matter whether you choose a war file or an exploded directory.

The plug-in's support for hot deployment does currently depend on a
couple of things though.

If you look in the jetty.xml file that ships with Jetty you'll see that
the root element has an id of "Server" and that, further down the file,
a set of handlers is configured, one of which has an id of "Contexts".

The plug-in assumes that these two facts hold (maybe in future the
config files will be parsed) and dynamically creates a config file
referring to these IDs that it passes to Jetty (in addition to those
you've marked as active in the appserver config).

This 'extra' config file sets up a Jetty ContextDeployer instance that
monitors a particular directory for the addition and removal of
individual context deployment descriptor files. When a facet is
deployed the plug-in creates a descriptor file for it in the monitored
directory, Jetty notices this and deploys the context. When a facet is
undeployed the plug-in removes the descriptor file and Jetty removes the
context.

If you look in your IDEA installation's system directory after launching
a local Jetty run/debug configuration you should see a directory with a
name that starts "jetty_" and ends with your project name and a hash.
Inside that directory is the file that configures the ContextDeployer
and a directory that holds individual context deployment descriptors.

For instance, here's what I have after launching a debug session that
deploys two web facets (tree command run in IDEA's system dir):

$ tree jetty_PluginSandboxProject16c1c3f7d/
jetty_PluginSandboxProject16c1c3f7d/
|-- context-deployer.xml
`-- contexts
|-- Web1.xml
`-- Web2.xml

1 directory, 3 files

context-deployer.xml adds the ContextDeployer that scans the 'contexts'
directory once a second for (changes to) individual context descriptors.

In this case Web1.xml points at an exploded directory and Web2.xml
points at a war file.

The jetty_... directory is deleted when IDEA exits.

HTH,

--
Mark Scott
mark@codebrewer.com

0
Comment actions Permalink

Okay, I see now. It actually works quite nice.

Now this is going to start going OT, but I'm relatively new to IDEA. Is there anyway to set things up to auto-compile on save or can I configure the plugin to load up out of the source directory? While it could be my eclipse background, it seems unnatural to have to compile when I make an HTML change.

0
Comment actions Permalink

I also get the same error as Hani Suleiman.

On keping only jetty.xml (and jetty-plus.xml) active, I get the following error on both Jetty 6.1.5 and Jett 6.1.3:

cmd /c "C:\Documents and Settings\Ayush\.IntelliJIdea60\config\plugins\JettyIntegration\bin\jetty.bat"
1789
-DSTOP.KEY=axjv0lwc8mps
2007-08-27 20:57:23.921::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
2007-08-27 20:57:24.031::INFO: Statistics on = false for SelectChannelConnector @ 0.0.0.0:8080
2007-08-27 20:57:24.078::WARN: EXCEPTION
java.io.FileNotFoundException: C:\Documents (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:106) at java.io.FileInputStream.(FileInputStream.java:66) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:973) at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:184) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:798) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242) at javax.xml.parsers.SAXParser.parse(SAXParser.java:375) at org.mortbay.xml.XmlParser.parse(XmlParser.java:188) at org.mortbay.xml.XmlParser.parse(XmlParser.java:204) at org.mortbay.xml.XmlConfiguration.]]>(XmlConfiguration.java:100)
at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:916)
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:585)
at org.mortbay.start.Main.invokeMain(Main.java:183)
at org.mortbay.start.Main.start(Main.java:497)
at org.mortbay.start.Main.main(Main.java:115)
2007-08-27 20:57:24.078::INFO: Shutdown hook executing
2007-08-27 20:57:24.078::INFO: Shutdown hook complete

@Mark: Any thoughts on what could be going on?

@Hani: What did you change in your config files to make this work?

Thanks

- ayush

0
Comment actions Permalink

I'm a first-time user of the "Jetty integration" plugin, but there's a bug in wherever the "JETTY_OPTS" environment variable is set. (Previous posts talk about this as well.) As you can see in your error, evrything is run through the .bat file in your "documents and settings" folder. (Note the spaces in the path, I'll get back to that later)

I added the following row:
echo %JETTY_OPTS%
to the beginning of the file, and, and this is what my %JETTY_OPTS% contains:


-DSTOP.PORT=0 -jar start.jar C:\Program\jetty-6.1.5\etc\jetty.xml C:\Documents and Settings\USER\.IntelliJIdea60\system\jetty_7457e5bc7\context-deployer.xml

Note that later on in the .bat file, java.exe is called with the %JETTY_OPTS% parameters, resulting in a call like this:

c:\pathtojava\bin\java.exe -DSTOP.PORT=0 -jar start.jar C:\Program\jetty-6.1.5\etc\jetty.xml C:\Documents and Settings\AADAAH\.IntelliJIdea60\system\jetty_735ae5cc7\context-deployer.xml

To me it's pretty obvious that this will never work, since the path to the context-deployer.xml needs to be quoted, because the "documents and settings" path contains spaces. Obviously the same goes for the java.exe path, and the jetty.xml path.

Reading through this thread, I get the feeling that Mark is aware of this problem, but for now I really don't know how to get past it. Anyone got any ideas?
/David

0
Comment actions Permalink

This also a problem if the project name contains spaces.

0
Comment actions Permalink

Hi Mark,

I just ran into another issue with the plugin. The UI for the run configuration seems to be too large. It causes the "Before Launch" group to be pushed beyond the client area, making several options inaccessible.

I've attached a screenshot showing the problem. Apologies for the TIFF format. It seems to be all that Apple's "Grab" utility will produce.



Attachment(s):
Clipping Issue.tiff
0
Comment actions Permalink

I have the same problem.

I used 6.0.5 Intellij and 6.1.5 Jetty.

I believe that the plugin would not be able to find the context-deployer.xml file. The reason could be long path or missing quote (") since the word Document is part of the path to the context-deployer file.

Mark please help.

0
Comment actions Permalink

Hi Mark,

I get the same error with Hani Suleiman. I'm using IJ 7.0.1 release; my jetty version is 6.1.5

I've just downloaded plugin, restarted my idea and configured a basic hello world application for jetty.

I've tried to use plugin and got following error in the console:

cmd /c "C:\Documents and Settings\Isa Goksu\.IntelliJIdea70\config\plugins\JettyIntegration\bin\jetty.bat"
4664
-DSTOP.KEY=1k6tgyize3da8
2007-11-01 10:56:03.153::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
2007-11-01 10:56:03.403::WARN: Config error at 2007-11-01 10:56:03.403::WARN: Config error at /webapps-plusfalsetruefalse/etc/webdefault.xml 2007-11-01 10:56:03.403::WARN: EXCEPTION java.lang.IllegalStateException: No object for id=Contexts at org.mortbay.xml.XmlConfiguration.refObj(XmlConfiguration.java:634) at org.mortbay.xml.XmlConfiguration.itemValue(XmlConfiguration.java:907) at org.mortbay.xml.XmlConfiguration.value(XmlConfiguration.java:828) at org.mortbay.xml.XmlConfiguration.set(XmlConfiguration.java:275) at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:237) at org.mortbay.xml.XmlConfiguration.newObj(XmlConfiguration.java:615) at org.mortbay.xml.XmlConfiguration.itemValue(XmlConfiguration.java:906) at org.mortbay.xml.XmlConfiguration.value(XmlConfiguration.java:828) at org.mortbay.xml.XmlConfiguration.call(XmlConfiguration.java:512) at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:241) at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:203) at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:937) 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:585) at org.mortbay.start.Main.invokeMain(Main.java:183) at org.mortbay.start.Main.start(Main.java:497) at org.mortbay.start.Main.main(Main.java:115) Disconnected from server When I try second times, it gives another error to the console like; cmd /c "C:\Documents and Settings\Isa Goksu\.IntelliJIdea70\config\plugins\JettyIntegration\bin\jetty.bat" java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:507) at java.net.Socket.connect(Socket.java:457) at java.net.Socket.(Socket.java:365) at java.net.Socket.]]>(Socket.java:207)
at org.mortbay.start.Main.stop(Main.java:526)
at org.mortbay.start.Main.main(Main.java:104)
Disconnected from server

And after this error my idea gets an error like:

Original exception: String index out of range: -1
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1938)
at org.codebrewer.idea.jetty.JettyServerInstance$2.onTextAvailable(JettyServerInstance.java:96)
at sun.reflect.GeneratedMethodAccessor32.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.execution.process.ProcessHandler$5.invoke(ProcessHandler.java:197)
at $Proxy69.onTextAvailable(Unknown Source)
at com.intellij.execution.process.ProcessHandler.notifyTextAvailable(ProcessHandler.java:158)
at com.intellij.javaee.run.execution.J2EEProcessHandlerHelper.onTerminated(J2EEProcessHandlerHelper.java:273)
at com.intellij.javaee.run.execution.J2EEOSProcessHandlerWrapper.onOSProcessTerminated(J2EEOSProcessHandlerWrapper.java:75)
at com.intellij.javaee.run.execution.PatchedLocalState$1.onOSProcessTerminated(PatchedLocalState.java:99)
at com.intellij.execution.process.OSProcessHandler$4$1.run(OSProcessHandler.java:148)
at com.intellij.openapi.application.impl.ApplicationImpl$5.run(ApplicationImpl.java:5)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:6)

After each try, the scenario starts from the step 1 to the last again and again. I'm getting always same errors.

What would you suggest?

0
Comment actions Permalink

BTW, my ports are free (8080). And my jetty was not working while I tried.

0
Comment actions Permalink

Jetty Integration Plug-in version 0.3.1 is available for download using
IDEA's internal Plugin Manager or directly from the IDEA plug-ins website
at http://plugins.intellij.net/plugin/?id=1311.

This release of the plug-in has been built for IDEA 7 (plug-in version
0.3.1.48) and IDEA 8 (plug-in version 0.3.1.51), and includes several
bugfixes:

Fixed: Launch scripts fail when project JDK path and/or Jetty
configuration file paths contain spaces.

Fixed: Default order of configuration files when creating an application
server configuration causes IllegalStateException.

Fixed: Jetty version number may not be detected correctly when creating
an application server configuration.

Fixed: Launch process sometimes fails to determine stop port and key,
preventing IDEA from stopping Jetty.

Source code is included.

I didn't have much spare time (or, frankly, enthusiasm) to fix these bugs
until recently so apologies to anyone who was frustrated by them and
their longevity.

--
Mark Scott
mark@codebrewer.com

0
Comment actions Permalink

Jetty Integration Plug-in version 0.4.0 is available for download using
IDEA's internal Plugin Manager or directly from the IDEA plug-ins website
at http://plugins.intellij.net/plugin/?id=1311.

This release of the plug-in has been built for IDEA 7 (plug-in version
0.3.1.52) and IDEA 8 (plug-in version 0.3.1.52), and includes a couple of
enhancements:

New: JSP debugging is supported.

New: Hightide (a commercially-supported version of Jetty) is detected
during creation of a Jetty Application Server configuration.

Source code is included with each build.

Note that testing of this release has been done on Linux only.

If you never edit Jetty's configuration files then JSP debugging should
"just work" since the JSP servlet that's configured in Jetty's
webdefault.xml configuration file will be used. If you do edit the
configuration files in such a way that JSP debugging doesn't work then
you're presumably clued-up enough to figure out what you need to do to
fix it :) (The plug-in is somewhat fragile with respect to
configuration file changes so this is something that could usefully be
improved in future releases.)

Many thanks to Ben Gidley for the Hightide patch.

--
Mark Scott
mark@codebrewer.com

0

Please sign in to leave a comment.