GWT Autobeans / NoClassDefFoundError: What am I doing wrong? - gwt

I am trying to serialize a POJO to JSON in GWT using Autobeans, an I keep receiving a NoClassDefFoundError and ClassNotFoundException, both looking for org.json.JSONObject. This is in the context of tokenizing a Place.
I created a JUnit test to isolate the problem. The test is:
#Test public void testGetToken() {
SearchCriterion searchCriterion = new JavaSearchCriterion("a", "b", ImmutableList.of("c"));
ResourcesPlace place = new ResourcesPlace(ImmutableList.of(searchCriterion));
String token = new Tokenizer().getToken(place);
assertNotNull(token);
}
And my stack trace is
java.lang.NoClassDefFoundError: org/json/JSONObject
at com.google.web.bindery.autobean.shared.impl.StringQuoter.quote(StringQuoter.java:69)
at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl$PropertyGetter.encodeProperty(AutoBeanCodexImpl.java:411)
at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl$PropertyGetter.visitValueProperty(AutoBeanCodexImpl.java:397)
at com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.traverseProperties(ProxyAutoBean.java:260)
at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.traverse(AbstractAutoBean.java:166)
at com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.accept(AbstractAutoBean.java:101)
at com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl.doEncode(AutoBeanCodexImpl.java:558)
at com.google.web.bindery.autobean.shared.AutoBeanCodex.encode(AutoBeanCodex.java:83)
at com.redacted.client.place.ResourcesPlace$Tokenizer.getToken(ResourcesPlace.java:62)
at com.redacted.client.place.ResourcesPlaceTokenizerTest.testGetToken(ResourcesPlaceTokenizerTest.java:19)
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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: org.json.JSONObject
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 32 more
And here is the relevant bit of the Tokenizer:
private MyFactory factory = AutoBeanFactorySource.create(MyFactory.class);
interface MyFactory extends AutoBeanFactory {
// Factory method for a simple AutoBean
AutoBean<SearchCriterion> person();
// Factory method for a non-simple type or to wrap an existing instance
AutoBean<SearchCriterion> person(SearchCriterion toWrap);
}
#Override
public String getToken(ResourcesPlace place) {
AutoBean<SearchCriterion> placeBean = factory.create(SearchCriterion.class, place.getSearchCriteria().get(0));
return AutoBeanCodex.encode(placeBean).getPayload();
}
I've added the Autobeans include in my .gwt.xml, but I still seem to be missing something.

How are you launching the test runner? Those classes originate from gwt/tools/redist/json/r2_20080312/json-1.5.jar in the GWT repo and should be packed into the gwt-servlet-deps.jar. Try adding that jar to the classpath of your test run configuration to see if that clears it up.

Related

Running Drools On Spark Cluster - Getting Null Pointer at org.kie.internal.builder.KnowledgeBuilderFactory.newKnowledgeBuilder

