I am trying to run the example given in the official Oracle website of a RMI application.Here is my oldest post where I explain the previous problems I had Running a sample RMI application.
However, I still have this problem :
ComputeEngine exception:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: compute.Compute
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:419)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:267)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at sun.rmi.transport.Transport$1.run(Transport.java:174)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:275)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:252)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:378)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at engine.ComputeEngine.main(ComputeEngine.java:30)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: compute.Compute
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:409)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:267)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at sun.rmi.transport.Transport$1.run(Transport.java:174)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.ClassNotFoundException: compute.Compute
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.rmi.server.LoaderHandler$Loader.loadClass(LoaderHandler.java:1206)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at sun.rmi.server.LoaderHandler.loadClassForName(LoaderHandler.java:1219)
at sun.rmi.server.LoaderHandler.loadProxyInterfaces(LoaderHandler.java:729)
at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:673)
at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:610)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:646)
at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:311)
at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:255)
at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1556)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1512)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
... 13 more
This is the content of the ComuteEngine.java (server):
package engine;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
import compute.Compute;
import compute.Task;
public class ComputeEngine implements Compute {
public ComputeEngine() {
super();
}
public <T> T executeTask(Task<T> t) {
return t.execute();
}
public static void main(String[] args) {
if (System.getSecurityManager() == null) {
System.setSecurityManager(new SecurityManager());
}
try {
String name = "Compute";
Compute engine = new ComputeEngine();
Compute stub =
(Compute) UnicastRemoteObject.exportObject(engine, 0);
Registry registry = LocateRegistry.getRegistry();
registry.rebind(name, stub);
System.out.println("ComputeEngine bound");
} catch (Exception e) {
System.err.println("ComputeEngine exception:");
e.printStackTrace();
}
}
}
Does anyone know how to resolve that issue ?
I succeded to launch my program by adding :
LocateRegistry.createRegistry(1099);
before creating the security manager.However, launching simply the rmiregistry from my terminal didn't work. I think because of a communcation problem between the server and the rmiregistry, maybe because I have to add some classes to the classpath but I don't know how to do that properly.
Related
JBoss Server Version : 7.3
Java Version : 1.8
IDE : eclipse
Exception
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/logging/Logger
at org.jboss.naming.remote.client.InitialContextFactory.<clinit>(InitialContextFactory.java:64)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at test.Client.main(Client.java:17)
Caused by: java.lang.ClassNotFoundException: org.jboss.logging.Logger
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 10 more
Below mentioned jars are added in build-path even after getting exception. java.lang.ClassNotFoundException: org.jboss.logging.Logger .
jbossall-client.jar
jboss-common-client.jar
jboss-logging-3.3.2.Final.jar
jboss-remote-naming-1.0.7.final.jar
Code
Main.java
public static void main(String[] args) {
try {
InputStream input;
input = new FileInputStream("/lookup.properties");
Properties prop = new Properties();
prop.load(input);
InitialContext initialContext = new InitialContext(getJBossClientProperties());
Object obj = initialContext.lookup(prop.getProperty("lookup"));
System.out.println("Got EJB : "+obj);
} catch (Exception e) {
System.out.println("Error : "+e);
}
}
private static Properties getJBossClientProperties() throws Exception {
InputStream input = new FileInputStream("/config.properties");
Properties prop = new Properties();
prop.load(input);
return prop;
}
lookup.properties
lookup=jndi_lookup
config.properties
java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory
java.naming.provider.url=remote://localhost:4447
jboss.naming.client.ejb.context=true
I tried above in glassfish works fine , i know its jboss...
I found another relevant post here
java.lang.ClassNotFoundException: org.jboss.logging.Logger
grep for;
When I added the jbossall-client.jar from tje jboss installtion path(../jboss-5.1.0.GA\client) and not from the lib folder, it worked.
that could be your answer.....
Trying to save some properties in the workflow metadata and below is the code snippet which I am using for the same.
try {
if (workItem.getWorkflowData().getPayloadType().equals("JCR_PATH")) {
addValuesToMetadata(workItem, workflowSession,metaDataMap);
}
MetaDataMap wfMetaData=workItem.getWorkflowData().getMetaDataMap();
Set<String> keys=metaDataMap.keySet();
for (String key : keys) {
if(key.startsWith("xyz")){
wfMetaData.put(key, metaDataMap.get(key));
}
}
workflowSession.updateWorkflowData(workItem.getWorkflow(), workItem.getWorkflowData());
} catch (Exception e) {
e.printStackTrace();
}
I am not closing the session, however it throws the following exception.
javax.jcr.RepositoryException: This session has been closed. at
org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.checkAlive(SessionDelegate.java:367)
at
org.apache.jackrabbit.oak.jcr.session.SessionImpl$ReadOperation.checkPreconditions(SessionImpl.java:110)
at
org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.perform(SessionDelegate.java:289)
at
org.apache.jackrabbit.oak.jcr.session.SessionImpl.perform(SessionImpl.java:127)
at
org.apache.jackrabbit.oak.jcr.session.SessionImpl.getItemOrNull(SessionImpl.java:228)
at
org.apache.jackrabbit.oak.jcr.session.SessionImpl.getItem(SessionImpl.java:357)
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606) at
org.apache.sling.jcr.base.SessionProxyHandler$SessionProxyInvocationHandler.invoke(SessionProxyHandler.java:113)
at com.sun.proxy.$Proxy0.getItem(Unknown Source) at
com.adobe.granite.workflow.core.jcr.WorkflowManager.getWorkflowNode(WorkflowManager.java:815)
at
com.adobe.granite.workflow.core.jcr.WorkflowManager.updateWorkflowData(WorkflowManager.java:326)
at
com.adobe.granite.workflow.core.WorkflowSessionImpl.updateWorkflowData(WorkflowSessionImpl.java:952)
at
com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:177)
at org.apache.sling.event.jobs.JobUtil$1.run(JobUtil.java:365) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
com.adobe.granite.workflow.WorkflowException: Cannot load workItem:
/etc/workflow/instances/2015-06-18/model_1299575053804439/workItems/node7_etc_workflow_instances_2015-06-18_model_9
at
com.adobe.granite.workflow.core.jcr.WorkItemManager.updateWorkItem(WorkItemManager.java:349)
at
com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:180)
at org.apache.sling.event.jobs.JobUtil$1.run(JobUtil.java:365) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745) Caused by:
javax.jcr.RepositoryException: This session has been closed. at
org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.checkAlive(SessionDelegate.java:367)
at
org.apache.jackrabbit.oak.jcr.session.SessionImpl$ReadOperation.checkPreconditions(SessionImpl.java:110)
at
org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.perform(SessionDelegate.java:289)
at
org.apache.jackrabbit.oak.jcr.session.SessionImpl.perform(SessionImpl.java:127)
at
org.apache.jackrabbit.oak.jcr.session.SessionImpl.getItemOrNull(SessionImpl.java:228)
at
org.apache.jackrabbit.oak.jcr.session.SessionImpl.getItem(SessionImpl.java:357)
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606) at
org.apache.sling.jcr.base.SessionProxyHandler$SessionProxyInvocationHandler.invoke(SessionProxyHandler.java:113)
at com.sun.proxy.$Proxy0.getItem(Unknown Source) at
com.adobe.granite.workflow.core.jcr.WorkItemManager.updateWorkItem(WorkItemManager.java:344)
... 5 common frames omitted
Any help is well appreciated.
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;
How to resolve this Exception??? am i missing any jars ?
When i look into the Jboss jmx-console, "santosh " is not available.
EJBTest.java
It contains EJB Remote Interface and its implementation
package com.ramco.santosh.EJB;
import javax.ejb.Stateless;
import org.jboss.annotation.ejb.*;
#Stateless
#RemoteBinding(jndiBinding="santosh")
public class EJBTest implements EJBTestRemote {
public EJBTest(){}
public void doHello()
{
System.out.println("Hello Mr.Santosh");
}
}
Main
It is a Client which access EJBTest.java through EJBTestRemote Interface.
import java.util.*;
import javax.naming.*;
import com.ramco.santosh.EJB.*;
public class Main {
public static void main(String[] args) throws NamingException
{
Hashtable hashtable = new Hashtable();
hashtable.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
hashtable.put("java.naming.provider.url","jnp://localhost:1099");
hashtable.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
InitialContext context = new InitialContext(hashtable);
Object h=context.lookup("santosh");
EJBTestRemote remote=(EJBTestRemote)h;
remote.doHello();
}
}
Exception in thread "main" javax.naming.NameNotFoundException: santosh not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at Main.main(Main.java:27)
I meant change this line
Object h=context.lookup("santosh");
to
Object h=context.lookup("java:santosh");
and let me know if this works
I Solved the problem of
Exception in thread "main" javax.naming.NameNotFoundException: santosh not bound
Jboss server was missing ejb3-persistence.jar file. After adding EJB application is working well.
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.