Liferay Input Edtior throwing error (__ckeditor.java : 827) - configuration

I am new to liferay portlets. I am facing a strange issue with liferay-ui:input-editor.
My environment,
Liferay 6.2 CE
Maven
Weblogic 12c
I have a working portlet which have a configuration.jsp for configuring some contents. The portlet works fine if I deploy the portlet using the automatic deployment by copying into liferayAuto folder. But when I deploy the preprocessed manually, I am getting the below error whenever I try to open the configuration. The issue is with liferay-ui:input-editor, as it works fine when I remove the tag. Below is the error.
java.lang.NullPointerException
at jsp_servlet._html._js._editor.__ckeditor._jspService(__ckeditor.java:827)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:35)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:346)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:188)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:119)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:588)
at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:481)
at com.liferay.portal.servlet.DirectServletPathRegisterDispatcher.include(DirectServletPathRegisterDispatcher.java:55)
at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.doDispatch(ClassLoaderRequestDispatcherWrapper.java:78)
at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.include(ClassLoaderRequestDispatcherWrapper.java:53)
at com.liferay.taglib.util.IncludeTag.include(IncludeTag.java:295)
at com.liferay.taglib.util.IncludeTag.doInclude(IncludeTag.java:192)
In __ckeditor.java the line 827 shows this,
doAsGroupId = (Long)request.getAttribute("liferay-ui:input-editor:groupId");}
Any help is much appreciated ...

Adding <liferay-theme:defineObjects /> in configuration.jsp solved the issue.

Related

Analyze code with SonarLint for IntelliJ

i have installed latest SonarLint version 2 for IntelliJ and configure it to work with my SonarQube server version 5.2. i also bind SonarLint to my project in SonarQube.
When i'm trying to run analysis for one file or for all project, i'm getting below error:
Error running SonarLint analysis
java.lang.NullPointerException
at org.sonarlint.intellij.analysis.SonarLintAnalysisConfigurator.analyzeModule(SonarLintAnalysisConfigurator.java:90)
at org.sonarlint.intellij.analysis.SonarLintTask.run(SonarLintTask.java:93)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:563)
at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:152)
at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:452)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:402)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:137)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$1.run(ProgressManagerImpl.java:126)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:400)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:56)
Any idea what is wrong?
SonarLint 2.0 is broken in IDEA 14.
A bug fix will be released soon.
I've just created a ticket: https://jira.sonarsource.com/browse/SLI-62.

FileDialog does not display when choosing "Add External JARs..." w/ log exception

I have Eclipse Juno installed on my new MacBook Air Yosemite. I have imported a project I was working on in my old Mac and I need to add a reference to a new Jar. Trouble is, nothing happens when I click on the Add External JARs!
Eclipse is up-to-date. It appears it's just broken and may have something to do with Yosemite - I created a new project and cannot add any external JARs in that project either.
There is a work-around by putting the jars directly into the project's lib folder. But, this creates duplicate file system objects.
Please advise
This is the entry in Eclipse error log:
!ENTRY org.eclipse.ui 4 0 2015-02-11 11:41:21.303
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
at org.eclipse.swt.widgets.FileDialog.panel_shouldShowFilename(FileDialog.java:348)
at org.eclipse.swt.widgets.Display.dialogProc(Display.java:5410)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSSavePanel.setAccessoryView(NSSavePanel.java:46)
at org.eclipse.swt.widgets.FileDialog.open(FileDialog.java:254)
at org.eclipse.jdt.ui.wizards.BuildPathDialogAccess.chooseExternalJAREntries(BuildPathDialogAccess.java:472)
at org.eclipse.jdt.internal.ui.wizards.buildpaths.LibrariesWorkbookPage.openExtJarFileDialog(LibrariesWorkbookPage.java:794)
at org.eclipse.jdt.internal.ui.wizards.buildpaths.LibrariesWorkbookPage.libaryPageCustomButtonPressed(LibrariesWorkbookPage.java:257)
at org.eclipse.jdt.internal.ui.wizards.buildpaths.LibrariesWorkbookPage.access$0(LibrariesWorkbookPage.java:250)
at org.eclipse.jdt.internal.ui.wizards.buildpaths.LibrariesWorkbookPage$LibrariesAdapter.customButtonPressed(LibrariesWorkbookPage.java:199)
at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField.buttonPressed(TreeListDialogField.java:171)
at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField.doButtonSelected(TreeListDialogField.java:400)
at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField.access$2(TreeListDialogField.java:396)
at org.eclipse.jdt.internal.ui.wizards.dialogfields.TreeListDialogField$2.widgetSelected(TreeListDialogField.java:361)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4188)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1467)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1490)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1475)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4031)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3658)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:832)
at org.eclipse.jface.window.Window.open(Window.java:808)
at org.eclipse.ui.dialogs.PropertyDialogAction.run(PropertyDialogAction.java:160)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:519)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:420)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4188)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1467)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1490)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1475)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4031)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3658)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
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.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
I had the exact same issue. Looks like a weird bug somewhere. Restarting Eclipse worked for me.
Updating Eclipse fixes the issue.
I am experiencing the same issue with Juno on Yosemite. See the following
eclipse bug, which might be cause of the issue. You might have to switch to latest Eclipse, or at least to the version which contains the fix.

