Problem validating struts-config.xml and finding web root dir..

HI, I am using 6.0.4 under WinXP, and the struts-config.xml validation doesn't work for me anymore. When I first upgraded to 6 it worked, but after 6.0.2 it stopped. I use an expanded war file format web directory structure, and point my web resources dir to the root of it (i.e. dir above WEB-INF). All of our seven developers have a same problem, and some friends that use IDEA at other companies have the same problem as well. Could all of us have simply the wrong settings? I sent a report and question to support via the web form before xmas and never heard anything. Maybe that stuff goes to /dev/null ?

Does anyone else have this problem? Every item in my struts-config.xml is red. Under web resources I have it pointing to my web.xml, and my WEB-INF directory is also set at the bottom. I have this problem on all my of projects/modules as well. It seems like it can't figure out my web root directory for some reason and that makes all the struts stuff break after that.

Ryan

9 comments
Comment actions Permalink

Hi Ryan,

it seems your web module is misconfigured. Make shure your web module
deployment descriptor (web.xml) set correctly (on the "Web Module Settings"
tab of module properties). Then, check if the struts configuration files
paths in your action servlet description (in web.xml) are resolved (e.g.
press Ctrl-B on the file name).

"Ryan Vanderwerf" <ryan_vanderwerf@powered.com> wrote in message
news:27709861.1169222704243.JavaMail.itn@is.intellij.net...

HI, I am using 6.0.4 under WinXP, and the struts-config.xml validation
doesn't work for me anymore. When I first upgraded to 6 it worked, but
after 6.0.2 it stopped. I use an expanded war file format web directory
structure, and point my web resources dir to the root of it (i.e. dir
above WEB-INF). All of our seven developers have a same problem, and some
friends that use IDEA at other companies have the same problem as well.
Could all of us have simply the wrong settings? I sent a report and
question to support via the web form before xmas and never heard anything.
Maybe that stuff goes to /dev/null ?

>

Does anyone else have this problem? Every item in my struts-config.xml is
red. Under web resources I have it pointing to my web.xml, and my WEB-INF
directory is also set at the bottom. I have this problem on all my of
projects/modules as well. It seems like it can't figure out my web root
directory for some reason and that makes all the struts stuff break after
that.

>

Ryan



0
Comment actions Permalink

Thanks, I double checked my path to my web.xml, and it is correct. However in my web.xml the following is not hyperlinked and I can't control-click or ctrl-b to it:
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>

The only non-standard thing I have is that I override the default struts action class with my own and declare it so:


<servlet-name>action</servlet-name>
<servlet-class>com.blah.inc.util.MyActionServlet</servlet-class>


Also under web resource directories I have a valid path mapping my WEB-INF dir to /WEB-INF on the right.

I know my project is not corruped as I have tried creating a fresh new project and get the same results. Actually all of our developers have the same problem on all projects as well.

Ryan

0
Comment actions Permalink

Weird... Now, it looks like a problem with classpath :) How do you have your
struts library configured? (at project or module level?) Maybe it is added
to classpath twice or something like that?
Also, do you mean you cannot make working a newly created project with
struts support added by IDEA wizard?
What IDEA build do you use?


0
Comment actions Permalink

I can report the same issue as well.

Dir structure:
project
-- src
--web
--WEB-INF

As you can see there is a directory called web and WEB-INF is in there containing additonal directories like lib, pages, etc. The struts-config is in the WEB-INF directory. Intellij think that is a problem in terms of validation. My webapp works fine but the struts-config validator in the IDE shows up as red...and the struts assistant plugin doesnt like it as well.

0
Comment actions Permalink

Thanks for the response

I have struts.jar and struts-legacy.jar included in my module libraries for my web module. On my struts tab for the project, I have run struts config files validation and report errors as warnings checked. I have no global or project libraries defined.

If I create a new project (with the same code) and set everything the same, the problem does not go away.

I am running build 6148 of 6.0.4. I think this feature stopped working after I had upgraded to 6.0.2

Ryan

0
Comment actions Permalink

Thanks for the detailed description, but I still cannot find out what is
wrong here... Is it possible for you to send me some of your project files -
I think project & module files, libraries and web.xml would be enough.
Please keep directories structure. My mail is Dmitry.Avdeev at
jetbrains.com.


0
Comment actions Permalink

done.. I have emailed them to you.

Ryan

0
Comment actions Permalink

Is your "/WEB-INF/struts-config.xml" link in web.xml resolved?


0
Comment actions Permalink

I finally got it working. One problem that I have is IntelliJ puts 2 entries in my web resources directory settings one for / and one for /WEB-INF. However if you edit one of them, it says you can't have both. So if you delete / , it will break resolution of all your .jsp files, even if /WEB-INF is still in there.

In summary to fix this:

  1. Create a struts project level library, and put the struts jar files in there. Make sure to remove those jars directly from the dependancies of your modules (but make sure they depend on your new library)

  2. make sure the DOCTYPE in the web.xml is valid. If you don't see a URL in there to the SUN DTD, change it to this: <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

  3. Under 'Web Module Settings' tab on your module, make sure that 1) your path to the web.xml is correct at the top. Make sure it is not pointing to other directories web.xml 2) at the bottom under 'Web Resource Directories' make sure the path point to the 'web' dir in cvs. Make sure that maps to '/' on the right column. If you have it mapped to /WEB-INF then change it.

0

Please sign in to leave a comment.