aspose file tools*
The moose likes Tomcat and the fly likes Caused by: java.lang.IllegalStateException: No modifications are allowed to a locked ParameterMap Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Caused by: java.lang.IllegalStateException: No modifications are allowed to a locked ParameterMap" Watch "Caused by: java.lang.IllegalStateException: No modifications are allowed to a locked ParameterMap" New topic
Author

Caused by: java.lang.IllegalStateException: No modifications are allowed to a locked ParameterMap

srinivasarao govada
Greenhorn

Joined: May 06, 2010
Posts: 4

Hi,

I have developed a web application. It's working fine with the Websphere. I have delpoyed the same application into the tomcat 6.0.14, the deployment was sucessful.
But i try to use some functionalities such as saving data after entering input to the page, it's throwing the following error message and the operation was failed.

Caused by: java.lang.IllegalStateException: No modifications are allowed to a locked ParameterMap
at org.apache.catalina.util.ParameterMap.put(ParameterMap.java:166)
at com.deere.u90.iaf.ejpm.utility.HttpServletRequestMapper.mapToBean(HttpServletRequestMapper.java:42)
... 25 more
Requesting you please let me know that what may be the mistake and provided solution.

Thanks,
Srinivas.

William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12823
    
    5
Basically, you are not allowed to modify the ParameterMap - see javax.servlet.ServletRequest getParameterMap method - the map returned is immutable.

What I have done is create a new map that is a copy of the orginal ParameterMap and use that to store additional data.

Bill
srinivasarao govada
Greenhorn

Joined: May 06, 2010
Posts: 4

Hi Bill,

Thanks for your reply. I am able to run the same application successfully with the Web Sphere 6.1 server.

If i need to create a new map that is a copy of the orginal ParameterMap in Tomcat environment, then how can i do this. Please help me.

Thanks,

Srinivas.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

srinivasarao govada wrote:
Hi Bill,

Thanks for your reply. I am able to run the same application successfully with the Web Sphere 6.1 server.
.


That just means that WAS 6.1 isn't enforcing the J2EE standard. Just like writing into a WAR, for all intents and purposes, you're exploiting a bug in a particular implementation of a server. Because it's a standards violation, you can't expect to find that same loophole in other servers or even in other versions of the same server.


Customer surveys are for companies who didn't pay proper attention to begin with.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12823
    
    5
If i need to create a new map that is a copy of the orginal ParameterMap in Tomcat environment, then how can i do this. Please help me.


Look at the JavaDocs for the API for the java.util.Map interface.

You can use the keySet method to obtain a collection of all of the key values as a Set.

Create a new Map object from one of the classes which implements Map - I typically use HashMap.

Iterate through the keySet - for each key, extract the value from the ParameterMap - the value is a String[] but just treat it as an object.
Store that value in the new Map using that key.

You now have a Map that contains all the original data but is not locked.

Bill
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

Unless I'm mistaken, the code to replicate a map is already part of the Java collections API:

1. Construct a new Map (such as a HashMap)
2.. Use the putAll() method to copy the key/value pairs from the original map.

Regardless of how you do it, though, this is only a copy of the ParameterMap. The parameterMap in the HttpServletRequest object remains unchanged, as does the request object itself.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Caused by: java.lang.IllegalStateException: No modifications are allowed to a locked ParameterMap