You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Harrison, Joseph" <JO...@saic.com> on 2003/12/31 15:15:29 UTC

RE: Configuration Issue when Splitting up the struts-config.xml f ile

I added the "/" and have ensured that my sub config files are Struts 1.1
config DTD compliant.  I am using tiles and am using the definition names in
lieu of the jsp page for my paths.  Would this be a problem?

-----Original Message-----
From: Kris Schneider [mailto:kris@dotech.com] 
Sent: Wednesday, December 31, 2003 8:51 AM
To: Struts Users Mailing List
Subject: Re: Configuration Issue when Splitting up the struts-config.xml
file

Try inserting a leading "/" in your paths. For example:
/WEB-INF/struts-arrest.xml. Also ensure that each of the config files is
valid
with respect to the Struts 1.1 config DTD.

Quoting "Harrison, Joseph" <JO...@saic.com>:

> All,
> 
>  
> 
> I recently brought my struts application to a relatively stable point (no
> problems whatsoever).
> 
> However, I split apart my struts-config.xml file into 6 sub struts xml
> files.  I updated the web.xml file, but it gives me the following error
> when trying to parse the resource paths.
> 
> [ERROR] ActionServlet - -Parsing error processing resource path
> WEB-INF/struts-config.xml
> 
>           WEB-INF/struts-arrest.xml
>           WEB-INF/struts-history.xml
>           WEB-INF/struts-profiles.xml
>           WEB-INF/struts-reports.xml
>           WEB-INF/struts-subject.xml
>           WEB-INF/struts-support.xml <java.lang.NullPointerException>
> 
> My web.xml file looks like this
> 
>     <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
>     <init-param>
>       <param-name>config</param-name>
>         <param-value>
>           WEB-INF/struts-config.xml,
>           WEB-INF/struts-arrest.xml,
>           WEB-INF/struts-history.xml,
>           WEB-INF/struts-profiles.xml,
>           WEB-INF/struts-reports.xml,
>           WEB-INF/struts-subject.xml,
>           WEB-INF/struts-support.xml
>         </param-value>
>     </init-param>
> 
> 
> Is there some sort of parsing or setup problem that I am unaware of?  If
> so,
> is there a patch that I can download to fix this.  I am using JDeveloper
9i
> to build and run my application if it makes a difference.
> 
>  
> 
> Thanks,
> 
> Joe

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: ConcurrentModificationException on ActionErrors

Posted by Kris Schneider <kr...@dotech.com>.
Although it's possible to generate that exception from within the same thread,
it's usually triggered by multiple threads accessing the same collection. In
general, if you grab an iterator, then modify the underlying collection, and
then call iter.next(), you'll see that exception. Having multiple iterators
shouldn't be an issue - you don't explicitly close an iterator like a database
connection. It will be GC-ed just like any other object. The problem really
boils down to modifying the backing collection while iteration is in progress.
By "in progress", I mean doing something like calling iter.next(), not that
there's just an iterator instance lying around.

Quoting "Richard Mixon (qwest)" <rn...@custco.biz>:

> Kris,
> 
> Thanks - I do not think I have multiple threads involved, but certaily
> multiple Iterators may be hanging around that are not GC'd
> yet.
> 
> And yes that was a typo. Because the real code is so huge, I created a simple
> example to paste in and obviously did not compile it
> :)
> 
>  - Richard
> 
> -----Original Message-----
> From: Kris Schneider [mailto:kris@dotech.com]
> Sent: Wednesday, December 31, 2003 9:01 AM
> To: Struts Users Mailing List
> Subject: Re: ConcurrentModificationException on ActionErrors
> 
> 
> It almost sounds like your code isn't handling errors1 and/or errors2 in a
> thread-safe manner. ConcurrentModificationException will be thrown if one
> thread
> is in the proces of iterating over a collection and another thread modifies
> that
> collection. ActionMessages.add(ActionMessages) will iterate over both the
> arg's
> properties and the messages for each property, so there's certainly the
> potential for the error you're seeing. Can you provide some more detail on
> how
> your code is organized?
> 
> BTW, not sure if it's a c/p error, but you've got:
> 
> if (!errors2.isEmpty()) {
>   errors.add(errors1);  // shouldn't that be errors2?
> }
> 
> Quoting "Richard Mixon (qwest)" <rn...@custco.biz>:
> 
> > I have a Struts action that is trying to show all of the errors that
> might
> > occur from either or both of two subordinate methods. The
> > code looks like:
> >
> >   ...
> >   ActionErrors errors = new ActionErrors();
> >   ActionErrors errors1 = null;
> >   ActionErrors errors2 = null;
> >
> >   Obj1 obj1 = new Obj1();
> >   Obj2 obj2 = new Obj2();
> >
> >   obj1.method1();
> >   errors1 = obj1.getErrors();
> >   if (!errors1.isEmpty()) {
> >       errors.add(errors1);
> >   }
> >
> >   obj2.method2();
> >   errors2 = obj2.getErrors();
> >   if (!errors2.isEmpty()) {
> >       errors.add(errors1);
> >   }
> >   ...
> >
> > Problem is I get the ConcurrentModificationException when I try and do
> either
> > of the "errors.add" methods above. Methods
> > method1/method2 are pretty vanilla, just doing some database work and
> > accumulating any errors in an associated ActionErrors.
> >
> > I've searched the archives but only found one or two references to
> > ConcurrentModificationException and they did not involve
> > ActionErrors. Any ideas or help is appreciated.
> >
> > - Richard
> 
> --
> Kris Schneider <ma...@dotech.com>
> D.O.Tech       <http://www.dotech.com/>

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: ConcurrentModificationException on ActionErrors

