GeoTools with GWT (Development Mode Jetty) - gwt

Using GeoTools with GWT, I get the following stack trace when running my app in Development Mode:
WARNING: Can't load a service for category "CRSAuthorityFactory". Cause is "ServiceConfigurationError: org.opengis.referencing.crs.CRSAuthorityFactory: Provider org (...) lang.ClassCastException: class org.geotools.referencing.operation.DefaultMathTransformFactory".
sun.misc.ServiceConfigurationError: org.opengis.referencing.crs.CRSAuthorityFactory: Provider org.geotools.referencing.factory.epsg.DefaultFactory could not be instantiated: java.lang.ClassCastException: class org.geotools.referencing.operation.DefaultMathTransformFactory
at sun.misc.Service.fail(Unknown Source)
at sun.misc.Service.access$200(Unknown Source)
at sun.misc.Service$LazyIterator.next(Unknown Source)
at org.geotools.factory.FactoryRegistry.register(FactoryRegistry.java:829)
at org.geotools.factory.FactoryRegistry.scanForPlugins(FactoryRegistry.java:773)
at org.geotools.factory.FactoryRegistry.scanForPluginsIfNeeded(FactoryRegistry.java:808)
at org.geotools.factory.FactoryRegistry.getUnfilteredProviders(FactoryRegistry.java:229)
at org.geotools.factory.FactoryRegistry.getServiceImplementation(FactoryRegistry.java:429)
at org.geotools.factory.FactoryRegistry.getServiceProvider(FactoryRegistry.java:364)
at org.geotools.factory.FactoryCreator.getServiceProvider(FactoryCreator.java:143)
at org.geotools.referencing.ReferencingFactoryFinder.getAuthorityFactory(ReferencingFactoryFinder.java:216)
at org.geotools.referencing.ReferencingFactoryFinder.getCRSAuthorityFactory(ReferencingFactoryFinder.java:436)
This seems to be a Jetty thing, because it works fine when I deploy to another container. Any ideas on how to fix this?

It looks like it's a problem with class-loading in Jetty. Found this GeoTools issue, and this GWT patch, both of which seem to address the problem, but neither of which seem to be getting attention at the moment. GeoMajas solves the problem with a ServletFilter to hijack Jetty's classloader: I ended up taking the same approach, which worked.

Related

Omnifaces ViewScoped with PWAResourceHandler

I have a web application currently deployed on Wildfly 23.0.2, using JSF 2.3 and OpenJDK 11.
I'm also using the latest version of OmniFaces (3.11).
One of the application requirements is PWA support. For this, I'm using PWAResourceHandler exactly as described in the omnifaces webpage.
I would like to use the ViewScoped annotation from OmniFaces instead of the one from JSF. I know this OmniFaces-JSF gap is reducing, but for testing purposes I changed the ViewScoped annotation import.
After this change, in all pages with
<f:metadata>
<f:viewParam name="myParam" value="#{omnifacesTest.myParam}" />
</f:metadata>
I get the following error:
Caused by: java.lang.IllegalStateException: Component ID omnifaces_omnifaces_js has already been found in the view.
at com.sun.jsf-impl#2.3.14.SP04//com.sun.faces.util.Util.checkIdUniqueness(Util.java:1299)
at com.sun.jsf-impl#2.3.14.SP04//com.sun.faces.util.Util.checkIdUniqueness(Util.java:1283)
at com.sun.jsf-impl#2.3.14.SP04//com.sun.faces.application.view.FaceletPartialStateManagementStrategy.saveView(FaceletPartialStateManagementStrategy.java:453)
at com.sun.jsf-impl#2.3.14.SP04//com.sun.faces.application.StateManagerImpl.saveView(StateManagerImpl.java:64)
at com.sun.jsf-impl#2.3.14.SP04//com.sun.faces.application.view.WriteBehindStateWriter.getState(WriteBehindStateWriter.java:310)
at com.sun.jsf-impl#2.3.14.SP04//com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:204)
at com.sun.jsf-impl#2.3.14.SP04//com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:484)
at com.sun.jsf-impl#2.3.14.SP04//com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:170)
at javax.faces.api#3.0.0.SP04//javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
at javax.faces.api#3.0.0.SP04//javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
at javax.faces.api#3.0.0.SP04//javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:132)
at deployment.my-application-0.0.1-SNAPSHOT.ear.my-web.war//org.omnifaces.viewhandler.OmniViewHandler.renderView(OmniViewHandler.java:155)
at com.sun.jsf-impl#2.3.14.SP04//com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:102)
at com.sun.jsf-impl#2.3.14.SP04//com.sun.faces.lifecycle.Phase.doPhase(Phase.java:76)
at com.sun.jsf-impl#2.3.14.SP04//com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:199)
at javax.faces.api#3.0.0.SP04//javax.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:708)
If I remove the viewParam from f:metadata, or disable PWA support, the error disappears.
I can't seem to find a reason for this behaviour.
Has anynone else found this problem? Any suggestions on how to handle this?
Thanks for your help!