Separate database configuration

I've been dealing with this problem for couple of days now and I can't get around to solve it. The working setup that I need is: two separate databases, one for JUnit testing and the other for the pure application access purposes.
I've been using MySQL for the the application part, since I need the full control and support and the other database that I am considering is Derby or H2 since the speed is essential here.
Okay, the MySQL database is working as it should, the JUnit tests are 100% success when I run them through
and there are no problems there. However, when I try to configure my project with the second database, the
problems arise. I've been searching for answers and I found the following setup when adding additional database to your spring-roo project:
Additional ApplicationContext that I've put in: src/test/resources/META-INF/spring/ and named as: applicationContextTest.xml
As well as additional ApplicationContextSecurity file that I've created in the same folder and named applicationContext-securityTest.xml
Necessary changes in pom.xml, persistence.xml and web.xml files
And also I've configured #ApplicationContext in JUnit test class to use appropriate files
Also separate database_test.properties located in the same folder as mentioned above
The exception that I am constantly getting is that the EntityManager has not been injected. I know this is a scarce information to work on, but I just want to get few opinions before, lets say, posting the whole code and the files that go along so that you people can see if I have made some silly mistakes(which at this point I am sure I haven't) or that I am missing some additional changes that need to be made.
The configuration I am using is: latest spring roo, maven and eclipse 4.2.2
Here is the stack trace that I get for the exception:
java.lang.IllegalStateException: Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)
at eu.execom.assessmenttool.domain.ExamFormulae_Roo_Jpa_ActiveRecord.entityManager_aroundBody0(ExamFormulae_Roo_Jpa_ActiveRecord.aj:19)
at eu.execom.assessmenttool.domain.ExamFormulae_Roo_Jpa_ActiveRecord.ajc$interMethod$eu_execom_assessmenttool_domain_ExamFormulae_Roo_Jpa_ActiveRecord$eu_execom_assessmenttool_domain_ExamFormulae$entityManager(ExamFormulae_Roo_Jpa_ActiveRecord.aj:1)
at eu.execom.assessmenttool.domain.ExamFormulae.entityManager(ExamFormulae.java:1)
at eu.execom.assessmenttool.domain.ExamFormulae_Roo_Jpa_ActiveRecord.ajc$interMethodDispatch1$eu_execom_assessmenttool_domain_ExamFormulae_Roo_Jpa_ActiveRecord$eu_execom_assessmenttool_domain_ExamFormulae$entityManager(ExamFormulae_Roo_Jpa_ActiveRecord.aj)
at eu.execom.assessmenttool.domain.ExamFormulae_Roo_Jpa_ActiveRecord.findAllExamFormulaes_aroundBody4(ExamFormulae_Roo_Jpa_ActiveRecord.aj:28)
at eu.execom.assessmenttool.domain.ExamFormulae_Roo_Jpa_ActiveRecord.ajc$interMethod$eu_execom_assessmenttool_domain_ExamFormulae_Roo_Jpa_ActiveRecord$eu_execom_assessmenttool_domain_ExamFormulae$findAllExamFormulaes(ExamFormulae_Roo_Jpa_ActiveRecord.aj:1)
at eu.execom.assessmenttool.domain.ExamFormulae.findAllExamFormulaes(ExamFormulae.java:1)
at eu.execom.assessmenttool.domain.ExamFormulae_Roo_Jpa_ActiveRecord.ajc$interMethodDispatch1$eu_execom_assessmenttool_domain_ExamFormulae_Roo_Jpa_ActiveRecord$eu_execom_assessmenttool_domain_ExamFormulae$findAllExamFormulaes(ExamFormulae_Roo_Jpa_ActiveRecord.aj)
at eu.execom.assessmenttool.web.GenerateExamControllerTest.generateExamQuestions(GenerateExamControllerTest.java:43)
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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
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)
I have experienced this problem before.
I have written a blog article on how to achieve this setup:
www.solubris.com/blog/overriding_spring_context_for_testing
I had this problem when the environment in which I executed the roo project could not load AspectJ for some reason.
Specifically, it occurred to me when:
The pom.xml in eclipse give errors on the aspectj dependencies (M2E plugin execution not covered error). Solution was to do a quick fix on the error, ignore plugin goal, then set it as execute on preferences, as explained here http://wiki.eclipse.org/M2E_plugin_execution_not_covered.
I was running the Roo project on Jetty version 8. Solution was to switch to version 9.
It maybe not your case but I hope will help others!

