我在 localhost 或 AWS EC2 实例中的 jar 就像一个魅力,但只是在 Elastic MapReduce 上它失败并出现“从未见过”异常:
Caused by: java.lang.IllegalArgumentException: class=class com.alvazan.orm.impl.meta.data.MetaClassSingle has two fields that have @NoSqlId annotation. One of them may be in a superclass
我试图从@NoSqlId中删除(usegenerator = true),但没有奏效。
例外:
2012-12-11 12:00:14,454 INFO com.alvazan.orm.logging.NoSqlRawLogger (main): [rawlogger] starting NoSQL Service Provider and connecting
2012-12-11 12:00:14,637 INFO com.netflix.astyanax.connectionpool.impl.ConnectionPoolMBeanManager (main): Registering mbean: com.netflix.MonitoredResources:type=ASTYANAX,name=MyConnectionPool,ServiceType=connectionpool
2012-12-11 12:00:15,261 INFO com.alvazan.orm.layer9z.spi.db.cassandra.ColumnFamilyHelper (main): On keyspace=dmpExisting column families=[stringindice, dbocolumnmeta, dbodatabasemeta, dbotablemeta]
NOTE: WE WILL CREATE new column families automatically as you save entites that have no column family
2012-12-11 12:00:15,262 INFO com.alvazan.orm.layer0.base.BaseEntityManagerFactoryImpl (main): Begin scanning for jars with nosql.Persistence.class
2012-12-11 12:00:15,289 INFO com.impetus.annovention.ClasspathDiscoverer (main): adding folder to scan=file:/mnt/var/lib/hadoop/tmp/hadoop-unjar5809470263616901335/
2012-12-11 12:00:15,289 INFO com.impetus.annovention.ClasspathDiscoverer (main): adding jar file for scanning=jar:file:/home/hadoop/project_w.jar!/
2012-12-11 12:00:16,212 INFO com.alvazan.orm.impl.meta.scan.ScannerForClass (main): scanning class=class com.s1mbi0se.dmp.da.bean.UserURL
2012-12-11 12:00:16,260 INFO com.alvazan.orm.api.z8spi.meta.DboTableMeta (main): [proxies loaded in this one]classloaders that proxies class exists in=classloader list={java.net.URLClassLoader@158f9d3,sun.misc.Launcher$AppClassLoader@1cde100,sun.misc.Launcher$ExtClassLoader@16f0472,}
2012-12-11 12:00:16,260 INFO com.alvazan.orm.api.z8spi.meta.DboTableMeta (main): [context classloader]classloaders that proxies class exists in=classloader list={java.net.URLClassLoader@158f9d3,sun.misc.Launcher$AppClassLoader@1cde100,sun.misc.Launcher$ExtClassLoader@16f0472,}
2012-12-11 12:00:16,260 INFO com.alvazan.orm.api.z8spi.meta.DboTableMeta (main): [system classloader]classloaders that proxies class exists in=classloader list={sun.misc.Launcher$AppClassLoader@1cde100,sun.misc.Launcher$ExtClassLoader@16f0472,}
2012-12-11 12:00:16,260 INFO com.alvazan.orm.api.z8spi.meta.DboTableMeta (main): [play jar in this classloader]classloaders that proxies class exists in=classloader list={java.net.URLClassLoader@158f9d3,sun.misc.Launcher$AppClassLoader@1cde100,sun.misc.Launcher$ExtClassLoader@16f0472,}
2012-12-11 12:00:16,260 INFO com.alvazan.orm.api.z8spi.meta.DboTableMeta (main): [javassist jar in this classloader]classloaders that proxies class exists in=classloader list={java.net.URLClassLoader@158f9d3,sun.misc.Launcher$AppClassLoader@1cde100,sun.misc.Launcher$ExtClassLoader@16f0472,}
2012-12-11 12:00:16,453 INFO com.alvazan.orm.impl.meta.scan.ScannerForClass (main): scanning class=class com.s1mbi0se.dmp.da.bean.Request
2012-12-11 12:00:16,473 INFO com.alvazan.orm.impl.meta.scan.ScannerForClass (main): scanning class=class com.s1mbi0se.dmp.da.bean.User
2012-12-11 12:00:17,167 INFO com.alvazan.orm.impl.meta.scan.ScannerForClass (main): scanning class=class com.alvazan.orm.api.z8spi.meta.DboColumnMeta
2012-12-11 12:00:17,246 INFO com.alvazan.orm.impl.meta.scan.ScannerForClass (main): scanning class=class com.alvazan.orm.api.z8spi.meta.DboDatabaseMeta
2012-12-11 12:00:17,248 INFO com.alvazan.orm.impl.meta.scan.ScannerForClass (main): scanning class=class com.alvazan.orm.api.z8spi.meta.DboTableMeta
2012-12-11 12:00:17,313 INFO com.alvazan.orm.impl.meta.scan.ScannerForClass (main): scanning class=class com.alvazan.play.logging.LogEvent
2012-12-11 12:00:17,318 INFO com.alvazan.orm.impl.meta.scan.ScannerForClass (main): scanning class=class com.alvazan.play.logging.ServersThatLog
2012-12-11 12:00:28,399 INFO com.alvazan.orm.impl.meta.scan.ScannerForClass (main): scanning class=class com.s1mbi0se.dmp.da.bean.UserURL
java.lang.RuntimeException: Failure scanning class(see chained exception)=class com.s1mbi0se.dmp.da.bean.UserURL
at com.alvazan.orm.layer0.base.MyClassAnnotationDiscoveryListener.scanClass(MyClassAnnotationDiscoveryListener.java:44)
at com.alvazan.orm.layer0.base.MyClassAnnotationDiscoveryListener.discovered(MyClassAnnotationDiscoveryListener.java:34)
at com.impetus.annovention.Discoverer.discoverAndIntimateForClassAnnotations(Discoverer.java:197)
at com.impetus.annovention.Discoverer.discover(Discoverer.java:155)
at com.alvazan.orm.layer0.base.BaseEntityManagerFactoryImpl.rescan(BaseEntityManagerFactoryImpl.java:80)
at com.alvazan.orm.layer0.base.BaseEntityManagerFactoryImpl.setup(BaseEntityManagerFactoryImpl.java:131)
at com.alvazan.orm.impl.bindings.BootstrapImpl.createInstanceImpl(BootstrapImpl.java:64)
at com.alvazan.orm.impl.bindings.BootstrapImpl.createInstance(BootstrapImpl.java:35)
at com.alvazan.orm.api.base.Bootstrap.create(Bootstrap.java:57)
at com.alvazan.orm.api.base.Bootstrap.create(Bootstrap.java:52)
at com.alvazan.orm.api.base.Bootstrap.create(Bootstrap.java:45)
at com.alvazan.orm.api.base.Bootstrap.create(Bootstrap.java:24)
at com.s1mbi0se.dmp.da.dao.PlayOrmConfiguration.init(PlayOrmConfiguration.java:39)
at com.s1mbi0se.dmp.da.service.DataAccessService.<init>(DataAccessService.java:28)
at com.s1mbi0se.dmp.da.service.DataAccessService.getInstance(DataAccessService.java:22)
at com.s1mbi0se.dmp.processor.main.DmpProcessorRunner.main(DmpProcessorRunner.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.util.RunJar.main(RunJar.java:187)
Caused by: java.lang.RuntimeException: Failure scanning field=private java.lang.String com.s1mbi0se.dmp.da.bean.UserURL.id for class=UserURL
at com.alvazan.orm.impl.meta.scan.ScannerForClass.inspectField(ScannerForClass.java:196)
at com.alvazan.orm.impl.meta.scan.ScannerForClass.scanFields(ScannerForClass.java:189)
at com.alvazan.orm.impl.meta.scan.ScannerForClass.scanSingle(ScannerForClass.java:112)
at com.alvazan.orm.impl.meta.scan.ScannerForClass.addClass(ScannerForClass.java:69)
at com.alvazan.orm.layer0.base.MyClassAnnotationDiscoveryListener.scanClass(MyClassAnnotationDiscoveryListener.java:42)
... 32 more
Caused by: java.lang.IllegalArgumentException: class=class com.alvazan.orm.impl.meta.data.MetaClassSingle has two fields that have @NoSqlId annotation. One of them may be in a superclass
at com.alvazan.orm.impl.meta.scan.ScannerForClass.processIdFieldWorks(ScannerForClass.java:233)
at com.alvazan.orm.impl.meta.scan.ScannerForClass.inspectFieldImpl(ScannerForClass.java:207)
at com.alvazan.orm.impl.meta.scan.ScannerForClass.inspectField(ScannerForClass.java:194)
... 36 more
我的用户类:
@NoSqlEntity
public class User {
@NoSqlId
@NoSqlIndexed
@Field
private String id;
@NoSqlIndexed
@Field
private String nome;
@NoSqlManyToMany
@Field
private List<UserURL> urls = new ArrayList<UserURL>();
@NoSqlManyToMany
@Field
private List<Request> requests = new ArrayList<Request>();
// getters and setters
}
我的 UserURL 类:
@NoSqlEntity
public class UserURL {
@NoSqlId(usegenerator = true)
@Field
private String id;
@Field
private String url'
@NoSqlManyToOne
@NoSqlIndexed
private User user;
// getters and setters
}