Hi,
I try to save a Java- object to the context with groovy:
<%
test=context.getContext().get("test");
if(test==null)
println "test is null"
else
println "test is not null"
context.getContext().put("test",new Object());
%>
If you reload the page the object should be in the context and the output
should be "test is not null". But unfortunately I get "test is null".
I also tried it with the Servlet-Context like this:
<%
scontext=context.getRequest().getSession().getServletContext();
test=scontext.get("test");
if(test==null)
println "test is null"
else
println "test is not null"
scontext.put("test",new Object())
%>
Then I get an exception: java.lang.NoClassDefFoundError:
org/apache/catalina/session/StandardSessionFacade
This class is in the catalina.jar which is located in tomcat/server/lib and
the documentation of tomcat says: These classes and resources are TOTALLY
invisible to web applications.
I copied catalina.jar to WEB-INF/lib but then I get a ClassCastException:
java.lang.ClassCastException:
org.apache.catalina.session.StandardSessionFacade
I guess this is because of different ClassLoaders.
How can I save a Java-Object to a session?
Thanks
Barbara
--
View this message in context:
http://www.nabble.com/groovy---context-tf2226640.html#a6170318
Sent from the XWiki- Users forum at
Nabble.com.