Java Project to Groovy - Libraries don't work - java

I wrote a program in java and now I want to run it using groovy. I did this as an exercise, so don't question why I haven't programmed in groovy in the first place. ;)
I used many libraries in java, so I copied them to the %GROOVY_HOME%\lib directory. After I did this, I wasn't able to run groovyConsole.exe anymore, so ran groovyConsole.bat (using cmd) to get the error, which is following:
C:\Program Files (x86)\Groovy\Groovy-2.4.11\bin>groovyConsole.bat
java.lang.reflect.InvocationTargetException
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.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
Caused by: javax.xml.parsers.FactoryConfigurationError: java.lang.ClassNotFoundException: org.apache.crimson.jaxp.SAXParserFactoryImpl
at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:116)
at org.apache.ivy.core.settings.XmlSettingsParser.doParse(XmlSettingsParser.java:160)
at org.apache.ivy.core.settings.XmlSettingsParser.parse(XmlSettingsParser.java:150)
at org.apache.ivy.core.settings.IvySettings.load(IvySettings.java:417)
at org.apache.ivy.core.settings.IvySettings$load.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at groovy.grape.GrapeIvy.<init>(GrapeIvy.groovy:97)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at groovy.grape.Grape.getInstance(Grape.java:121)
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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1850)
at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3758)
at org.codehaus.groovy.runtime.callsite.ClassMetaClassGetPropertySite.getProperty(ClassMetaClassGetPropertySite.java:51)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:296)
at groovy.ui.ConsoleIvyPlugin.addListener(ConsoleIvyPlugin.groovy:44)
at groovy.ui.ConsoleIvyPlugin$addListener.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at groovy.ui.Console.<init>(Console.groovy:242)
at groovy.ui.Console.<init>(Console.groovy:224)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247)
at groovy.ui.Console.main(Console.groovy:209)
... 6 more
The libs I used worked fine in eclipse using java. What can I do?
Additional question:
I found a way to use libraries by loading files. Is there a way to load intire directories with jar files?
this.getClass().classLoader.rootLoader.addURL(new File("file.jar").toURL())

You should not add your script dependencies to %GROOVY_HOME%/lib.
You should instead change your script to declare the dependencies it needs.
One way is to do as you found with the adding JAR URLs to a class loader. If you want to add a directory, list the directory and iterate over the JAR files, something like new File('path/to/dir').eachFileMatch('*.jar') { ...addURL(it.toURI().toURL()) }.
Btw. as you can see in my example, you should never use File.toURL(), this is deprecated since a long time. Always do File.toURI().toURL() instead.
Besides all this, there is a better way to depend on libraries in Groovy scripts, which is Grape. You can read more about it at http://groovy-lang.org/grape.html. Basically you just declare your dependencies with annotations and they are automatically downloaded from a Maven repository and added to the classpath of your script, including any transitive dependencies.

Related

Spring Boot, ClassNotDef Error with JaxB, Package -Info.java

