Suddenly unable to export to war file from eclipse - java

I been working on this Servlet project all morning and now suddenly I cannot get eclipse to export the project to a war file. I tried restarting eclipse and cleaning the project but I just get the same result. Any ideas?
org.eclipse.core.runtime.CoreException: Extended Operation failure:
org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentExportOperation
at org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard.performFinish(DataModelWizard.java:182)
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.ExportResourcesAction.run(ExportResourcesAction.java:180)
at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:168)
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)
org.eclipse.core.runtime.CoreException[0]: org.eclipse.core.commands.ExecutionException: Error exportingWar File
at org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactExportOperation.execute(J2EEArtifactExportOperation.java:103)
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$ModalContextThread.run(ModalContext.java:113)
Caused by: org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException: IWAE0017E Unable to replace original archive: C:\Users\mark\uploads\myfirstjsp.war
at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ArchiveImpl.cleanupAfterTempSave(ArchiveImpl.java:322)
at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.ArchiveImpl.saveAsNoReopen(ArchiveImpl.java:1182)
at org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentExportOperation.export(WebComponentExportOperation.java:54)
at org.eclipse.jst.j2ee.internal.archive.operations.J2EEArtifactExportOperation.execute(J2EEArtifactExportOperation.java:95)
... 10 more

Well I guess I should have read the whole error as it does say that the problem is it can't write to the file. The interesting part was what was causing the file to be locked. Firefox had the file open so eclipse couldn't write to the file. I have no idea why firefox had the file open though I was using it to upload the war file to the server.

Related

Java NoSuchMethodError for regex.Matcher.results() when running .jar file

When I run my app as a .jar file, it returns the below error:
Exception in thread "main" 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.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrc
der.java:61)
Caused by: java.lang.NoSuchMethodError: java.util.regex.Matcher.results()Ljav
til/stream/Stream;
at SalesToExcel.start(SalesToExcel.java:108)
at SalesToExcel.main(SalesToExcel.java:45)
... 5 more
However, it works when I run it inside of the Eclipse IDE. Any ideas? I'm not sure if I'm somehow missing a proper jar file even though java.utils.regex should come included in rt.jar. Is there a way to check if this is missing somehow when I package the jar?
So, this is your problem. java.util.regex.Matcher.results is in Java since Java 9 and you are running the .jar with Java 8.
Eclipse runs with Java11.
Install as default JRE at least Java9 in your OS (Windows ?).

Exporting Applications with Databases to Executable Jar in Netbeans

I'm building a desktop application with an Apache Derby database. When I run the application from Netbeans, it works fine, but when I run the application's executable jar file, I get a "java.lang.ExceptionInInitializerError" "Caused by: java.lang.IllegalStateException: Attempting to execute an operation on a closed EntityManager."
The jar file was created by right-clicking the project in Netbeans, and clicking "Clean and Build".
I've looked at the the following resources, but the information wasn't applicable:
Export JAR with Netbeans
https://netbeans.org/kb/articles/javase-deploy.html
This is my first time using Derby, so it's probably something simple that I'm missing.
Stack trace:
java.lang.ExceptionInInitializerError
at myProject.Main.start(Main.java:70)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$11(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$9(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Attempting to execute an operation on a closed EntityManager.
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.verifyOpenWithSetRollbackOnly(EntityManagerImpl.java:1923)
at org.eclipse.persistence.internal.jpa.QueryImpl.getSingleResult(QueryImpl.java:508)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getSingleResult(EJBQueryImpl.java:400)
at graphics.view.Read.<clinit>(Read.java:50)
... 10 more
As it turns out, I made a (very) silly mistake in my code. I closed the EntityManager that I made the query on in the line before I called getSingleResult() on my query. I'm not quite sure why the program worked when I ran it from Netbeans, but the problem is solved now.

NumberFormatException on eclipse start

I'm a novice at Java and eclipse IDE. I'm trying to create a plugin to my installed eclipse 4.4.0 by the official IBM article.
I've added plug-in description to the plugin.xml:
<extension point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
name="MyConfiguration"
delegate="com.myplugin.first.launching.MyLaunchConfiguration"
modes="run, debug"
id="com.myplugin.first.launching.myConfiguration">
</launchConfigurationType>
</extension>
and I've created empty configuration delegate with required dependencies.
Unfortunately I cannot launch a new eclipse application with my plugin because every time I get the following error:
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at org.eclipse.osgi.storagemanager.StorageManager.updateTable(StorageManager.java:511)
at org.eclipse.osgi.storagemanager.StorageManager.open(StorageManager.java:708)
at org.eclipse.osgi.storage.Storage.getChildStorageManager(Storage.java:1747)
at org.eclipse.osgi.storage.Storage.getInfoInputStream(Storage.java:1764)
at org.eclipse.osgi.storage.Storage.(Storage.java:124)
at org.eclipse.osgi.storage.Storage.createStorage(Storage.java:84)
at org.eclipse.osgi.internal.framework.EquinoxContainer.(EquinoxContainer.java:75)
at org.eclipse.osgi.launch.Equinox.(Equinox.java:31)
at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:297)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:232)
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:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
An error has occurred. See the log file
null.
I have not found the log file with the error.
What's wrong? What should I do?
Maybe somebody knows the problem.
Try deleting everything in eclipse\configuration folder except config.ini and start your eclipse. Also paste the contents of the latest log file from eclipse\configuration for complete error.
Well! I,ve fixed the problem. I just created a new workspace and copied my project and config files to the workspace.
So the problem was in a broken workspace. I guess some workspace config file was corrupted. Anyway thank redoc for the idea.

