Separate database configuration - mysql

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!

Related

JMockit with EclEmma code coverage issue

Before anyone downvotes me for a duplicate question.... I have read all the other StackOverflow answers related to this topic and nothing has answered my question.
So I am using JMockit 1.19, below is my pom.xml dependencies for Jmockit and Junit
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
</dependency>
I am using EclEmma 2.3.2 plugin as installed via Eclipse Marketplace.
However I am getting several different issues at once when I try to view my code coverage.
For one I get the following exception log:
java.lang.reflect.InvocationTargetException
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 sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented.
at org.jacoco.agent.rt.internal_9dd1198.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:138)
at org.jacoco.agent.rt.internal_9dd1198.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:99)
at org.jacoco.agent.rt.internal_9dd1198.PreMain.createRuntime(PreMain.java:55)
at org.jacoco.agent.rt.internal_9dd1198.PreMain.premain(PreMain.java:47)
... 6 more
Caused by: java.lang.NoSuchFieldException: $jacocoAccess
at java.lang.Class.getField(Class.java:1695)
at org.jacoco.agent.rt.internal_9dd1198.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:136)
... 9 more
FATAL ERROR in native method: processing of -javaagent failed
Exception in thread "main"
I also get two pop-ups that say....
popup 1) - "No coverage data has been collected during this coverage session. Please do not terminate the Java process manually from Eclipse."
pupup 2) - "Error while dumping coverage data (code 5013). com.mountainminds.eclemma.internal.core.launching.AgentServer"
In order to get JMockit to run successfully I am providing the JVM argument
-javaagent:C:/Users/vn90614/.m2/repository/org/jmockit/jmockit/1.19/jmockit-1.19.jar
I think this argument is realted to the issue
Ok, so I FINALLY solved this issue after almost a week of working on this and asking everyone in the office. I had linked another project on my build path and that's what caused this issue. Not only did it affect this but this caused a ton of issues with JMockit, Mockito, and PowerMock functions. Linking projects on your build path WILL cause issues for testing frameworks and code coverage.

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

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

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

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

Why is Restlet unable to Register the JSON Converter?

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

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!!!