AEM6.2: com.day.cq.wcm.tags.IncludeTag Error

We have AEM6.2 node environment and we are trying to access login.html but getting error as below.
After searching I came to know that java version could be one of the possible reason but I am already using Java 8 for this application. I am out of ideas. Any suggestions greatly appreciated.
14.09.2018 14:08:40.299 *ERROR* [192.156.110.11 [1536948520114] GET /content/en/account/login.html HTTP/1.1] com.day.cq.wcm.tags.IncludeTag Error while executing script defaulttopnav
org.apache.sling.api.scripting.ScriptEvaluationException:
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:416)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:184)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:491)
at com.day.cq.wcm.tags.IncludeTag.includeScript(IncludeTag.java:178)
at com.day.cq.wcm.tags.IncludeTag.doEndTag(IncludeTag.java:95)
at org.apache.jsp.apps.components.navigation.topnavigation_jsp._jspService(navigation_jsp.java:329)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.sling.api.SlingException:
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspExceptionInternal(JspServletWrapper.java:691)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:608)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:533)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:284)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:102)
at org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:536)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:388)
... 201 common frames omitted
Caused by: java.lang.NullPointerException: null
at org.apache.jsp.apps.components.topnavigation.defaulttopnav_jsp._jspService(defaulttopnav_jsp.java:347)
at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502)
... 206 common frames omitted
Thank you.
General solution for errors are thrown by servlets compiled from jsp files, is to recompile the jsp again.
Goto system/console and verify if all bundles are in active state
Goto sling --> jsp and recompile all jsps.
This works if errors are thrown from otb jsp. However when custom application jsps throw error, you ll need to fix the custom jsp code by handling the error.
Another foolproof way to clear cached jsp class files is to delete /var/classes
The stacktrace indicates the NPE is stemming from defaulttopnav_jsp.java, line 347. Analysing the generated java file is the way to go.
Since AEM 6.1, the default ClassLoader was replaced by FSClassLoader and the generated .java files are no longer stored under /var/classes.
To locate the .java file you will need to locate the bundle ID for the FSClassLoader bundle, then the java files will be located at:
[AEM_INSTALL_DIR]/crx-quickstart/launchpad/felix/bundle[BUNDLE_ID]/data/classes
There is also a sling plugin which will help you view the generated java file from OSGi console. Check out these posts for that.

IllegalAccessError throwing in linux ( suse 10)

