[xstream-user] sun.misc.Unsafe.objectFieldOffset

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[xstream-user] sun.misc.Unsafe.objectFieldOffset

John Cherouvim
Hello

This issue relates to isse 498. I cannot deserialize under apache
tomcat. It gives me:

java.lang.NoSuchMethodError: sun.misc.Unsafe.objectFieldOffset(Ljava/lang/reflect/Field;)J
        com.thoughtworks.xstream.converters.reflection.Sun14ReflectionProvider.write(Sun14ReflectionProvider.java:74)
        com.thoughtworks.xstream.converters.reflection.Sun14ReflectionProvider.writeField(Sun14ReflectionProvider.java:68)
        com.thoughtworks.xstream.converters.reflection.ReflectionConverter.unmarshal(ReflectionConverter.java:103)
        com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:38)
        com.thoughtworks.xstream.core.ReferenceByXPathUnmarshaller.convertAnother(ReferenceByXPathUnmarshaller.java:39)
        com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:99)
        com.thoughtworks.xstream.core.ReferenceByXPathMarshallingStrategy.unmarshal(ReferenceByXPathMarshallingStrategy.java:12)
        com.thoughtworks.xstream.XStream.unmarshal(XStream.java:521)
        com.thoughtworks.xstream.XStream.unmarshal(XStream.java:509)
        com.thoughtworks.xstream.XStream.fromXML(XStream.java:475)
        com.thoughtworks.xstream.XStream.fromXML(XStream.java:468)
        org.apache.jsp.index_jsp._jspService(index_jsp.java:71)
        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)



I've managed to make it work using xstream = new XStream(new
PureJavaReflectionProvider(), new DomDriver());
Is it possible though to make it work in Enhanced mode? Because I would
like to use the features that are unavailable in Pure Java mode (Without
default constructor, Final fields etc)

Thanks,
J.
Reply | Threaded
Open this post in threaded view
|

[xstream-user] Re: sun.misc.Unsafe.objectFieldOffset

Mauro Talevi
John Cherouvim wrote:

> Hello
>
> This issue relates to isse 498. I cannot deserialize under apache
> tomcat. It gives me:
>
> java.lang.NoSuchMethodError:
> sun.misc.Unsafe.objectFieldOffset(Ljava/lang/reflect/Field;)J
>     com.thoughtworks.xstream.converters.reflection.Sun14ReflectionProvider.write(Sun14ReflectionProvider.java:74)
>
>     com.thoughtworks.xstream.converters.reflection.Sun14ReflectionProvider.writeField(Sun14ReflectionProvider.java:68)
>
>     com.thoughtworks.xstream.converters.reflection.ReflectionConverter.unmarshal(ReflectionConverter.java:103)
>
>     com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:38)
>
>     com.thoughtworks.xstream.core.ReferenceByXPathUnmarshaller.convertAnother(ReferenceByXPathUnmarshaller.java:39)
>
>     com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:99)
>
>     com.thoughtworks.xstream.core.ReferenceByXPathMarshallingStrategy.unmarshal(ReferenceByXPathMarshallingStrategy.java:12)
>
>     com.thoughtworks.xstream.XStream.unmarshal(XStream.java:521)
>     com.thoughtworks.xstream.XStream.unmarshal(XStream.java:509)
>     com.thoughtworks.xstream.XStream.fromXML(XStream.java:475)
>     com.thoughtworks.xstream.XStream.fromXML(XStream.java:468)
>     org.apache.jsp.index_jsp._jspService(index_jsp.java:71)
>     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
>
>     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
>
>     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
>
>
> I've managed to make it work using xstream = new XStream(new
> PureJavaReflectionProvider(), new DomDriver());
> Is it possible though to make it work in Enhanced mode? Because I would
> like to use the features that are unavailable in Pure Java mode (Without
> default constructor, Final fields etc)
>

Hi John,

what JDK are using? In particular, what vendor?

Cheers