I am using drools with Spark to execute some set of rules. I have written a method to load the .drl file. and Instantiate the object of "InternalKnowledgeBase".
This below code is working in local mode, But when I am running in cluster (EMR), I am getting below exception. attaching code and exception stackTrace.
def loadDrl(drlFilePath: String): Option[InternalKnowledgeBase] = {
try {
val resource = ResourceFactory.newClassPathResource(drlFilePath)
val kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder() //Exception Occurs
kbuilder.add(resource, ResourceType.DRL)
if (kbuilder.hasErrors()) {
throw new RuntimeException(kbuilder.getErrors().toString())
}
val kbase = KnowledgeBaseFactory.newKnowledgeBase()
kbase.addPackages(kbuilder.getKnowledgePackages())
Some(kbase)
} catch {
case e: Exception => {
e.printStackTrace()
None
}
}
}
Please find the Exception Stack Trace.
java.lang.NullPointerException
at org.kie.internal.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:48)
at $line27.$read$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw.loadDrl(<pastie>:44)
at $line33.$read$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw.<init>(<console>:39)
at $line33.$read$$iw$$iw$$iw$$iw$$iw$$iw$$iw.<init>(<console>:44)
at $line33.$read$$iw$$iw$$iw$$iw$$iw$$iw.<init>(<console>:46)
at $line33.$read$$iw$$iw$$iw$$iw$$iw.<init>(<console>:48)
at $line33.$read$$iw$$iw$$iw$$iw.<init>(<console>:50)
at $line33.$read$$iw$$iw$$iw.<init>(<console>:52)
at $line33.$read$$iw$$iw.<init>(<console>:54)
at $line33.$read$$iw.<init>(<console>:56)
at $line33.$read.<init>(<console>:58)
at $line33.$read$.<init>(<console>:62)
at $line33.$read$.<clinit>(<console>)
at $line33.$eval$.$print$lzycompute(<console>:7)
at $line33.$eval$.$print(<console>:6)
at $line33.$eval.$print(<console>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:793)
at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:1054)
at scala.tools.nsc.interpreter.IMain$WrappedRequest$$anonfun$loadAndRunReq$1.apply(IMain.scala:645)
at scala.tools.nsc.interpreter.IMain$WrappedRequest$$anonfun$loadAndRunReq$1.apply(IMain.scala:644)
at scala.reflect.internal.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:31)
at scala.reflect.internal.util.AbstractFileClassLoader.asContext(AbstractFileClassLoader.scala:19)
at scala.tools.nsc.interpreter.IMain$WrappedRequest.loadAndRunReq(IMain.scala:644)
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:576)
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:572)
at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:819)
at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:691)
at scala.tools.nsc.interpreter.ILoop.processLine(ILoop.scala:404)
at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:425)
at org.apache.spark.repl.SparkILoop$$anonfun$process$1.apply$mcZ$sp(SparkILoop.scala:285)
at org.apache.spark.repl.SparkILoop.runClosure(SparkILoop.scala:159)
at org.apache.spark.repl.SparkILoop.process(SparkILoop.scala:182)
at org.apache.spark.repl.Main$.doMain(Main.scala:78)
at org.apache.spark.repl.Main$.main(Main.scala:58)
at org.apache.spark.repl.Main.main(Main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.spark.deploy.JavaMainApplication.start(SparkApplication.scala:52)
at org.apache.spark.deploy.SparkSubmit.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:849)
at org.apache.spark.deploy.SparkSubmit.doRunMain$1(SparkSubmit.scala:167)
at org.apache.spark.deploy.SparkSubmit.submit(SparkSubmit.scala:195)
at org.apache.spark.deploy.SparkSubmit.doSubmit(SparkSubmit.scala:86)
at org.apache.spark.deploy.SparkSubmit$$anon$2.doSubmit(SparkSubmit.scala:924)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:933)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Appreciate your help! Thanks.
I had a similar issue a while ago. Mine was related to building a jar with shade plugin. Resolved it after finding one of these questions (don't remember with one exactly):
Drools 7.4.1 kieservices.factory.get() returns null
how to use drools in storm topology
Had to add this transformer to my pom.xml
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/kie.conf</resource>
</transformer>

Lambdas in JPA Entities using arquillian

i am testing my DAOs in an arquillian integration test using eclipselink 2.5.2 connected to a derby inmemory database.
When i use following code snippet in my jpa entity:
this.automationTypeManualCount = (int) testCases.stream()
.filter(testCase -> testCase.equalsAutomationType( ManualTestCase.class ))
.count();
if get following exception:
Internal Exception: Exception [EclipseLink-7161] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Entity class [class com.bmw.ipp_connect.lib.testmanagement.entities.ConnectTestJob] has no primary key specified. It should define either an #Id, #EmbeddedId or an #IdClass. If you have defined PK using any of these annotations then make sure that you do not have mixed access-type (both fields and properties annotated) in your entity class hierarchy.
at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:230)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createPredeployFailedPersistenceException(EntityManagerSetupImpl.java:1954)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1945)
at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:322)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:207)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:114)
at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223)
at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510)
at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230)
at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:926)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:435)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:220)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:487)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:134)
at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:110)
at org.jboss.arquillian.container.glassfish.embedded_3_1.GlassFishContainer.deploy(GlassFishContainer.java:195)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:161)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:128)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.java:271)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deploy(ContainerDeployController.java:127)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createDeploymentContext(ContainerDeploymentContextHandler.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.container.impl.client.container.DeploymentExceptionHandler.verifyExpectedExceptionDuringDeploy(DeploymentExceptionHandler.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:95)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:80)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachDeployment(ContainerDeployController.java:263)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachManagedDeployment(ContainerDeployController.java:239)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deployManaged(ContainerDeployController.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:101)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:96)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:87)
at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:202)
at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:431)
at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:55)
at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:219)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:167)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
If i remove the lambda expression like this:
this.automationTypeManualCount = (int) testCases.stream().filter( new Predicate<TestCase>()
{
#Override
public boolean test( TestCase testCase )
{
return testCase.equalsAutomationType( ManualTestCase.class );
}
}).count();
then everything is working fine.
It must be a problem with the environment, because if i run this outside the arquillian environmet it also works fine with the lambda expression.
Can anybody explain me where the problem could be, so that i also can use lambda expression in entity running in an arquillian test?
I am using arquillian 1.1.12 with an embedded payara 4.1.1.171.
Greets