I am using AJSC framework in SpringBoot with JaxB implementation. I built the stubs outside the project and copied them inside the project with proper directories.
However, during API execution, i get a classNotDef error. But I have seen my Jar file and i have the package-info class file inside the directory.
Caused by: java.lang.NoClassDefFoundError: BOOT-INF/classes/com/att/fpp/fpprome/opportunity/package-info (wrong name: com/att/fpp/fpprome/opportunity/package-info)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.annotations.common.util.StandardClassLoaderDelegateImpl.classForName(StandardClassLoaderDelegateImpl.java:57)
at org.hibernate.boot.internal.MetadataBuilderImpl$MetadataBuildingOptionsImpl$4.classForName(MetadataBuilderImpl.java:758)
at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.packageForName(JavaReflectionManager.java:148)
at org.hibernate.cfg.AnnotationBinder.bindPackage(AnnotationBinder.java:281)
at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.prepare(AnnotationMetadataSourceProcessorImpl.java:186)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.prepare(MetadataBuildingProcess.java:156)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:253)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:847)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:874)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:58)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at acsi.grid.gridcore.core.sql.EntityManagerHelper.getDefaultEntityManager(EntityManagerHelper.java:250)
at acsi.grid.gridcore.core.sql.EntityManagerHelper.getEntityManager(EntityManagerHelper.java:174)
at acsi.grid.gridcore.core.JdbcGridBagImpl.getEntityManager(JdbcGridBagImpl.java:188)
at acsi.grid.gridcore.core.JdbcGridBagImpl.put(JdbcGridBagImpl.java:163)
at com.att.fpp.fpprome.dao.impl.OpportunityDaoImpl.updateOpportunityDatabaseROME(OpportunityDaoImpl.java:497)
at com.att.fpp.fpprome.bo.impl.OpportunityBusinessObjectImpl.getOpptyInfo(OpportunityBusinessObjectImpl.java:78)
at com.att.fpp.fpprome.service.impl.OpportunityServiceImpl.getOpportunitiesById(OpportunityServiceImpl.java:62)
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.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
Also I noticed that I am not using apache.cxf anywhere in pom but yet it is being called here.
A possible solution for the NoClassDefFoundError originated by the package-info class: Spring boot, runnable jar can't load package-info.class
Found the issue.
The AJSC framework implementing the ADF (Hibernate based ORM) did not support package-info and hence searched for that class everytime.
Only way around was to execute the command to not generate the package-info during stubs generation.
Use -npa in XJC utility to suppress package-info and everything will work.
In case you got here by looking for a solution to a similar "package-info (wrong name:" issue, I fixed my problem by upgrading hibernate (since the one in the app was quite old).

How to initialize QApplication with Qt Jambi within TeamCenter rich client

I could run the "HelloWorld1" Qt-Jambi application with GUI as standalone.
I could run the "HelloWorld2" teamcenter-plugin (via Eclipse) inherited ViewPart.
Trying to init QApplication within plugin like below:
public class MyComView extends ViewPart
{
static
{
//try to init Qt-Jambi
//
System.out.println("QQ==before load qtjambi");
//
QApplication qap1 = QApplication.instance();
//
System.out.println("QQ==after get instance");
}
//...
}
My code is quite good compiled and linked.
But I have a java.lang.ClassNotFoundException error with below stacktrace:
!STACK 0
java.lang.NoClassDefFoundError: com/trolltech/qt/gui/QApplication
at com.mycom.myview.views.MyComView.<clinit>(MyComView.java:89)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:170)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:874)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:267)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:263)
at org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:63)
at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:324)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:226)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at org.eclipse.ui.internal.Perspective.showView(Perspective.java:2228)
at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1067)
at org.eclipse.ui.internal.WorkbenchPage$20.run(WorkbenchPage.java:3816)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3813)
at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3789)
at com.cals.testplugin2.handlers.CallMyViewPart.execute(CallMyViewPart.java:26)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:294)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:770)
at org.eclipse.ui.menus.CommandContributionItem.access$10(CommandContributionItem.java:756)
at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:746)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3880)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3473)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.teamcenter.rac.aifrcp.Application.runApplication(Unknown Source)
at com.teamcenter.rac.aifrcp.Application.start(Unknown Source)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
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:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java: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:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
Caused by: java.lang.ClassNotFoundException: com.trolltech.qt.gui.QApplication
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:489)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:405)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:393)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 59 more
What did I do wrong? How do I properly use Qt-Jambi within Eclipse-RCP, especially within a Teamcenter plugin?
java.lang.NoClassDefFoundError can be thrown for several reasons. The code compiles nicely, but throws that exception during runtime.
If you run it from the command-line within a .jar file, then it could be that it not listed in the manifest of the jar file.
If you run it with in Eclipse, check your classpaths, or make sure the class can be found in working directory.
com/trolltech/qt/gui/QApplication depends on native libary code, so make sure you have the Qt Jambi native libs with your classpath or working directory.

