-1

I downloaded xstream jar and sourcecode and append the sourcecode into jar file using winrar

and i created 2 gwt.xml files.

xstream.gwt.xml is present in com.thoughtworks

<?xml version="1.0" encoding="UTF-8"?> 
<module> 
<source path="xstream"/> 
</module>

and operations.gwt.xml is present in com.thoughworks.xstream

<?xml version="1.0" encoding="UTF-8"?> 
<module> 
<source path="annotations"/> 
<source path="converters"/> 
<source path="core"/> 
<source path="io"/> 
<source path="mapper"/> 
<source path="persistence"/> 
</module>

Edited: its my gwt project xml

<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='test'>
  <inherits name='com.google.gwt.user.User'/>
  <inherits name='com.google.gwt.user.theme.standard.Standard'/>
  <inherits name='com.thoughtworks.xstream'/>
  <entry-point class='com.example.test.client.Index'/>
</module>

but i got an error

Compiling module com.example.test.Test
   Validating newly compiled units
      Ignored 142 units with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/XStream.java'
      [ERROR] Line 499:  The method forName(String, boolean, ClassLoader) is undefined for the type Class
      [ERROR] Line 500:  The method getConstructor(Class[]) is undefined for the type Class
      [ERROR] Line 764:  The method forName(String, boolean, ClassLoader) is undefined for the type Class
      [ERROR] Line 765:  The method getConstructor(Class[]) is undefined for the type Class
      [ERROR] Line 1062:  The method getPackage() is undefined for the type Class<capture#10-of ? extends XStream>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/basic/NullConverter.java'
      [ERROR] Line 30:  The method isAssignableFrom(Class) is undefined for the type Class<Mapper.Null>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/basic/StringConverter.java'
      [ERROR] Line 73:  The method synchronizedMap(WeakCache) is undefined for the type Collections
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/collections/AbstractCollectionConverter.java'
      [ERROR] Line 77:  The method newInstance() is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/collections/TreeMapConverter.java'
      [ERROR] Line 54:  The method getDeclaredFields() is undefined for the type Class<TreeMap>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/collections/TreeSetConverter.java'
      [ERROR] Line 48:  The method getDeclaredFields() is undefined for the type Class<TreeSet>
      [ERROR] Line 50:  The method isAssignableFrom(Class<capture#1-of ?>) is undefined for the type Class<SortedMap>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/extended/DynamicProxyConverter.java'
      [ERROR] Line 51:  The method getDeclaredField(String) is undefined for the type Class<Proxy>
      [ERROR] Line 60:  The method getClassLoader() is undefined for the type Class<DynamicProxyConverter>
      [ERROR] Line 85:  The method getInterfaces() is undefined for the type Class<capture#2-of ? extends Object>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/extended/JavaClassConverter.java'
      [ERROR] Line 61:  The method getClassLoader() is undefined for the type Class<capture#1-of ?>
      [ERROR] Line 65:  The method forName(String, boolean, ClassLoader) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/extended/JavaFieldConverter.java'
      [ERROR] Line 69:  The method getDeclaredField(String) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/extended/JavaMethodConverter.java'
      [ERROR] Line 107:  The method getDeclaredMethod(String, Class[]) is undefined for the type Class
      [ERROR] Line 109:  The method getDeclaredConstructor(Class[]) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/extended/LookAndFeelConverter.java'
      [ERROR] Line 44:  The method isAssignableFrom(Class) is undefined for the type Class<LookAndFeel>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/reflection/AbstractReflectionConverter.java'
      [ERROR] Line 271:  The method isAssignableFrom(Class<capture#27-of ? extends Object>) is undefined for the type Class
      [ERROR] Line 326:  The method isAssignableFrom(Class<capture#32-of ? extends Object>) is undefined for the type Class
      [ERROR] Line 378:  The method isAssignableFrom(Class) is undefined for the type Class<Collection>
      [ERROR] Line 378:  The method isAssignableFrom(Class) is undefined for the type Class<Map>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/reflection/AbstractAttributedCharacterIteratorAttributeConverter.java'
      [ERROR] Line 38:  The method getDeclaredMethod(String, Class[]) is undefined for the type Class<AttributedCharacterIterator.Attribute>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/reflection/ExternalizableConverter.java'
      [ERROR] Line 58:  The method isAssignableFrom(Class) is undefined for the type Class<Externalizable>
      [ERROR] Line 104:  The method getDeclaredConstructor(Class[]) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/reflection/SerializableConverter.java'
      [ERROR] Line 90:  The method isAssignableFrom(Class) is undefined for the type Class<Serializable>
      [ERROR] Line 214:  The method isAssignableFrom(Class) is undefined for the type Class<Serializable>
      [ERROR] Line 271:  The method getDeclaredField(String) is undefined for the type Class
      [ERROR] Line 462:  The method isAssignableFrom(Class) is undefined for the type Class<Serializable>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/core/DefaultConverterLookup.java'
      [ERROR] Line 37:  The method synchronizedMap(WeakHashMap) is undefined for the type Collections
      [ERROR] Line 86:  The method synchronizedMap(HashMap) is undefined for the type Collections
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/core/JVM.java'
      [ERROR] Line 46:  The method getProperty(String) is undefined for the type System
      [ERROR] Line 94:  The method getProperty(String) is undefined for the type System
      [ERROR] Line 185:  The method getProperty(String) is undefined for the type System
      [ERROR] Line 199:  The method getProperty(String) is undefined for the type System
      [ERROR] Line 231:  The method getClassLoader() is undefined for the type Class<capture#1-of ? extends JVM>
      [ERROR] Line 251:  The method newInstance() is undefined for the type Class
      [ERROR] Line 342:  The method getDeclaredFields() is undefined for the type Class<AttributedString>
      [ERROR] Line 350:  The method getDeclaredFields() is undefined for the type Class<JVM>
      [ERROR] Line 361:  The method getProperty(String) is undefined for the type System
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/core/util/CompositeClassLoader.java'
      [ERROR] Line 57:  The method getClassLoader() is undefined for the type Class<Object>
      [ERROR] Line 58:  The method getClassLoader() is undefined for the type Class<capture#1-of ? extends CompositeClassLoader>
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/core/util/CustomObjectInputStream.java'
      [ERROR] Line 95:  The method forName(String, boolean, ClassLoader) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/io/xml/XppDriver.java'
      [ERROR] Line 18:  The import org.xmlpull cannot be resolved
      [ERROR] Line 19:  The import org.xmlpull cannot be resolved
      [ERROR] Line 20:  The import org.xmlpull cannot be resolved
      [ERROR] Line 31:  XmlPullParserFactory cannot be resolved to a type
      [ERROR] Line 55:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 55:  XmlPullParserException cannot be resolved to a type
      [ERROR] Line 56:  XmlPullParserFactory cannot be resolved to a type
      [ERROR] Line 57:  XmlPullParserFactory cannot be resolved to a type
      [ERROR] Line 57:  XmlPullParserFactory cannot be resolved
      [ERROR] Line 59:  XmlPullParserFactory cannot be resolved to a type
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/io/xml/AbstractXppDriver.java'
      [ERROR] Line 19:  The import org.xmlpull cannot be resolved
      [ERROR] Line 20:  The import org.xmlpull cannot be resolved
      [ERROR] Line 54:  The method createParser() from the type AbstractXppDriver refers to the missing type XmlPullParser
      [ERROR] Line 55:  XmlPullParserException cannot be resolved to a type
      [ERROR] Line 93:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 93:  XmlPullParserException cannot be resolved to a type
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/mapper/MapperWrapper.java'
      [ERROR] Line 103:  The method isAssignableFrom(Class<capture#1-of ? extends MapperWrapper>) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/mapper/CachingMapper.java'
      [ERROR] Line 55:  The method synchronizedMap(HashMap) is undefined for the type Collections
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/mapper/ClassAliasingMapper.java'
      [ERROR] Line 60:  The method isAssignableFrom(Class) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/mapper/DefaultMapper.java'
      [ERROR] Line 47:  The method getClassLoader() is undefined for the type Class<DefaultMapper>
      [ERROR] Line 51:  The method forName(String, boolean, ClassLoader) is undefined for the type Class
      [ERROR] Line 53:  The method forName(String) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/mapper/ImplicitCollectionMapper.java'
      [ERROR] Line 97:  The method getDeclaredField(String) is undefined for the type Class
      [ERROR] Line 110:  The method isAssignableFrom(Class<capture#1-of ?>) is undefined for the type Class<Map>
      [ERROR] Line 114:  The method isAssignableFrom(Class<capture#2-of ?>) is undefined for the type Class<Collection>
      [ERROR] Line 127:  The method isAssignableFrom(Class) is undefined for the type Class
      [ERROR] Line 162:  The method isAssignableFrom(Class) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/core/util/Fields.java'
      [ERROR] Line 27:  The method getDeclaredField(String) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/core/util/Primitives.java'
      [ERROR] Line 30:  Byte.TYPE cannot be resolved
      [ERROR] Line 32:  Short.TYPE cannot be resolved
      [ERROR] Line 33:  Integer.TYPE cannot be resolved
      [ERROR] Line 34:  Long.TYPE cannot be resolved
      [ERROR] Line 35:  Float.TYPE cannot be resolved
      [ERROR] Line 36:  Double.TYPE cannot be resolved
      [ERROR] Line 37:  Boolean.TYPE cannot be resolved
      [ERROR] Line 38:  Void.TYPE cannot be resolved
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/reflection/SerializationMethodInvoker.java'
      [ERROR] Line 40:  The method getDeclaredMethods() is undefined for the type Class<capture#1-of ? extends new Object(){}>
      [ERROR] Line 48:  The method synchronizedMap(HashMap) is undefined for the type Collections
      [ERROR] Line 161:  The method getDeclaredMethod(String, Class[]) is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/reflection/PureJavaReflectionProvider.java'
      [ERROR] Line 58:  The method getDeclaredConstructors() is undefined for the type Class
      [ERROR] Line 68:  The method isAssignableFrom(Class) is undefined for the type Class<Serializable>
      [ERROR] Line 113:  The method getClassLoader() is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/converters/reflection/FieldDictionary.java'
      [ERROR] Line 136:  The method getDeclaredFields() is undefined for the type Class
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/io/xml/XmlFriendlyNameCoder.java'
      [ERROR] Line 278:  The method clone() is undefined for the type Object
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/core/util/XmlHeaderAwareReader.java'
      [ERROR] Line 100:  The method isWhitespace(char) is undefined for the type Character
      [ERROR] Line 109:  The method isWhitespace(char) is undefined for the type Character
      [ERROR] Line 124:  The method isWhitespace(char) is undefined for the type Character
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/io/xml/XppReader.java'
      [ERROR] Line 17:  The import org.xmlpull cannot be resolved
      [ERROR] Line 18:  The import org.xmlpull cannot be resolved
      [ERROR] Line 32:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 42:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 54:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 56:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 60:  XmlPullParserException cannot be resolved to a type
      [ERROR] Line 80:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 80:  The method createParser() from the type XppReader refers to the missing type XmlPullParser
      [ERROR] Line 82:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 84:  XmlPullParserException cannot be resolved to a type
      [ERROR] Line 93:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 96:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 96:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 96:  Class<XmlPullParser> cannot be resolved to a type
      [ERROR] Line 109:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 110:  XmlPullParser cannot be resolved
      [ERROR] Line 111:  XmlPullParser cannot be resolved
      [ERROR] Line 113:  XmlPullParser cannot be resolved
      [ERROR] Line 114:  XmlPullParser cannot be resolved
      [ERROR] Line 116:  XmlPullParser cannot be resolved
      [ERROR] Line 118:  XmlPullParser cannot be resolved
      [ERROR] Line 123:  XmlPullParserException cannot be resolved to a type
      [ERROR] Line 131:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 135:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 139:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 143:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 147:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 151:  XmlPullParser cannot be resolved to a type
      [ERROR] Line 155:  XmlPullParser cannot be resolved to a type
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/io/xml/PrettyPrintWriter.java'
      [ERROR] Line 267:  The method isDefined(char) is undefined for the type Character
      [ERROR] Line 267:  The method isISOControl(char) is undefined for the type Character
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/core/util/Pool.java'
      [ERROR] Line 49:  The method wait() is undefined for the type Object
      [ERROR] Line 68:  The method notify() is undefined for the type Object
   [ERROR] Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/core/util/Cloneables.java'
      [ERROR] Line 32:  Cannot invoke clone() on the array type Object[]
      [ERROR] Line 44:  The method getMethod(String, Class[]) is undefined for the type Class<capture#4-of ? extends Object>
   [ERROR] Cannot proceed due to previous errors
Naveed S
  • 5,106
  • 4
  • 34
  • 52
Bucks
  • 689
  • 3
  • 11
  • 28
  • add .gwt.xml file code also – Parvathy Jan 29 '13 at 09:51
  • Errors in 'jar:file:/C:/Users/YRC/Downloads/xstream-1.4.4.jar!/com/thoughtworks/xstream/XStream.java' have you opend Xstream.java file ?? any errors ? – Suresh Atta Jan 29 '13 at 11:04
  • @Bucks now u have source stream. so open it in a new prjt in eclipse or netbeans and find error. may it need other jar. and gwt is not supporting all jars. I opened it i saw File. but we cant use File in client side. So use it in server side – Parvathy Jan 29 '13 at 11:42
  • @Parvathy can you please link any example for using that in server side – Bucks Jan 29 '13 at 12:37
  • GWT 101: https://developers.google.com/web-toolkit/doc/latest/DevGuideCodingBasicsCompatibility – Thomas Broyer Jan 29 '13 at 13:23

2 Answers2

3

You cannot use reflection in GWT;

  • getDeclaredFields

  • getDeclaredMethod

  • forName

  • getConstructor

and the likes ... are all reflective calls;

koma
  • 6,486
  • 2
  • 27
  • 53
0

GWt not supporting all code in client side so we can use it in server. GWT supporting RPC. http://www.vogella.com/articles/GWT/article.html or refer https://developers.google.com/web-toolkit/doc/latest/DevGuideServerCommunication

what you have to do is include all jar in lib and configure build path and only use this code in server side.

Parvathy
  • 2,275
  • 3
  • 24
  • 39