Idea 12/Haxe2.10(win): why do I get AssertionError: Wrong node when I try to build a project?

My OS is Win7 64 Enterprise.
I've just installed idea12 (ultimate), added Haxe plugin (0.5.6), installed haxe sdk 2.10win, also tried using 2.09win that comes with fdt.
When I try to build a project with Idea, I get following exception:
Internal error: (java.util.concurrent.ExecutionException) java.lang.AssertionError: Wrong node: [null]
java.util.concurrent.ExecutionException: java.lang.AssertionError: Wrong node: [null]
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
at java.util.concurrent.FutureTask.get(FutureTask.java:111)
at org.jetbrains.jps.model.serialization.JpsProjectLoader.a(JpsProjectLoader.java:231)
at org.jetbrains.jps.model.serialization.JpsProjectLoader.a(JpsProjectLoader.java:105)
at org.jetbrains.jps.model.serialization.JpsProjectLoader.loadProject(JpsProjectLoader.java:81)
at org.jetbrains.jps.cmdline.JpsModelLoaderImpl.loadModel(JpsModelLoaderImpl.java:41)
at org.jetbrains.jps.cmdline.BuildRunner.load(BuildRunner.java:60)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:169)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:94)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:105)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:26)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.AssertionError: Wrong node: [null]
at com.intellij.util.xmlb.BeanBinding._deserializeInto(BeanBinding.java:133)
at com.intellij.util.xmlb.BeanBinding.deserialize(BeanBinding.java:120)
at com.intellij.util.xmlb.XmlSerializer.deserialize(XmlSerializer.java:58)
at org.jetbrains.jps.haxe.model.module.JpsHaxeModuleType$1.loadProperties(JpsHaxeModuleType.java:26)
at org.jetbrains.jps.haxe.model.module.JpsHaxeModuleType$1.loadProperties(JpsHaxeModuleType.java:23)
at org.jetbrains.jps.model.serialization.JpsProjectLoader.a(JpsProjectLoader.java:294)
at org.jetbrains.jps.model.serialization.JpsProjectLoader.a(JpsProjectLoader.java:255)
at org.jetbrains.jps.model.serialization.JpsProjectLoader.access$000(JpsProjectLoader.java:44)
at org.jetbrains.jps.model.serialization.JpsProjectLoader$2.call(JpsProjectLoader.java:225)
at org.jetbrains.jps.model.serialization.JpsProjectLoader$2.call(JpsProjectLoader.java:222)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:35)
... 7 more
This issue can't be in Haxe sdk as it compiles project fine under fdt (however, sdk-based autocomplete is not working, but I think it is not related to idea problem). Other project types (like java) are working fine with idea.
So, what shall I try to solve this issue? What does that exception mean?
Update: Installed idea 12.01 on WIN7 32 Professional, created new project - same exception happens. So, I conclude that this issue is not related to 32/64 bit OS or Java. This issue is not specific to idea version 12.00.
May be it is important that new project created by idea contains neither .hx classes, nor any build configuration files(like .hxml). I tried to create .hx main class and .hxml build for it, but idea still does not build project.
Changing run configuration to one of those files or to .swf result(built manually) or to cmd does not help(run option still not available).
I also tried to build with ant task, and it succeeded, but idea still can't build a project when I choose this option from menu.
The problem will be fixed in IDEA 12.0.2, thank you for reporting. As a workaround you can switch off 'Use external build' option in File | Settings | Compiler.
I cannot reproduce your error. Please try the usual reinstall, remove/add the Haxe SDK again, Invalidate Cache and restart (from the file menu).
If you can reproduce this problem with a fresh install, the best place for Idea support is their forum or create a new issue on their tracker http://youtrack.jetbrains.com/issues/IDEA?p=0&q=haxe
They have been very helpful to me in the past.