enter code herewe are using c3p0 jar for databse pooling. Now from c3p0 code, the following exception is comming
Caused by: java.lang.IllegalAccessError: tried to access class com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource$1 from class com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.setUpPropertyEvents(AbstractPoolBackedDataSource.java:74)
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.(AbstractPoolBackedDataSource.java:63)
at com.mchange.v2.c3p0.ComboPooledDataSource.(ComboPooledDataSource.java:109)
at com.mchange.v2.c3p0.ComboPooledDataSource.(ComboPooledDataSource.java:105)
Now in AbstractPoolBackedDataSource.java (line 74)
PropertyChangeListener l = new PropertyChangeListener()
PropertyChangeListener l = new PropertyChangeListener()
{
public void propertyChange( PropertyChangeEvent evt )
{ resetPoolManager(); }
};
So, PropertyChangeListener is the inner class here .. AbstractPoolBackedDataSource$1
PropertyChangeListener is a java class java.beans.PropertyChangeListener !!
What can be the reason ? This is only happening in linux(suse 10). In Windows it is working fine(jdk 1.6_10 and jre 1.6_20). I have tried with different jdk,jre combinations ( jdk 1.6_25 etc )
I have resolved the problem using some trial and error.
Also I found, this is not os dependable as I have suspected earlier. This is easily reproducible and looks like an potential class loading bug.( though I am not sure whether it is in equinox implementation or in java !!).
Before explaining the solution, let me describe the scenario more elaborately.
We have our code deployed in a osgi(equinox) framework. There are two bundles which uses the c3p0 jar for database pooling and one of them exports the c3p0 packages. This bundle starts before the other one.
Now, according to osgi specification, osgi class loader should maintain separate class loader instances for separate bundles. Now when the second bundle tries to load classes from the c3p0 jar, its class-loader may find (from parent delegation) that the classes are already loaded !! But they are loaded from different context, which is causing the access violation.
This is initial findings, I will try to debug with the eclipse code and may be dig more into it. After changing the bundle start order, this is resolved.

Flash Builder Export Release Build Fails

