FileDialog does not display when choosing "Add External JARs..." w/ log exception - 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.

Related

NoSuchMethodError: org.openqa.selenium.os.CommandLine.findExecutable(Ljava/lang/String;)Ljava/lang/String; while launching Chrome using SoapUI

I'm trying to launch the selenium scripts from SoapUI 5.2.1 tool with the following launching script:
System.setProperty("webdriver.chrome.driver","D:\\SoapUI-5.2.1\\bin\\ext\\chromedriver.exe")
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.MyUrl.com")
driver.manage().timeouts().implicitlyWait(120,TimeUnit.SECONDS);
I have kept the following selenium dependency file in SoapUI/bin/ext folder
- chromedriver 2.36
- selenium-server-standalone-3.4.0.jar
- selenium-chrome-driver-2.3.1.jar
But I'm getting the following error message while running the script.
Tue May 22 15:51:47 IST 2018:ERROR:java.lang.NoSuchMethodError: org.openqa.selenium.os.CommandLine.findExecutable(Ljava/lang/String;)Ljava/lang/String;
java.lang.NoSuchMethodError: org.openqa.selenium.os.CommandLine.findExecutable(Ljava/lang/String;)Ljava/lang/String;
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:84)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:87)
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:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186)
at Script1.launchURL(Script1.groovy:49)
at Script1.run(Script1.groovy:20)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:92)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:141)
at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:250)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Anyone help me to solve this issue as I'm not able to find correct solution in Google.
Thanks
Karunagara Pandi
This error message...
java.lang.NoSuchMethodError: org.openqa.selenium.os.CommandLine.findExecutable(Ljava/lang/String;)Ljava/lang/String;
java.lang.NoSuchMethodError: org.openqa.selenium.os.CommandLine.findExecutable(Ljava/lang/String;)Ljava/lang/String;
...implies that a NoSuchMethodError was raised when the os command findExecutable() tried to locate the executable as per your System.setProperty() line.
Class NoSuchMethodError
NoSuchMethodError extends IncompatibleClassChangeError and as per the Java Docs it is thrown if an application tries to call a specified method of a class (either static or instance), and that class no longer has a definition of that method. Normally, this error is caught by the compiler and this error can only occur at run time if the definition of a class has incompatibly changed. Incompatible class change occurs due to change in definition of some class, on which the currently executing method depends.
What went wrong?
You have created the WebDriver instance i.e. driver and casted it through ChromeDriver(). But the SoapUI/bin/ext sub-directory contains multiple defination from selenium-server-standalone-3.4.0.jar and selenium-chrome-driver-2.3.1.jar.
Solution
Perform the following steps :
Remove selenium-chrome-driver-2.3.1.jar from SoapUI/bin/ext sub-directory.
Upgrade JDK to recent levels JDK 8u171.
Upgrade Selenium to current levels Version 3.11.0.
Upgrade ChromeDriver to current ChromeDriver v2.38 level.
Keep Chrome version at Chrome v66.x levels. (as per ChromeDriver v2.38 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test.
Code to initialize the chromedriver is like the below code mentioned
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver_win32\\chromedriver.exe");
Webdriver driver = new ChromeDriver();
You need to set the correct dependency artifact id of selenium like
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.12.0</version>
</dependency>
if you are using jar file then download the selenium jar file from here Authentic link

ChromeDriver setSystem property issue

when I'm trying to run test I have issue as on screenshot, where am I wrong?
thx
"C:\Program Files\Java\jdk1.8.0_11\bin\java" -ea -Didea.launcher.port=7537 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 14.0\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 14.0\plugins\testng\lib\testng-plugin.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_11\jre\lib\ext\zipfs.jar;C:\Users\vol.7\Downloads\aaaaaa\src\main\resources\target\test-classes;C:\Users\vol.7\Downloads\aaaaaa\target\classes;C:\Users\vol.7\.m2\repository\org\seleniumhq\selenium\selenium-chrome-driver\2.44.0\selenium-chrome-driver-2.44.0.jar;C:\Users\vol.7\.m2\repository\org\seleniumhq\selenium\selenium-remote-driver\2.44.0\selenium-remote-driver-2.44.0.jar;C:\Users\vol.7\.m2\repository\cglib\cglib-nodep\2.1_3\cglib-nodep-2.1_3.jar;C:\Users\vol.7\.m2\repository\com\google\code\gson\gson\2.3\gson-2.3.jar;C:\Users\vol.7\.m2\repository\org\seleniumhq\selenium\selenium-api\2.44.0\selenium-api-2.44.0.jar;C:\Users\vol.7\.m2\repository\org\apache\httpcomponents\httpclient\4.3.4\httpclient-4.3.4.jar;C:\Users\vol.7\.m2\repository\org\apache\httpcomponents\httpcore\4.3.2\httpcore-4.3.2.jar;C:\Users\vol.7\.m2\repository\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar;C:\Users\vol.7\.m2\repository\commons-codec\commons-codec\1.6\commons-codec-1.6.jar;C:\Users\vol.7\.m2\repository\com\google\guava\guava\18.0\guava-18.0.jar;C:\Users\vol.7\.m2\repository\net\java\dev\jna\jna\3.4.0\jna-3.4.0.jar;C:\Users\vol.7\.m2\repository\net\java\dev\jna\platform\3.4.0\platform-3.4.0.jar;C:\Users\vol.7\.m2\repository\org\testng\testng\6.9.9\testng-6.9.9.jar;C:\Users\vol.7\.m2\repository\junit\junit\4.10\junit-4.10.jar;C:\Users\vol.7\.m2\repository\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar;C:\Users\vol.7\.m2\repository\com\beust\jcommander\1.48\jcommander-1.48.jar;C:\Users\vol.7\.m2\repository\org\apache\ant\ant\1.7.0\ant-1.7.0.jar;C:\Users\vol.7\.m2\repository\org\apache\ant\ant-launcher\1.7.0\ant-launcher-1.7.0.jar;C:\Users\vol.7\.m2\repository\org\yaml\snakeyaml\1.15\snakeyaml-1.15.jar;C:\Users\vol.7\.m2\repository\org\beanshell\bsh\2.0b4\bsh-2.0b4.jar;C:\Users\vol.7\.m2\repository\org\seleniumhq\selenium\selenium-firefox-driver\2.44.0\selenium-firefox-driver-2.44.0.jar;C:\Users\vol.7\.m2\repository\commons-io\commons-io\2.4\commons-io-2.4.jar;C:\Users\vol.7\.m2\repository\org\apache\commons\commons-exec\1.1\commons-exec-1.1.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 14.0\plugins\testng\lib\testng.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 14.0\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.testng.RemoteTestNGStarter -port 54806 -usedefaultlisteners false -socket54807 -temp C:\Users\vol.7\AppData\Local\Temp\idea_testng36.tmp
org.testng.TestNGException: Cannot instantiate class Aaas at
org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:40)
at
org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:382)
at
org.testng.internal.ClassHelper.createInstance(ClassHelper.java:295)
at
org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:118)
at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:183) at
org.testng.internal.TestNGClassFinder.(TestNGClassFinder.java:128)
at org.testng.TestRunner.initMethods(TestRunner.java:416) at
org.testng.TestRunner.init(TestRunner.java:242) at
org.testng.TestRunner.init(TestRunner.java:212) at
org.testng.TestRunner.(TestRunner.java:166) at
org.testng.remote.RemoteTestNG$1.newTestRunner(RemoteTestNG.java:143)
at
org.testng.remote.RemoteTestNG$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG.java:272)
at
org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:587)
at org.testng.SuiteRunner.init(SuiteRunner.java:161) at
org.testng.SuiteRunner.(SuiteRunner.java:114) at
org.testng.TestNG.createSuiteRunner(TestNG.java:1290) at
org.testng.TestNG.createSuiteRunners(TestNG.java:1277) at
org.testng.TestNG.runSuitesLocally(TestNG.java:1131) at
org.testng.TestNG.run(TestNG.java:1048) at
org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:112) at
org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:205) at
org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:176) at
org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:125) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483) at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.reflect.InvocationTargetException at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at
org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:29)
... 27 more Caused by: java.lang.IllegalStateException: The path to
the driver executable must be set by the webdriver.chrome.driver
system property; for more information, at
com.google.common.base.Preconditions.checkState(Preconditions.java:197)
at
org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:105)
at
org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:89)
at
org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:117)
at Aaas.(Aaas.java:11) ... 32 more
Process finished with exit code 0
In your code it looks like you did 2 mistakes.
First thing...
Please remove the instantiation of "new ChromeDriver()" when a reference of type WebDriver created in class.
Instead create a referece:
public WebDriver driver;
Then instantiate the chrome driver inside the test case-->
#Test
public void testMethod(){
//Here, Before the instantiation just use setProperty method
System.setProperty("key","path to chrome driver.exe");
driver=new ChromeDriver();
}
and the Second thing is...
make sure the relative path is correct to chromedriver.exe file...
Use absolute path to the chrome driver.
You're creating the new ChromeDriver in your (implicit) constructor before you're calling: System.setProperty("webdriver.chrome.driver", ...)
You need to set the property before creating any Drivers (same applies to IE, Opera, etc.)
One approach is to create a static { ... } block and move your setting of System properties there. That'll get called before you create your Driver.
It looks like you are not given complete chromediver.exe path. More over over calling chrome driver before system.set property. please set system property first then call chrome driver..
System.setProperty("webdriver.chrome.driver", "E:\\selenium_setups\\chromedriver_win32\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
Thank You,
Murali
You haven't set a location for the chromedriver binary. Edit the configuration of your test by clicking on the drop down box in the top bar. Then add to your VM options a path for the chromedriver binary:
-Dwebdriver.chrome.driver=<ABSOLUTE_PATH_TO>/chromedriver
Since you are using a maven project you may find this maven plugin useful:
https://github.com/Ardesco/selenium-standalone-server-plugin
It will download the driver binaries for you and set up the correct system properties when running your tests through maven. There is a template that uses it here that you can use as an example of how to get it configured:
https://github.com/Ardesco/Selenium-Maven-Template
*Note* Running the test through intelliJ is not the same as running it through maven. System properties that are only set through maven will not have been set in IntelliJ when you run a test through the IDE. This is why you need to edit your test configuration if you have already set the correct System Properties through maven.

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.

c3p0 - hibernate - mysql

hibernate 3.6.8 final
c3p0 jar that came with hibernate 3.6.8 package -> c3p0-0.9.1.jar
1
15
40
0
5
2
The app seems to be working fine, however I get massive log calls with the following stacktrace:
org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already. Could not load com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1566)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1013)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2411)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2153)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at sun.reflect.GeneratedConstructorAccessor38.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:152)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1074)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1061)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1796)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:620)
Any information on how to remove that INFO log would be very much helpful thanks!
UPDATE: Is this a critical error? Or can should I just ignore it?
After a search on the web regarding this issue, I found some similar issues reported by several people. All of them point to a common problem: Threads. Basically, if you start new threads in your application (either in your code or by using a third party tool like Quartz, you have to make sure that all of the threads are stopped appropriately when the application is undeployed from the server. Here are some quotes from the searches:
Mikolaj Rydzewski wrote:
It looks like after webapp's instance has been undeployed, background quartz thread wants to do something and then exception occurs.
Another (and better explanation) on jspwiki.org:
It is possible that this is caused by Tomcat unsuccessfully reloading the web application. The app is unloaded, but all threads don't get shut down properly. As a result, when the threads try to run, they get clobbered by the fact that Tomcat has shut down its classloader, and an error is logged.
So, in order to solve this issue you have to make sure all threads started by your application will be stopped at application undeployment (or redeployment, it's the same). You can do this by registering a ServletContextListener to your application server and stopping your threads inside contextDestroyed(ServletContextEvent) method.
If you are using log4j, change your logging settings to something like this (the word ERROR replace INFO) :
log4j.rootLogger=ERROR, file, stdout
log4j.logger.org.hibernate=ERROR
They are located in the the log4j.properties file in yr project.
OK I switched to boneCP, c3p0 does not really seem to work for java6!!!