TopComponent Not Serializable

I am seeing the following error, as you can see there is no mention of any of my classes. I have a subclass of MultiViewEditorElement. I am assuming the exception springs from here. Is there anything specific I should do to be able to get rid of the exception ?
Here is the class.
INFO [org.netbeans.core.windows.persistence]: TopComponent MultiView-puml#007Ctext#002Ehistory#007C is not serializable.
java.io.NotSerializableException: org.netbeans.core.windows.RegistryImpl
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
at org.netbeans.core.multiview.MultiViewPeer.peerWriteExternal(MultiViewPeer.java:523)
at org.netbeans.core.multiview.MultiViewCloneableTopComponent.writeExternal(MultiViewCloneableTopComponent.java:213)
at org.openide.windows.TopComponent$Replacer.writeObject(TopComponent.java:1787)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:975)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
at org.netbeans.modules.settings.convertors.XMLSettingsSupport.storeSerialData(XMLSettingsSupport.java:274)
at org.netbeans.modules.settings.convertors.XMLSettingsSupport.storeToXML10(XMLSettingsSupport.java:115)
at org.netbeans.modules.settings.convertors.XMLSettingsSupport$Convertor.write(XMLSettingsSupport.java:1174)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.openide.loaders.InstanceDataObject.convertorWriteMethod(InstanceDataObject.java:1617)
at org.openide.loaders.InstanceDataObject.storeThroughConvertor(InstanceDataObject.java:1604)
at org.openide.loaders.InstanceDataObject.storeSettings(InstanceDataObject.java:358)
at org.openide.loaders.InstanceDataObject.access$900(InstanceDataObject.java:92)
at org.openide.loaders.InstanceDataObject$Creator.run(InstanceDataObject.java:1565)
at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:127)
at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:609)
at org.openide.loaders.DataObjectPool.runAtomicActionSimple(DataObjectPool.java:229)
at org.openide.loaders.InstanceDataObject$Creator.createInstanceDataObject(InstanceDataObject.java:1579)
at org.openide.loaders.InstanceDataObject.create(InstanceDataObject.java:343)
at org.openide.loaders.InstanceDataObject.create(InstanceDataObject.java:319)
[catch] at org.netbeans.core.windows.persistence.PersistenceManager.saveTopComponents(PersistenceManager.java:834)
at org.netbeans.core.windows.persistence.PersistenceManager.saveWindowSystem(PersistenceManager.java:1181)
at org.netbeans.core.windows.PersistenceHandler.save(PersistenceHandler.java:323)
at org.netbeans.core.windows.WindowSystemImpl.save(WindowSystemImpl.java:93)
at org.netbeans.core.NbLifeExit.doStopInfra(NbLifeExit.java:147)
at org.netbeans.core.NbLifeExit.run(NbLifeExit.java:97)
at org.netbeans.core.startup.ModuleSystem$2.run(ModuleSystem.java:343)
at org.netbeans.ModuleManager.shutDownAsync(ModuleManager.java:1971)
at org.netbeans.core.startup.ModuleSystem.shutDownAsync(ModuleSystem.java:349)
at org.netbeans.core.NbLifeExit.doExit(NbLifeExit.java:134)
at org.netbeans.core.NbLifeExit.run(NbLifeExit.java:94)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
EDIT
Ok, I was able to eliminate the exception by changing persistenceType on DataObject to
persistenceType = TopComponent.PERSISTENCE_NEVER. But I would like to use persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED Is there a tutorial that I could use for DataObject persistence ?
Since MultiviewEditorElement implements Serializable interface, you'll need to implement the Serializable methods in order to use the TopComponent.PERSISTENCE_ONLY_OPENED:
private void writeObject(java.io.ObjectOutputStream out) throws IOException
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException;

