Hi i am trying to navigate between two panels. my code has a condition where if false it has to go back to the actual panel with parameters which in turn prints a error msg in feedbackpanel.
i am getting this error when condition is true.
SearchInnerPanel.java:
(TabPanel1.this.getParent()).getParent().replaceWith(new JobDetails("innerpanel", params));
JobDetails.java:
list = DBUtils.retrieve(params.get("jobnum").toString());
if (list.size() == 0) {
PageParameters params1 = new PageParameters();
params1.add("jobnum", jnum);
AgileJobDetails.this.replaceWith(new SearchInnerPanel("innerpanel", params1));
}
ErrorLog:
org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of interface org.apache.wicket.markup.html.form.IFormSubmitListener targeted at [Form [Component id = jobnumform]] on component [Form [Component id = jobnumform]] threw an exception
at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:268)
at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:216)
at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:243)
at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:236)
at org.apache.wicket.core.request.handler.RequestSettingRequestHandler.respond(RequestSettingRequestHandler.java:78)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:862)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:610)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
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: java.lang.reflect.InvocationTargetException
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:606)
at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
... 29 more
Caused by: java.lang.IllegalStateException: This method can only be called on a component that has already been added to its parent.
at org.apache.wicket.Component.replaceWith(Component.java:2754)
at com.CCC.aaa.des.JobDetails.<init>(JobDetails.java:40)
at com.CCC.aaa.des.SearchInnerPanel$TabPanel1$1.onSubmit(SearchInnerPanel.java:130)
at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1266)
at org.apache.wicket.markup.html.form.Form.process(Form.java:938)
at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:770)
at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:703)
... 34 more
Please suggest how to redirect to actual panel.
Thanks
Move the code snippet of JobDetails above from the constructor to #onInitialize() method. There it will be already added to its parent and it will be OK to replace it.
Related
Vaadin API Docs says for addItem() method,
Creates a new Item into the Container, and assign it an automatic ID.
The new ID is returned, or null if the operation fails.
my question is.. when operation get failed and why (because isn't it supposed to generate automatic ID ?)?
and ya.. it does.. It is happening in my code.
I am simply trying to do as following,
while (iterator.hasNext()) {
val user_pojo_obj = iterator.next()
val key = user_pojo_obj.id
val parent_key = user_pojo_obj.family_id
var child: Item = container.addItem()
if(child == null){
println("Here's that problem..!!")
}
this code executes and after 1 or 2 iteration throws NullPointerException, as I am trying to do,
child.getItemProperty("caption").asInstanceOf[Property[Any]].setValue(user_pojo_obj.username)
I am trying to filling a Hierarchical Container using Scala.
Ok. Here's the Stacktrace. TreeStructContainer.scala and ObjectLeveLAccess.java are my source files.
TreeStructContainer.scala is being used for methods which creates the (Hieararchical) Container and calling those methods from ObjectlevelAccess.java to fill the tree, which is vaadin's java file.
java.lang.NullPointerException
at com.system.tableManager.TreeStructContainer.getUserTreeContainer(TreeStructContainer.scala:189)
at com.system.tableManager.TreeStructContainer.generateTree(TreeStructContainer.scala:257)
at com.analytics.UI.views.ObjectLevelAccess.<init>(ObjectLevelAccess.java:49)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at com.vaadin.navigator.Navigator$ClassBasedViewProvider.getView(Navigator.java:340)
at com.vaadin.navigator.Navigator.navigateTo(Navigator.java:559)
at com.analytics.UI.AnalyticsUI$7.buttonClick(AnalyticsUI.java:465)
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 com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:508)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:198)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:161)
at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1008)
at com.vaadin.ui.Button.fireClick(Button.java:377)
at com.vaadin.ui.Button$1.click(Button.java:54)
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 com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:158)
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:118)
at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:408)
at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:273)
at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:79)
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1409)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:364)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1521)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1478)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
When reset Perspective code is done as in the given link https://www.eclipse.org/forums/index.php/m/1209165/srch=reset+perspective+in+e4#msg_1209165
and code called is
The code is as follows
public class ResetPerspective {
// private static final String MAIN_PERSPECTIVE_STACK_ID = "MainPerspectiveStack";
#Execute
public void execute(#Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
EModelService modelService, MApplication app,
EPartService partService) {
MWindow window = (MWindow) modelService.find("Main", app); //main
final MPerspective perspective = modelService.getActivePerspective(window);
final MUIElement snippet = modelService.cloneSnippet(app,
perspective.getElementId(), window);
snippet.setToBeRendered(true);
if (snippet != null) {
MElementContainer<MUIElement> parent = perspective.getParent();
perspective.setToBeRendered(false);
List<MWindow> existingDetachedWindows = new ArrayList<MWindow>();
existingDetachedWindows.addAll(perspective.getWindows());
MPerspective dummyPerspective = (MPerspective) snippet;
while (dummyPerspective.getWindows().size() > 0) {
MWindow detachedWindow = dummyPerspective.getWindows()
.remove(0);
perspective.getWindows().add(detachedWindow);
}
parent.getChildren().remove(perspective);
parent.getChildren().add(snippet);
System.out.println(parent.getChildren().get(0).getElementId());
partService.switchPerspective((MPerspective) snippet);
}
}
}
and reset perspective is selected gives the following error
The error is as follows
!ENTRY org.eclipse.e4.ui.workbench 4 0 2014-06-10 11:28:54.063
!MESSAGE Internal Error
!STACK 0
org.eclipse.e4.core.di.InjectionException: java.lang.IllegalArgumentException:
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:850)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionItem.java:743)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$7(HandledContributionItem.java:727)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$4.handleEvent(HandledContributionItem.java:662)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:140)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:162)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: java.lang.IllegalArgumentException:
at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
at org.eclipse.core.runtime.Assert.isLegal(Assert.java:47)
at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.findElementsRecursive(ModelServiceImpl.java:286)
at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.findElements(ModelServiceImpl.java:371)
at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.getActivePerspective(ModelServiceImpl.java:1075)
at bomb.handlers.ResetPerspective.execute(ResetPerspective.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
... 33 more
It looks like you do not have a window in your application model with the id "Main" so modelService.find("Main", app) is returning null. null is an illegal argument for modelService.getActivePerspective(window) so you get an error.
You must adapt this code you found to use the ids for your application. You must also follow the instructions for creating snippets for the perspectives.
I want upload file in /WEB-INF/files using a relative path in Bean. I using Maven project Java EE in Eclipse. this is part of code in Bean (package Service.Bean):
// Create file with unique name in upload folder and write to it.
file = File.createTempFile(prefix + "_", "." + suffix,new File("/WEB-INF/files"));
output = new FileOutputStream(file);
IOUtils.copy(uploadedFile.getInputstream(), output);
fileName = file.getName();
this is Exception :
java.io.IOException: Le chemin d’accès spécifié est introuvable
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(Unknown Source)
at java.io.File.createTempFile(Unknown Source)
at service.FileUploadController.handleFileUpload(FileUploadController.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.el.parser.AstValue.invoke(AstValue.java:277)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:273)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at org.primefaces.component.fileupload.FileUpload.broadcast(FileUpload.java:290)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:755)
at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:931)
at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
/WEB-INF/files is an absolute path, so the File.createTempFile method searches for a WEB-INF folder under the root of your file system and can't find it. It's better to use:
new
File(Thread.currentThread().getContextClassLoader().getResource("../files").toURI())
since the default classpath in a WAR is WEB-INF/classes.
I'm developing an Eclipse Plugin.
Inside my plugin I have the following code:
Bundle bundle = Platform.getBundle("org.eclipse.acceleo.EcoreDiff2EDelta");
URL fileURL = bundle.getEntry("src/metamodel/EcoreDiff.ecore");
String uri = null;
try {
uri = FileLocator.resolve(fileURL).getFile();
} catch (IOException e1) {
e1.printStackTrace();
}
Resource resource = resourceSet.getResource(URI.createURI(uri), true);
This code accesses a resource (EcoreDiff.ecore) which resides inside my plugin, in the src/metamodel folder.
When I run the plugin by right clicking on the project folder -> run as -> eclipse application everything works fine.
But if I export the plugin as "Deployable Plugin and Fragments"
I get the stack trace that follows, which basically means that it could not find the EcoreDiff.ecore file.
I've been trying to fix this for two days, I don't get whats wrong...
java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:275)
at org.eclipse.ui.internal.progress.ProgressManager$3.run(ProgressManager.java:960)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:995)
at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:970)
at org.eclipse.ui.internal.progress.ProgressManager.run(ProgressManager.java:1166)
at org.eclipse.acceleo.EcoreDiff2EDelta.ui.popupMenus.AcceleoGenerateEcoreDiff2EDeltaAction.run(AcceleoGenerateEcoreDiff2EDeltaAction.java:91)
at org.eclipse.ui.actions.ActionDelegate.runWithEvent(ActionDelegate.java:70)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:241)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1022)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:916)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:585)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:540)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
Caused by: java.lang.NullPointerException
at org.eclipse.core.internal.runtime.Activator.getURLConverter(Activator.java:321)
at org.eclipse.core.runtime.FileLocator.resolve(FileLocator.java:227)
at org.eclipse.acceleo.EcoreDiff2EDelta.main.Generate.registerPackages(Generate.java:359)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.initialize(AbstractAcceleoGenerator.java:422)
at org.eclipse.acceleo.EcoreDiff2EDelta.main.Generate.<init>(Generate.java:97)
at org.eclipse.acceleo.EcoreDiff2EDelta.ui.common.GenerateAll.doGenerate(GenerateAll.java:90)
at org.eclipse.acceleo.EcoreDiff2EDelta.ui.popupMenus.AcceleoGenerateEcoreDiff2EDeltaAction$1.run(AcceleoGenerateEcoreDiff2EDeltaAction.java:76)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Root exception:
java.lang.NullPointerException
at org.eclipse.core.internal.runtime.Activator.getURLConverter(Activator.java:321)
at org.eclipse.core.runtime.FileLocator.resolve(FileLocator.java:227)
at org.eclipse.acceleo.EcoreDiff2EDelta.main.Generate.registerPackages(Generate.java:359)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.initialize(AbstractAcceleoGenerator.java:422)
at org.eclipse.acceleo.EcoreDiff2EDelta.main.Generate.<init>(Generate.java:97)
at org.eclipse.acceleo.EcoreDiff2EDelta.ui.common.GenerateAll.doGenerate(GenerateAll.java:90)
at org.eclipse.acceleo.EcoreDiff2EDelta.ui.popupMenus.AcceleoGenerateEcoreDiff2EDeltaAction$1.run(AcceleoGenerateEcoreDiff2EDeltaAction.java:76)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
In your deployed plugin, "metamodel" should be a folder in the root of your jar, if it is specified in your build.properties. If you look in the jar, is it there?
Then try:
URL url = bundle.getEntry("metamodel/EcoreDiff.ecore");
URL fileURL = org.eclipse.core.runtime.FileLocator.toFileURL(URL);
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.