Install4j is bypassing the custom installation steps

We have an application packed with install4j.
The initial step is to choose between typical and custom installations.
The custom installation is usually bringing up the option to choose the localsettings folder, the appdata folder and in the next step, the installation folder (default: Program Files).
For some reason, in a specific environment, when checking neither of the options, the installation proceeds without asking for the desired folder paths.
An error file was created as well:
java.lang.ClassNotFoundException: I4jScript_Internal_12
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.install4j.runtime.installer.ContextImpl.runScript(Unknown Source)
at com.install4j.runtime.installer.ContextImpl.runScript(Unknown Source)
at com.install4j.runtime.installer.ContextImpl.runBooleanScript(Unknown Source)
at com.install4j.runtime.installer.ContextImpl.runBooleanScript(Unknown Source)
at com.install4j.runtime.installer.ContextImpl.runBooleanScript(Unknown Source)
at com.install4j.runtime.installer.controller.Controller.executeActions(Unknown Source)
at com.install4j.runtime.installer.controller.Controller.handleCommand(Unknown Source)
at com.install4j.runtime.installer.controller.Controller.start(Unknown Source)
at com.install4j.runtime.installer.Installer.main(Unknown Source)
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 com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
at com.exe4j.runtime.WinLauncher.main(Unknown Source)
at com.install4j.runtime.launcher.WinLauncher.main(Unknown Source)
Could you please let me know, what could be the reason for this behavior?
The class that is not found is for a script in your install4j project. This can only happen if there is an inconsistency in your installation directory, i.e. if .install4j/user.jar and .install4j/i4jparams.conf are not from the same installer.

An error has occurred when create servlet finished?

I got this error when created a new Servlet in Eclipse :
java.lang.Error: Unresolved compilation problems:
The import org.eclipse.jst.j2ee.internal cannot be resolved
CreateServletTemplateModel cannot be resolved to a type
CreateServletTemplateModel cannot be resolved to a type
at org.eclipse.jst.j2ee.web.ServletTemplate.<init>(ServletTemplate.java:3)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.eclipse.emf.codegen.jet.JETEmitter.setMethod(JETEmitter.java:279)
at org.eclipse.jst.j2ee.internal.project.WTPJETEmitter.loadClass(WTPJETEmitter.java:358)
at org.eclipse.jst.j2ee.internal.project.WTPJETEmitter.initialize(WTPJETEmitter.java:231)
at org.eclipse.jst.j2ee.internal.project.WTPJETEmitter.<init>(WTPJETEmitter.java:111)
at org.eclipse.jst.j2ee.internal.web.operations.NewServletClassOperation.generateTemplateSource(NewServletClassOperation.java:351)
at org.eclipse.jst.j2ee.internal.web.operations.NewServletClassOperation.generateUsingTemplates(NewServletClassOperation.java:245)
at org.eclipse.jst.j2ee.internal.web.operations.NewServletClassOperation.doExecute(NewServletClassOperation.java:180)
at org.eclipse.jst.j2ee.internal.web.operations.NewServletClassOperation.execute(NewServletClassOperation.java:423)
at org.eclipse.jst.j2ee.internal.web.operations.AddServletOperation.createServletClass(AddServletOperation.java:144)
at org.eclipse.jst.j2ee.internal.web.operations.AddServletOperation.doExecute(AddServletOperation.java:120)
at org.eclipse.jst.j2ee.internal.web.operations.AddServletOperation$1.run(AddServletOperation.java:426)
at org.eclipse.jst.jee.model.internal.JEE5ModelProvider.modify(JEE5ModelProvider.java:237)
at org.eclipse.jst.j2ee.internal.web.operations.AddServletOperation.execute(AddServletOperation.java:432)
at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl$1.run(DataModelPausibleOperationImpl.java:376)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1797)
at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:401)
at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:352)
at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.doExecute(DataModelPausibleOperationImpl.java:242)
at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.executeImpl(DataModelPausibleOperationImpl.java:214)
at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.cacheThreadAndContinue(DataModelPausibleOperationImpl.java:89)
at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.execute(DataModelPausibleOperationImpl.java:202)
at org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard$1$CatchThrowableRunnableWithProgress.run(DataModelWizard.java:211)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:369)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:313)
at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:934)
at org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard.runOperations(DataModelWizard.java:220)
at org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard.performFinish(DataModelWizard.java:178)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:742)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:618)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
at org.eclipse.jface.window.Window.open(Window.java:796)
at org.eclipse.ui.actions.NewWizardAction.run(NewWizardAction.java:182)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:546)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
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:508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
I'm currently using java 1.6.0_32, Tomcat 7.0.27 and Eclipse Europa.
How could I solve this error?
May be your Eclipse installation has a problem. Try to re-install WTP or get new eclipse.
I had the similar problem.I am using the eclipse-Kepler-sr2-javaEE.
The Issues was in Tomcat-7 server. I deleted the server from project-explorer and also from Windows->preferences->server->Runtime Environment.
Finally I am able to create the Servlet.