GWT not starting by not finding appengine-web.xml

I'm dealing with a problem that I know where the problem is, but I don't know how to fix it. When I try to run the development server using Run As -> Web Application, I get the following error on the console:
Initializing App Engine server
Feb 07, 2014 8:39:07 AM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
SEVERE: Received exception processing C:\Users\JOSR\Last Hope\WEB-INF/appengine-web.xml
com.google.apphosting.utils.config.AppEngineConfigException: Could not locate C:\Users\JOSR\Last Hope\WEB-INF\appengine-web.xml
at com.google.apphosting.utils.config.AppEngineWebXmlReader.getInputStream(AppEngineWebXmlReader.java:140)
at com.google.apphosting.utils.config.AppEngineWebXmlReader.readAppEngineWebXml(AppEngineWebXmlReader.java:75)
at com.google.apphosting.utils.config.EarHelper.readWebModule(EarHelper.java:166)
at com.google.appengine.tools.development.ApplicationConfigurationManager$WarModuleConfigurationHandle.readConfiguration(ApplicationConfigurationManager.java:399)
at com.google.appengine.tools.development.ApplicationConfigurationManager.<init>(ApplicationConfigurationManager.java:146)
at com.google.appengine.tools.development.ApplicationConfigurationManager.newWarConfigurationManager(ApplicationConfigurationManager.java:88)
at com.google.appengine.tools.development.DevAppServerImpl.<init>(DevAppServerImpl.java:139)
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 com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:258)
at com.google.appengine.tools.development.DevAppServerFactory.access$000(DevAppServerFactory.java:36)
at com.google.appengine.tools.development.DevAppServerFactory$1.run(DevAppServerFactory.java:226)
at com.google.appengine.tools.development.DevAppServerFactory$1.run(DevAppServerFactory.java:224)
at java.security.AccessController.doPrivileged(Native Method)
at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:224)
at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:76)
at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:60)
at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:84)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1093)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:836)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)
Caused by: java.io.FileNotFoundException: C:\Users\JOSR\Last Hope\WEB-INF\appengine-web.xml (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at com.google.apphosting.utils.config.AppEngineWebXmlReader.getInputStream(AppEngineWebXmlReader.java:137)
... 23 more
I know that the path "C:\Users\JOSR\Last Hope\WEB-INF/appengine-web.xml" is wrong, should be "C:\Users\JOSR\Last Hope\war/WEB-INF/appengine-web.xml", but I don't know where to change it or how to force GWT to use the proper war path. Any ideas?
Thanks for reading!
from context-menu
Run As/Run Configuration and select your html ,choose Arguments tab
-war option is that.
I faced the same problem when I started using Maven in a GWT-GAE project.
In my case this problem happened because the eclipse launch file tries to load the appengine-web.xml from target/myproject/WEB-INF/appengine-web.xml but the files are in src/main/webapp/WEB-INF.
The solution is to uncheck the option "Launch and deploy from this directory (disabled because this is a Maven project)" from your project properties in Eclipse, even if this is really a maven project, like in the picture the option "WAR directory:" should point src/main/webapp
Important! Keep in mind, you have to build the project using maven before running the launch file, otherwise the folder target/myproject/WEB-INF/ will be empty.

UnsatisifiedLinkError - Any idea on how to fix this?

Exception in thread "main" 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.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: com.melloware.jintellitype.JIntellitypeException: Could not load JIntellitype.dll from local file system or from inside JAR
at com.melloware.jintellitype.JIntellitype.<init>(JIntellitype.java:114)
at com.melloware.jintellitype.JIntellitype.getInstance(JIntellitype.java:174)
at CaptureScreen.registerHotkeys(CaptureScreen.java:163)
at CaptureScreen.<init>(CaptureScreen.java:100)
at CaptureScreen.main(CaptureScreen.java:199)
... 5 more
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\B\AppData\Local\Temp: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.melloware.jintellitype.JIntellitype.<init>(JIntellitype.java:99)
... 9 more
I get this error when I run from the command line, however, it does not cause any issues with my program running on my machine, however, on other peoples machines the program will not run at all.
I have never come across this error before and fairly confused.. mostly that it runs fine on my machine, but not on others even though it throws this error on both.
This is a classpath error. Its likely that you have it set up right for compile time but not runtime. Make sure that either your jar is in the right location and/or that you've set your classpath to include the jar.
Go to the Jintellitype website, download the source, add it to your download folder and then move the .dll files into the folder with the Jitellitype classes after building the project

Categories