ExceptionInInitializerError with PowerMock and Robolectric

I want to use Robolectric with PowerMock, but I'm having some trouble getting them to run. I think it's a dependency issue -- right now my jars are just managed in Eclipse.
I'm getting an ExceptionInInitializerError in two ways. The first is this:
#RunWith(RobolectricTestRunner.class)
#PrepareForTest(Logger.class)
public class Logger_Test {
#Mock Config config;
#Before
public void setUp() {
MockitoAnnotations.initMocks(this);
}
Fails with :
java.lang.ExceptionInInitializerError
at org.mockito.internal.exceptions.stacktrace.ConditionalStackTraceFilter.<init>(ConditionalStackTraceFilter.java:17)
at org.mockito.exceptions.base.MockitoException.filterStackTrace(MockitoException.java:30)
at org.mockito.exceptions.base.MockitoException.<init>(MockitoException.java:19)
at org.mockito.exceptions.misusing.MockitoConfigurationException.<init>(MockitoConfigurationException.java:18)
at org.mockito.internal.configuration.ClassPathLoader.loadImplementations(ClassPathLoader.java:145)
at org.mockito.internal.configuration.ClassPathLoader.findPluginImplementation(ClassPathLoader.java:110)
at org.mockito.internal.configuration.ClassPathLoader.findPlatformMockMaker(ClassPathLoader.java:106)
at org.mockito.internal.configuration.ClassPathLoader.<clinit>(ClassPathLoader.java:59)
at org.mockito.internal.util.MockUtil.<clinit>(MockUtil.java:21)
at org.mockito.internal.MockitoCore.<init>(MockitoCore.java:40)
at org.mockito.internal.stubbing.defaultanswers.ReturnsMocks.<init>(ReturnsMocks.java:18)
at org.mockito.Answers.<clinit>(Answers.java:52)
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 java.lang.Class.getEnumConstantsShared(Class.java:2942)
at java.lang.Class.enumConstantDirectory(Class.java:2963)
at java.lang.Enum.valueOf(Enum.java:191)
at sun.reflect.annotation.AnnotationParser.parseEnumValue(AnnotationParser.java:413)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:278)
at java.lang.reflect.Method.getDefaultValue(Method.java:720)
at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:99)
at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:66)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:202)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
at java.lang.reflect.Field.declaredAnnotations(Field.java:1014)
at java.lang.reflect.Field.getDeclaredAnnotations(Field.java:1007)
at java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.java:175)
at org.junit.runners.model.FrameworkField.getAnnotations(FrameworkField.java:21)
at org.junit.runners.model.TestClass.addToAnnotationLists(TestClass.java:50)
at org.junit.runners.model.TestClass.<init>(TestClass.java:43)
at org.junit.runners.ParentRunner.<init>(ParentRunner.java:65)
at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:58)
at com.xtremelabs.robolectric.RobolectricTestRunner.<init>(RobolectricTestRunner.java:213)
at com.xtremelabs.robolectric.RobolectricTestRunner.<init>(RobolectricTestRunner.java:110)
at com.xtremelabs.robolectric.RobolectricTestRunner.<init>(RobolectricTestRunner.java:97)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NullPointerException
at org.mockito.internal.exceptions.stacktrace.StackTraceFilter.<clinit>(StackTraceFilter.java:21)
... 56 more
It works fine with PowerMockRunner, but throws the same exception with it as a Rule.
#PrepareForTest(Logger.class)
public class Logger_Test {
#Rule public PowerMockRule rule = new PowerMockRule();
#Mock Config config;
#Before
public void setUp() {
MockitoAnnotations.initMocks(this);
}
Fails with:
java.lang.ExceptionInInitializerError
at org.mockito.internal.exceptions.stacktrace.ConditionalStackTraceFilter.<init>(ConditionalStackTraceFilter.java:17)
at org.mockito.exceptions.base.MockitoException.filterStackTrace(MockitoException.java:30)
at org.mockito.exceptions.base.MockitoException.<init>(MockitoException.java:19)
at org.mockito.exceptions.misusing.MockitoConfigurationException.<init>(MockitoConfigurationException.java:18)
at org.mockito.internal.configuration.ClassPathLoader.loadImplementations(ClassPathLoader.java:145)
at org.mockito.internal.configuration.ClassPathLoader.findPluginImplementation(ClassPathLoader.java:110)
at org.mockito.internal.configuration.ClassPathLoader.findPlatformMockMaker(ClassPathLoader.java:106)
at org.mockito.internal.configuration.ClassPathLoader.<clinit>(ClassPathLoader.java:59)
at org.mockito.internal.util.MockUtil.<clinit>(MockUtil.java:21)
at org.mockito.internal.MockitoCore.<init>(MockitoCore.java:40)
at org.mockito.internal.stubbing.defaultanswers.ReturnsMocks.<init>(ReturnsMocks.java:18)
at org.mockito.Answers.<clinit>(Answers.java:52)
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 java.lang.Class.getEnumConstantsShared(Class.java:2942)
at java.lang.Class.enumConstantDirectory(Class.java:2963)
at java.lang.Enum.valueOf(Enum.java:191)
at sun.reflect.annotation.AnnotationParser.parseEnumValue(AnnotationParser.java:413)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:278)
at java.lang.reflect.Method.getDefaultValue(Method.java:720)
at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:99)
at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:66)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:202)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
at java.lang.reflect.Field.declaredAnnotations(Field.java:1014)
at java.lang.reflect.Field.getAnnotation(Field.java:1000)
at org.powermock.classloading.DeepCloner.cloneFields(DeepCloner.java:222)
at org.powermock.classloading.DeepCloner.performClone(DeepCloner.java:128)
at org.powermock.classloading.DeepCloner.cloneFields(DeepCloner.java:248)
at org.powermock.classloading.DeepCloner.performClone(DeepCloner.java:128)
at org.powermock.classloading.DeepCloner.cloneFields(DeepCloner.java:248)
at org.powermock.classloading.DeepCloner.performClone(DeepCloner.java:128)
at org.powermock.classloading.DeepCloner.cloneFields(DeepCloner.java:248)
at org.powermock.classloading.DeepCloner.performClone(DeepCloner.java:128)
at org.powermock.classloading.DeepCloner.cloneFields(DeepCloner.java:248)
at org.powermock.classloading.DeepCloner.performClone(DeepCloner.java:128)
at org.powermock.classloading.DeepCloner.clone(DeepCloner.java:82)
at org.powermock.classloading.DeepCloner.clone(DeepCloner.java:69)
at org.powermock.classloading.ClassloaderExecutor.execute(ClassloaderExecutor.java:89)
at org.powermock.classloading.ClassloaderExecutor.execute(ClassloaderExecutor.java:78)
at org.powermock.modules.junit4.rule.PowerMockStatement.evaluate(PowerMockRule.java:49)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NullPointerException
at org.mockito.internal.exceptions.stacktrace.StackTraceFilter.<clinit>(StackTraceFilter.java:21)
... 59 more
Add #PowerMockIgnore({ "org.mockito.*", "org.robolectric.*", "android.*" }) as the doc: https://github.com/robolectric/robolectric/wiki/Using-PowerMock
In place of #RunWith(RobolectricTestRunner.class) use #RunWith(PowerMockRunner.class)