I'm having an issue when trying to export the release build of my AIR application in Flash Builder 4.5. After choosing the key to sign the package and clicking finish to complete the export, it errors saying that "Error occurred while saving the project settings: "default" build target cannot be found for the selected project." I've included the error message output to the log in the .metadata folder. Any help would be great as this is baffling to me.
!ENTRY com.adobe.flexbuilder.project 4 43 2011-05-10 15:56:11.432
!MESSAGE Failed to get build target settings: default
!STACK 0
java.lang.Exception
at com.adobe.flexbuilder.project.internal.FlexProjectCore.createErrorSta tus(FlexProjectCore.java:1009)
at com.adobe.flexbuilder.util.logging.GlobalLogImpl.log(GlobalLogImpl.ja va:66)
at com.adobe.flexbuilder.util.logging.GlobalLog.log(GlobalLog.java:52)
at com.adobe.flexbuilder.project.ui.utils.ProjectBuildPackagingUI.doAppl ySettings(ProjectBuildPackagingUI.java:754)
at com.adobe.flexbuilder.project.ui.utils.ProjectBuildPackagingUI.applyS ettings(ProjectBuildPackagingUI.java:781)
at com.adobe.flexbuilder.exportimport.releaseversion.ui.ExportReleaseVer sionBuildPackagingPageContent.saveSettings(ExportReleaseVersionBuildPa ckagingPageContent.java:131)
at com.adobe.flexbuilder.exportimport.releaseversion.ui.ExportReleaseVer sionBuildPackagingPage.saveSettings(ExportReleaseVersionBuildPackaging Page.java:84)
at com.adobe.flexbuilder.exportimport.releaseversion.ui.ExportReleaseVer sionWizard.performFinish(ExportReleaseVersionWizard.java:144)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java :811)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java :430)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java: 234)
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:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at com.adobe.flexbuilder.exportimport.releaseversion.ExportReleaseVersio nAction$1.run(ExportReleaseVersionAction.java:97)
at com.adobe.flexbuilder.exportimport.releaseversion.ExportReleaseVersio nAction.run(ExportReleaseVersionAction.java:103)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:2 51)
at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginActio n.java:229)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContri butionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionC ontributionItem.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:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.ja va:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.jav a:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.adobe.flexbuilder.standalone.FlashBuilderApplication.start(FlashB uilderApplication.java:108)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandl e.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runAppli cation(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(Ec lipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.ja va:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.ja va:179)
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:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
Update:
I have tried what J_A_X has recommended. Unfortunately none of those work. It seems to be a problem somewhere within the project settings. We have also tried running the export release build for this project on different machines with fresh installs of flash builder, but the same error message is produced every time. We've looked through so many settings it may come down to having to create a new project and copy all the code into the new application.
Although quite an old post I have just run into the same problem using Flash Builder 4.6. I am fairly new to Air/Flex/Flash etc so apologies in advance for any terminology errors! Still whilst trying to export my new project I did come across exactly the same error as you, and after a lot of searching on Google and starting to lose the will to live, tried Bing and found this link http://forums.adobe.com/thread/850398?start=0&tstart=0
When your Flash Builder project is closed edit the .actionScriptProperties file in Notepad and have a look for a buildTargets section - in my file this was simply <buildTargets/>. I replaced it with the snippet Sandeep had posted in the forum
<buildTargets>
<buildTarget buildTargetName="default">
<airSettings airCertificatePath="" airTimestamp="true" anePathSet="false" version="1">
<airExcludes/>
<anePaths/>
</airSettings>
<actionScriptSettings version="1"/>
</buildTarget>
</buildTargets>
To my delight it was then possible to export my application as a release build.
By the sounds of things from other forums, for your settings file to be in this state in the first place may be due to older versions of FB or in my case I'm pretty sure it is because I used AIRLaunchPad to create my project - which did seem like a good idea at the time. Anyway I hope this may help anyone in the same predicament!
I had a similar issue and solved it..
In Flash Builder, you have to right-click your project -> properties
Click "ActionScript Applications" in the left column
Click Add, and select your main document class, which would be specified in Flash
Professional
Look like an eclipse error. Try to restart eclipse and see if that helps. Might be that Flash Builder was mis-installed (which normally means you see other error) or that your memory settings are too low, you should check your eclipse.ini to increase memory.

ATG taglibs on OSGI problems

We're currently creating an app that needs ATG taglibs on SLING/OSGI, we have created a bundle with these taglibs and uploaded it, of course these taglibs call ATG classes, so we are including them in the bootdelegation, using sling.properties file.
sling.bootdelegation.simple=atg.nucleus
sling.bootdelegation.class.atg.nucleus.Nucleus=atg.appassembly, \
atg.appassembly.ant, \
atg.appassembly.progress, \
atg.appassembly.util, \
...ETC...
First we got this error:
org.apache.sling.api.scripting.ScriptEvaluationException: atg/taglib/dspjsp/ImportBeanTag
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:163)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:107)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:226)
at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:465)
....
....
Caused by: java.lang.NoClassDefFoundError: atg/taglib/dspjsp/ImportBeanTag
at org.apache.jsp.apps.mygeometrixx.components.contenpage.center_jsp._jspx_meth_dsp_005fimportbean_005f0(center_jsp.java:177)
at org.apache.jsp.apps.mygeometrixx.components.contenpage.center_jsp._jspService(center_jsp.java:154)
at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at
So we added atg.taglib.dspjsp to the packages to be added in bootdelegation sling.properties file.
Then we got this error:
org.apache.sling.api.scripting.ScriptEvaluationException: atg.taglib.dspjsp.ImportBeanTag
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:163)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:107)
at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:226)
at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:465)
...
Caused by: java.lang.ClassCastException: atg.taglib.dspjsp.ImportBeanTag
at org.apache.sling.scripting.jsp.jasper.runtime.TagHandlerPool.get(TagHandlerPool.java:125)
at org.apache.jsp.apps.mygeometrixx.components.contenpage.center_jsp._jspx_meth_dsp_005fimportbean_005f0(center_jsp.java:177)
at org.apache.jsp.apps.mygeometrixx.components.contenpage.center_jsp._jspService(center_jsp.java:154)
at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
All this is running on JBOSS.
Is there a way to avoid this class conflict that is causing the cast exception?
The class cast exception is usually a sign that that class is being made available in two different places (in your case probably via bootdelegation and maybe via a bundle that exports this class). That's what I would investigate first.
Also, to make things more explicit, I would in general advise you to not use boot delegation but instead export these packages explicitly through the system bundle. That way at least you can better debug where classes come from and how things are "wired" by the OSGi resolver.
When loading the ATG tag libraries from outside of the OSGi framework you also have to make sure to provide the JSP API from outside of the framework. By default Sling embeds the JSP API (in the JSP Scripting Bundle).
There are various ways to expose the JSP API into the framework. One is to add them to the system packages in the sling.properties file:
sling.system.packages.atg_jsp = javax.servlet.jsp;javax.servlet.jsp.el; \
javax.servlet.jsp.resources;javax.servlet.jsp.tagext;version=2.1.0