Problem using google Maps on GWT

I am trying to use the latest jar of google-maps-api-v3 on GWT by following this tutorial step by step but when I try to use it in my application, I got this exception :
Loading modules
ht.haitidataservices.simplemap.SimpleMap
Loading inherited module 'com.google.gwt.maps.Maps'
[ERROR] Unable to find 'com/google/gwt/maps/Maps.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] Line 5: Unexpected exception while processing element 'inherits'
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:262)
at com.google.gwt.dev.cfg.ModuleDefSchema$BodySchema.__inherits_begin(ModuleDefSchema.java:495)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.util.xml.HandlerMethod.invokeBegin(HandlerMethod.java:230)
at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.startElement(ReflectiveParser.java:274)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:331)
at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$100(ReflectiveParser.java:48)
at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:402)
at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:280)
at com.google.gwt.dev.cfg.ModuleDefLoader$1.load(ModuleDefLoader.java:192)
at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:308)
at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:151)
at com.google.gwt.dev.DevModeBase.loadModule(DevModeBase.java:979)
at com.google.gwt.dev.DevMode.loadModule(DevMode.java:548)
at com.google.gwt.dev.DevMode.doStartup(DevMode.java:436)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1045)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:804)
at com.google.gwt.dev.DevMode.main(DevMode.java:309)
[ERROR] Failure while parsing XML
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.util.xml.DefaultSchema.onHandlerException(DefaultSchema.java:58)
at com.google.gwt.dev.util.xml.Schema.onHandlerException(Schema.java:66)
at com.google.gwt.dev.util.xml.Schema.onHandlerException(Schema.java:66)
at com.google.gwt.dev.util.xml.HandlerMethod.invokeBegin(HandlerMethod.java:240)
at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.startElement(ReflectiveParser.java:274)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:331)
at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$100(ReflectiveParser.java:48)
at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:402)
at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:280)
at com.google.gwt.dev.cfg.ModuleDefLoader$1.load(ModuleDefLoader.java:192)
at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:308)
at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:151)
at com.google.gwt.dev.DevModeBase.loadModule(DevModeBase.java:979)
at com.google.gwt.dev.DevMode.loadModule(DevMode.java:548)
at com.google.gwt.dev.DevMode.doStartup(DevMode.java:436)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1045)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:804)
at com.google.gwt.dev.DevMode.main(DevMode.java:309)
[ERROR] Unexpected error while processing XML
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:355)
at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$100(ReflectiveParser.java:48)
at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:402)
at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:280)
at com.google.gwt.dev.cfg.ModuleDefLoader$1.load(ModuleDefLoader.java:192)
at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:308)
at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:151)
at com.google.gwt.dev.DevModeBase.loadModule(DevModeBase.java:979)
at com.google.gwt.dev.DevMode.loadModule(DevMode.java:548)
at com.google.gwt.dev.DevMode.doStartup(DevMode.java:436)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1045)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:804)
at com.google.gwt.dev.DevMode.main(DevMode.java:309)
[ERROR] shell failed in doStartup method
It seems it's a module problem, saying that it cannot find com/google/gwt/maps/Maps.gwt.xml. I don't understand since I follow the tutorial and I am sure that what I am doing is correct.
How can I solve this problem ? Thanks for your help
I am currently developping on JDK 1.6 with Eclipse Indigo on 64-bit Windows 7 system.
[EDIT] For precision, i added the google-maps jar in my application CLASSPATH and added the inherits line in my module file :
<module rename-to='egliseenquete'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.maps.Maps' />
....
</module>
[EDIT] I added the maps gwt jar on my CLASSPATH now I get this exception :
12:27:28.703 [ERROR] [egliseenquete] Unable to load module entry point class ht.haitidataservices.egliseenquete.client.EgliseEnquete (see associated exception for details)
java.lang.RuntimeException: Deferred binding failed for 'com.google.gwt.maps.client.impl.MapOptionsImpl' (did you forget to inherit a required module?)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53)
at com.google.gwt.core.client.GWT.create(GWT.java:98)
at com.google.gwt.maps.client.impl.MapOptionsImpl.<clinit>(MapOptionsImpl.java:31)
at com.google.gwt.maps.client.MapOptions.<init>(MapOptions.java:40)
at ht.haitidataservices.egliseenquete.client.EgliseEnquete.buildMap(EgliseEnquete.java:100)
at ht.haitidataservices.egliseenquete.client.EgliseEnquete.onModuleLoad(EgliseEnquete.java:94)
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 com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:193)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IncompatibleClassChangeError: Found interface com.google.gwt.core.ext.typeinfo.JClassType, but class was expected
at com.google.gwt.jsio.rebind.JSWrapperGenerator.generate(JSWrapperGenerator.java:276)
at com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48)
at com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60)
at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:681)
at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:74)
at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:285)
at com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:141)
at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:585)
at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:455)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
at com.google.gwt.core.client.GWT.create(GWT.java:98)
at com.google.gwt.maps.client.impl.MapOptionsImpl.<clinit>(MapOptionsImpl.java:31)
at com.google.gwt.maps.client.MapOptions.<init>(MapOptions.java:40)
at ht.haitidataservices.egliseenquete.client.EgliseEnquete.buildMap(EgliseEnquete.java:100)
at ht.haitidataservices.egliseenquete.client.EgliseEnquete.onModuleLoad(EgliseEnquete.java:94)
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 com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:193)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
at java.lang.Thread.run(Unknown Source)
How can I achieve this problem? Thx for help !!!
I was having a similar problem.
I ended up using this tutorial and it worked great. It is using gwt-maps-1.1.1.zip (Release date for this is much more recent for this one) and the latest GWT.
One thing to note, is that if you are looking at both tutorials to make sure you use:
<inherits name='com.google.gwt.maps.GoogleMaps' />
and not
<inherits name='com.google.gwt.maps.Maps' />
as they have changed the file name in the com.google.gwt.map package of the jar file.
I suspect that if you check the filename in the com.google.gwt.map package of the map jar file, that the file name you were using to inherit is off. Then changing that line to what I suggested should fix it.
Hopefully this helps!
Cheers
After looking inside of the jar file, I noticed that the path inheritance is incorrect for the xml file.
<inherits name='com.google.gwt.maps.GoogleMaps' /> --Is wrong path
<inherits name='com.google.maps.gwt.GoogleMaps' /> --Is correct path
Many hours wasted figuring this out, but this is the solution. Google made a mistake on their tutorial in this respect.

Categories

Resources