Injecting EventBus GWT

Trying to inject the eventbus into a component but I'm getting the
"has no default (zero args) constructor." error. Any clues what I'm
doing wrong? Very new to GIN, so it might be trivial..
Here is my code:
module:
public class MyWidgetClientModule extends AbstractGinModule {
protected void configure() {
bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
}
}
injector:
#GinModules(MyWidgetClientModule.class)
public interface MyWidgetGinjector extends Ginjector {
}
and the component I trying to inject:
public class I18NLabel extends Label implements ChangeLanguageEventHandler{
private final SimpleEventBus eventBus;
private String key;
#Inject
public I18NLabel(SimpleEventBus eventBus) {
this.eventBus = eventBus;
}
...
It gives me this error log:
00:00:45.767 [DEBUG] Rebinding com.test.fdc.gui.gwt.client.customer.CustomerDetailView.Binder
00:00:45.767 [DEBUG] Invoking generator com.google.gwt.uibinder.rebind.UiBinderGenerator
00:00:45.767 [ERROR] com.test.fdc.gui.gwt.client.content.i18n.I18NLabel has no default (zero args) constructor. To fix this, you can define a #UiFactory method on the UiBinder's owner, or annotate a constructor of I18NLabel with #UiConstructor.
00:00:45.767 [ERROR] Deferred binding failed for 'com.test.fdc.gui.gwt.client.customer.CustomerDetailView.Binder'; expect subsequent failures
00:00:45.767 [ERROR] Uncaught exception escaped
java.lang.ExceptionInInitializerError: null
at com.test.fdc.gui.gwt.client.FDC$4.onSuccess(FDC.java:394)
at com.test.fdc.gui.gwt.client.FDC$4.onSuccess(FDC.java:1)
at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:215)
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
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 com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:562)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.RuntimeException: Deferred binding failed for 'com.test.fdc.gui.gwt.client.customer.CustomerDetailView$Binder' (did you forget to inherit a required module?)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53)
at com.google.gwt.core.client.GWT.create(GWT.java:97)
at com.test.fdc.gui.gwt.client.customer.CustomerDetailView.(CustomerDetailView.java:34)
at com.test.fdc.gui.gwt.client.FDC$4.onSuccess(FDC.java:394)
at com.test.fdc.gui.gwt.client.FDC$4.onSuccess(FDC.java:1)
at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:215)
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
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 com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:562)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:619)
Caused by: com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:596)
at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:456)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
at com.google.gwt.core.client.GWT.create(GWT.java:97)
at com.test.fdc.gui.gwt.client.customer.CustomerDetailView.(CustomerDetailView.java:34)
at com.test.fdc.gui.gwt.client.FDC$4.onSuccess(FDC.java:394)
at com.test.fdc.gui.gwt.client.FDC$4.onSuccess(FDC.java:1)
at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:215)
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
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 com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:562)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Thread.java:619)
When you declare a widget in a UiBinder, GWT tries to instantiate it with the default zero-arg constructor. Since your new Widget doesn't have a no-arg constructor, the UiBinder methods fail.
You can look into the #UiConstructor and #UiField(provided=true) annotations, but neither will give you a very elegant solution for this. You may be better off programmatically declaring your widget and inserting it into your layout in Java. If you do want to keep using the UiBinder, you can do something like
#UiField(provided=true)
protected I18NLabel theLabel;
public MyCompositeWidgetDefinedByUiBinder()
{
theLabel = new I18NLabel(eventBusToInject);
initWidget(uiBinder.createAndBindUI(this));
}
but there's no elegant way to inject an object through a UiBinder other than this.
Probably a bit late on this one but you were injecting the implementation as opposed to the interface. Try just injecting EventBus instead of SimpleEventBus. GIN will know to use the right one because you bound it in your module.
I assume your SimpleEventBus does not have a zero-arg constructor? So Gin can not instatiate it because it does not know how (which args to use).
In this case add this to MyWidgetClientModule:
// assuming you only need one event bus in whole app
// use appropriate "args.."
private static final SimpleEventBus eventBus = new SimpleEventBus(args..);
#Provides
SimpleEventBus provideEventBus() {
return eventBus;
}