SmartDeploy時のセッションのシリアライズでIllegalArgumentException ではまってたのが解決

なんかいつからか、 java.util.Locale とかまでシリアライズできませんって怒られてた。
マニュアルとか見ても tomcat/conf/context.xml を有効にしろとしか書かれて無くってそれはできてるっていうのに!

これが使えないとフォームをセッションに保存するのを簡単に使えない……ということで切羽詰まって調査することに。

エラーが出る辺りのtomcatソースコード

        if ((manager != null) && manager.getDistributable() &&
          !(value instanceof Serializable))
            throw new IllegalArgumentException
                (sm.getString("standardSession.setAttribute.iae", name));

pathnameとか関係ないし・・たぶんここのSerializableとHotReloadのSerializableがクラスローダーが違う的なSAStrutsではよくある話。distributableってなんだ・・と思って調べたら
http://tomcat.apache.org/tomcat-6.0-doc/config/manager.html

distributable

Set to true to ask the session manager to enforce the restrictions described in the Servlet Specification on distributable applications (primarily, this would mean that all session attributes must implement java.io.Serializable). Set to false (the default) to not enforce these restrictions.

NOTE - The value for this property is inherited automatically based on the presence or absence of the element in the web application deployment descriptor (/WEB-INF/web.xml).

oh.. にしても無理だし・・。で、結局原因は web.xml

 <distributable />

が入ってたからでした。本番環境用にセッションレプリケーションの設定をしてていて、それをそのままローカルの開発環境で使ってたんですね……

本番と開発環境でweb.xmlを切り替えるってどうやるのが一般的なんだろう。mavenとかでファイル全体を入れ替えしてしまうと差分の管理が必要になってくるし、大抵数行程度なので出来れば一つのファイル上でif文で分岐とか環境変数を読み込むような設定したい