Posted by "Richard Mixon (qwest)" <rn...@custco.biz>.
Kris,

Thanks - I do not think I have multiple threads involved, but certaily multiple Iterators may be hanging around that are not GC'd
yet.

And yes that was a typo. Because the real code is so huge, I created a simple example to paste in and obviously did not compile it
:)

 - Richard

-----Original Message-----
From: Kris Schneider [mailto:kris@dotech.com]
Sent: Wednesday, December 31, 2003 9:01 AM
To: Struts Users Mailing List
Subject: Re: ConcurrentModificationException on ActionErrors


It almost sounds like your code isn't handling errors1 and/or errors2 in a
thread-safe manner. ConcurrentModificationException will be thrown if one thread
is in the proces of iterating over a collection and another thread modifies that
collection. ActionMessages.add(ActionMessages) will iterate over both the arg's
properties and the messages for each property, so there's certainly the
potential for the error you're seeing. Can you provide some more detail on how
your code is organized?

BTW, not sure if it's a c/p error, but you've got:

if (!errors2.isEmpty()) {
  errors.add(errors1);  // shouldn't that be errors2?
}

Quoting "Richard Mixon (qwest)" <rn...@custco.biz>:

> I have a Struts action that is trying to show all of the errors that might
> occur from either or both of two subordinate methods. The
> code looks like:
>
>   ...
>   ActionErrors errors = new ActionErrors();
>   ActionErrors errors1 = null;
>   ActionErrors errors2 = null;
>
>   Obj1 obj1 = new Obj1();
>   Obj2 obj2 = new Obj2();
>
>   obj1.method1();
>   errors1 = obj1.getErrors();
>   if (!errors1.isEmpty()) {
>       errors.add(errors1);
>   }
>
>   obj2.method2();
>   errors2 = obj2.getErrors();
>   if (!errors2.isEmpty()) {
>       errors.add(errors1);
>   }
>   ...
>
> Problem is I get the ConcurrentModificationException when I try and do either
> of the "errors.add" methods above. Methods
> method1/method2 are pretty vanilla, just doing some database work and
> accumulating any errors in an associated ActionErrors.
>
> I've searched the archives but only found one or two references to
> ConcurrentModificationException and they did not involve
> ActionErrors. Any ideas or help is appreciated.
>
> - Richard

--
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: ConcurrentModificationException on ActionErrors

Posted by Kris Schneider <kr...@dotech.com>.
It almost sounds like your code isn't handling errors1 and/or errors2 in a
thread-safe manner. ConcurrentModificationException will be thrown if one thread
is in the proces of iterating over a collection and another thread modifies that
collection. ActionMessages.add(ActionMessages) will iterate over both the arg's
properties and the messages for each property, so there's certainly the
potential for the error you're seeing. Can you provide some more detail on how
your code is organized?

BTW, not sure if it's a c/p error, but you've got:

if (!errors2.isEmpty()) {
  errors.add(errors1);  // shouldn't that be errors2?
}

Quoting "Richard Mixon (qwest)" <rn...@custco.biz>:

> I have a Struts action that is trying to show all of the errors that might
> occur from either or both of two subordinate methods. The
> code looks like:
> 
>   ...
>   ActionErrors errors = new ActionErrors();
>   ActionErrors errors1 = null;
>   ActionErrors errors2 = null;
> 
>   Obj1 obj1 = new Obj1();
>   Obj2 obj2 = new Obj2();
> 
>   obj1.method1();
>   errors1 = obj1.getErrors();
>   if (!errors1.isEmpty()) {
>       errors.add(errors1);
>   }
> 
>   obj2.method2();
>   errors2 = obj2.getErrors();
>   if (!errors2.isEmpty()) {
>       errors.add(errors1);
>   }
>   ...
> 
> Problem is I get the ConcurrentModificationException when I try and do either
> of the "errors.add" methods above. Methods
> method1/method2 are pretty vanilla, just doing some database work and
> accumulating any errors in an associated ActionErrors.
> 
> I've searched the archives but only found one or two references to
> ConcurrentModificationException and they did not involve
> ActionErrors. Any ideas or help is appreciated.
> 
> - Richard

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


ConcurrentModificationException on ActionErrors

Posted by "Richard Mixon (qwest)" <rn...@custco.biz>.
I have a Struts action that is trying to show all of the errors that might occur from either or both of two subordinate methods. The
code looks like:

  ...
  ActionErrors errors = new ActionErrors();
  ActionErrors errors1 = null;
  ActionErrors errors2 = null;

  Obj1 obj1 = new Obj1();
  Obj2 obj2 = new Obj2();

  obj1.method1();
  errors1 = obj1.getErrors();
  if (!errors1.isEmpty()) {
      errors.add(errors1);
  }

  obj2.method2();
  errors2 = obj2.getErrors();
  if (!errors2.isEmpty()) {
      errors.add(errors1);
  }
  ...

Problem is I get the ConcurrentModificationException when I try and do either of the "errors.add" methods above. Methods
method1/method2 are pretty vanilla, just doing some database work and accumulating any errors in an associated ActionErrors.

I've searched the archives but only found one or two references to ConcurrentModificationException and they did not involve
ActionErrors. Any ideas or help is appreciated.

- Richard



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Configuration Issue when Splitting up the struts-config.xml f ile

Posted by Kris Schneider <kr...@dotech.com>.
Have you tried running the app outside of JDeveloper to make sure it's not an
IDE config issue? Although I'm not that familiar with Tiles, I don't think
that's your problem. 

Quoting "Harrison, Joseph" <JO...@saic.com>:

> I added the "/" and have ensured that my sub config files are Struts 1.1
> config DTD compliant.  I am using tiles and am using the definition names
> in
> lieu of the jsp page for my paths.  Would this be a problem?
> 
> -----Original Message-----
> From: Kris Schneider [mailto:kris@dotech.com] 
> Sent: Wednesday, December 31, 2003 8:51 AM
> To: Struts Users Mailing List
> Subject: Re: Configuration Issue when Splitting up the struts-config.xml
> file
> 
> Try inserting a leading "/" in your paths. For example:
> /WEB-INF/struts-arrest.xml. Also ensure that each of the config files is
> valid
> with respect to the Struts 1.1 config DTD.
> 
> Quoting "Harrison, Joseph" <JO...@saic.com>:
> 
> > All,
> > 
> >  
> > 
> > I recently brought my struts application to a relatively stable point (no
> > problems whatsoever).
> > 
> > However, I split apart my struts-config.xml file into 6 sub struts xml
> > files.  I updated the web.xml file, but it gives me the following error
> > when trying to parse the resource paths.
> > 
> > [ERROR] ActionServlet - -Parsing error processing resource path
> > WEB-INF/struts-config.xml
> > 
> >           WEB-INF/struts-arrest.xml
> >           WEB-INF/struts-history.xml
> >           WEB-INF/struts-profiles.xml
> >           WEB-INF/struts-reports.xml
> >           WEB-INF/struts-subject.xml
> >           WEB-INF/struts-support.xml <java.lang.NullPointerException>
> > 
> > My web.xml file looks like this
> > 
> >     <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
> >     <init-param>
> >       <param-name>config</param-name>
> >         <param-value>
> >           WEB-INF/struts-config.xml,
> >           WEB-INF/struts-arrest.xml,
> >           WEB-INF/struts-history.xml,
> >           WEB-INF/struts-profiles.xml,
> >           WEB-INF/struts-reports.xml,
> >           WEB-INF/struts-subject.xml,
> >           WEB-INF/struts-support.xml
> >         </param-value>
> >     </init-param>
> > 
> > 
> > Is there some sort of parsing or setup problem that I am unaware of?  If
> > so,
> > is there a patch that I can download to fix this.  I am using JDeveloper
> 9i
> > to build and run my application if it makes a difference.
> > 
> >  
> > 
> > Thanks,
> > 
> > Joe
> 
> -- 
> Kris Schneider <ma...@dotech.com>
> D.O.Tech       <http://www.dotech.com/>

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org