我在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
}
答案 0 :(得分:3)
我们最近自己已经看到了这个问题并暂时修复了。从主分支中获取最新信息然后尝试并让我知道。新代码看起来像这样,它应该告诉我们两个字段(或不扫描该字段两次)。
if(metaClass.getIdField() != null) {
Field existingField = metaClass.getIdField().getField();
if(field.equals(existingField))
return true; // we already processed it
else
throw new IllegalArgumentException("class="+metaClass.getClass()+" has two fields that have @NoSqlId annotation. One of them may be in a superclass. The two fields are="+field+" and="+existingField);
}
注意:我们也在寻找更好的解决方案,因为有时这是由于对类文件的双重扫描造成的,所以我们可能在本周末有另一个修复....我们目前正在讨论它现在发邮件。
此外,这个问题是由扫描一个类两次引起的....你的任何代码是否在NoSqlEntityManagerFactory中调用rescan方法? (我在想)。最新的问题现在应该解决你的问题,并在下周回来查看。
迪安