Why is Restlet unable to Register the JSON Converter?

I'm at my wit's end here - never seemed to have faced this problem. I find it relatively easy to set up quick HelloWorld applications to ensure Restlet 2.0 is up and running. However, I'm facing a strange exception which I've never encountered before. I have the jars in my classpath as well as the WEB-INF/lib folder but for some reason I keep getting the following exception:
INFO: Unable to register the helper org.restlet.ext.json.JsonConverter
java.lang.NoClassDefFoundError: org/json/JSONException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at org.restlet.engine.Engine.registerHelper(Engine.java:718)
at org.restlet.engine.Engine.registerHelpers(Engine.java:753)
at org.restlet.engine.Engine.registerHelpers(Engine.java:793)
at org.restlet.engine.Engine.discoverConverters(Engine.java:501)
at org.restlet.engine.Engine.<init>(Engine.java:337)
at org.restlet.engine.Engine.register(Engine.java:248)
at org.restlet.engine.Engine.register(Engine.java:237)
at org.restlet.engine.Engine.getInstance(Engine.java:149)
at org.restlet.engine.Engine.getLogger(Engine.java:204)
at org.restlet.Context.<init>(Context.java:160)
at org.restlet.Context.<init>(Context.java:133)
at org.restlet.ext.servlet.ServerServlet.createComponent(ServerServlet.java:422)
at org.restlet.ext.servlet.ServerServlet.getComponent(ServerServlet.java:763)
at org.restlet.ext.servlet.ServerServlet.init(ServerServlet.java:881)
at javax.servlet.GenericServlet.init(GenericServlet.java:242)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1428)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:1060)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:187)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: org.json.JSONException
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 org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:959)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1430)
... 45 more
The following jars are in my classpath and the WEB-INF/lib folders:
org.json.jar
org.restlet.jar
org.restlet.ext.servlet
org.restlet.ext.json
I'm building the project using Eclipse and deploying on Glassfish. The web.xml etc are all fine and no deployment errors...however, this one has had me scratching my head for a while.
Any ideas?
I had the same or a similar problem. I want to override the jackson representation and remove some dependencies it imports but when I do, the jackson converter is not discovered.
Then I've found why in my case: the jar contains a META-INF/services folder with a file called org.restlet.engine.converter.ConverterHelper. That's how discovery works.
I've tried to add that files to my path and it didn't work, don't know. So I ended up registering the Jackson converter
Engine.getInstance().getRegisteredConverters().add(new JacksonConverter());
For some reason the error went away when I swapped the file with that from the Restlet Distribution - in the org.json folder of the Restlet Java EE version.
Seems maybe something was missing in the org.json.jar that I had from the json website, don't know...
It looks like your application isn't able to find a library. If you're building your app in Eclipse, have you made sure that the libraries are being exported? Go to the Build Path section, and make sure the checkbox for exporting libraries is checked.