c3p0 - hibernate - mysql - 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!!!

Related

Getting the error java.lang.UnsatisfiedLinkError

I am getting java.lang.UnsatisfiedLinkError error when I try to run my code on 32-bit machine.
I have exactly same code on 64-bit machine. This works fine without any issues.
I have looked at all the symbols in my binaries, I have checked the library paths, etc.
I didn't find any issues with any of them.
Can you please check this and let me know how to proceed.
The error log is presented below.
Regards,
Narendra
Exception in thread "Data Adapter" java.lang.UnsatisfiedLinkError: com.abc.iot.analytics.auto.adapter.usb.DATAReader.getMYchannelsJNI()V
at com.abc.iot.analytics.auto.adapter.usb.DATAReader.MychannelsJNI(Native Method)
at com.abc.iot.analytics.auto.adapter.usb.MyAdapter.getMyChannels(MyAdapter.java:19)
at com.abc.iot.analytics.auto.adapter.usb.MyAdapter.readData(MyAdapter.java:34)
at iot.analytics.auto.adapter.AbstractDataAdapter.run(AbstractDataAdapter.java:42)
at java.lang.Thread.run(Thread.java:745)

Lead node fails with /tmp/spark-jobserver/filedao/data/jars.data (Permission denied)

SnappyData v.0-5
I am logged into Ubuntu as a non-root user, 'foo'.
SnappyData directory/install is owned by 'foo' user and 'foo' group.
I am starting ALL nodes (locator,lead,server) with a script here:
SNAPPY_HOME/sbin/snappy-start-all.sh
Locator starts.
Server starts.
Lead dies with this error.
16/07/21 23:12:26.883 UTC serverConnector INFO JobFileDAO:
rootDir is /tmp/spark-jobserver/filedao/data 16/07/21 23:12:26.888 UTC
serverConnector ERROR JobServer$: Unable to start Spark
JobServer: 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:423)
at spark.jobserver.JobServer$.start(JobServer.scala:69) at
io.snappydata.impl.LeadImpl.startAddOnServices(LeadImpl.scala:283) at
io.snappydata.impl.LeadImpl$.invokeLeadStartAddonService(LeadImpl.scala:360)
at
io.snappydata.ToolsCallbackImpl$.invokeLeadStartAddonService(ToolsCallbackImpl.scala:28)
at
org.apache.spark.sql.SnappyContext$.invokeServices(SnappyContext.scala:1362)
at
org.apache.spark.sql.SnappyContext$.initGlobalSnappyContext(SnappyContext.scala:1340)
at org.apache.spark.sql.SnappyContext.(SnappyContext.scala:104)
at org.apache.spark.sql.SnappyContext.(SnappyContext.scala:95)
at
org.apache.spark.sql.SnappyContext$.newSnappyContext(SnappyContext.scala:1221)
at
org.apache.spark.sql.SnappyContext$.apply(SnappyContext.scala:1249)
at
org.apache.spark.scheduler.SnappyTaskSchedulerImpl.postStartHook(SnappyTaskSchedulerImpl.scala:25)
at org.apache.spark.SparkContext.(SparkContext.scala:601) at
io.snappydata.impl.LeadImpl.start(LeadImpl.scala:129) at
io.snappydata.impl.ServerImpl.start(ServerImpl.scala:32) at
io.snappydata.tools.LeaderLauncher.startServerVM(LeaderLauncher.scala:91)
at
com.pivotal.gemfirexd.tools.internal.GfxdServerLauncher.connect(GfxdServerLauncher.java:174)
at
com.gemstone.gemfire.internal.cache.CacheServerLauncher$AsyncServerLauncher.run(CacheServerLauncher.java:1003)
at java.lang.Thread.run(Thread.java:745) Caused by:
java.io.FileNotFoundException:
/tmp/spark-jobserver/filedao/data/jars.data (Permission denied) at
java.io.FileOutputStream.open0(Native Method) at
java.io.FileOutputStream.open(FileOutputStream.java:270) at
java.io.FileOutputStream.(FileOutputStream.java:213) at
spark.jobserver.io.JobFileDAO.init(JobFileDAO.scala:90) at
spark.jobserver.io.JobFileDAO.(JobFileDAO.scala:30) ... 22 more
16/07/21 23:12:26.891 UTC Distributed system shutdown hook
INFO snappystore: VM is exiting - shutting down distributed system
Do I need to be a different user to start the Lead node? Use 'sudo'? Configure a property to tell Spark to use a directory 'foo' has permission to? Create this directory myself ahead of time?
It seems that the current owner of /tmp/spark-jobserver is some other user. Check the permissions on that directory and delete it.
If multiple users will be running leads on the same machine, you can configure the job-server directories to be elsewhere like mentioned here. The relevant properties can be found in application.conf source. This is probably more trouble than worth, so for now it will be easier to just ensure a single user starts the lead nodes on a machine.
We shall be fixing the default to be inside work/ directory in next release (SNAP-69).

IllegalStateException: in SimpleFrameBuilder when running grails app in tcserver w/ insight

I am trying to profile a grails application using insight.
Grails - 2.4.0 or 2.4.1 (tried 2.4.1 to see if it fixed my issue)
GGTS - 3.5.0 w/ eclipse 4.3.2
tcserver - VMWare vFabric tc Server Developer Edition (Runtime) v2.9
(from within eclipse)
PermGenSpace = 1024m
I have tried the following;
Drag the grails application from the project explorer and drop it on the tc server in the Servers pane
Build the grails application with grails dev war and placed the war file into the webapps directory directly via command line
Run As -> Run on Server
I'm seeing the same result, which is the stacktrace below. Anybody have an thoughts as to what might be wrong or how to make this work? If more information is needed, please let me and I'll try to provide it.
Thanks much!
Thantous
EDIT:
Got the server to startup by adjusting the memory of the tcserver. The real issues stopping the server from starting was the heap memory error at the very bottom of the stacktrace. I am still seeing the error for SimepleFrameBuilder, but at least the server starts up now :).
Here is the relevant part of the server config for memory settings;
-Xmx2048m -Xss1024k -XX:MaxPermSize=2048m
-- StackTrace --
2014-06-25 09:13:40,995 [localhost-startStop-1] ERROR errorhandling.CollectionErrors - Disabling aspect com.springsource.insight.plugin.springcore.ClassPathScanOperationCollectionAspect
- IllegalStateException: current frame builder doesn't support frame discarding class com.springsource.insight.intercept.trace.SimpleFrameBuilder
2014-06-25 09:13:41,010 [localhost-startStop-1] ERROR errorhandling.AdviceErrorHandlingAspect - Error swallowed in advice adviceexecution(void com.springsource.insight.collection.AbstractOperationCollectionAspect.afterReturning(Object, JoinPoint.StaticPart))
java.lang.IllegalStateException: current frame builder doesn't support frame discarding class com.springsource.insight.intercept.trace.SimpleFrameBuilder
at com.springsource.insight.intercept.trace.collapse.CollapsingFrameBuilder.getFirstCollapsedFrame(CollapsingFrameBuilder.java:183)
at com.springsource.insight.intercept.trace.collapse.CollapsingFrameBuilder.collapseIfRequired(CollapsingFrameBuilder.java:150)
at com.springsource.insight.intercept.trace.collapse.CollapsingFrameBuilder.exit(CollapsingFrameBuilder.java:72)
at com.springsource.insight.intercept.trace.ThreadLocalFrameBuilder.exit(ThreadLocalFrameBuilder.java:93)
at com.springsource.insight.collection.overflow.CountOperationsTraceOverflowStrategy.doExit(CountOperationsTraceOverflowStrategy.java:196)
at com.springsource.insight.collection.overflow.CountOperationsTraceOverflowStrategy.exit(CountOperationsTraceOverflowStrategy.java:91)
at com.springsource.insight.collection.DefaultOperationCollector.exit(DefaultOperationCollector.java:161)
at com.springsource.insight.collection.DefaultOperationCollector._exitNormal(DefaultOperationCollector.java:74)
at com.springsource.insight.collection.DefaultOperationCollector.exitNormal(DefaultOperationCollector.java:65)
at com.springsource.insight.collection.AbstractOperationCollectionAspect.ajc$afterReturning$com_springsource_insight_collection_AbstractOperationCollectionAspect$2$34342d20_aroundBody2(AbstractOperationCollectionAspect.aj:105)
at com.springsource.insight.collection.AbstractOperationCollectionAspect$AjcClosure3.run(AbstractOperationCollectionAspect.aj:1)
at com.springsource.insight.collection.errorhandling.AdviceErrorHandlingAspect.ajc$around$com_springsource_insight_collection_errorhandling_AdviceErrorHandlingAspect$1$e76a6b03proceed(AdviceErrorHandlingAspect.aj:41)
at com.springsource.insight.collection.errorhandling.AdviceErrorHandlingAspect.ajc$around$com_springsource_insight_collection_errorhandling_AdviceErrorHandlingAspect$1$e76a6b03(AdviceErrorHandlingAspect.aj:43)
at com.springsource.insight.collection.AbstractOperationCollectionAspect.ajc$afterReturning$com_springsource_insight_collection_AbstractOperationCollectionAspect$2$34342d20(AbstractOperationCollectionAspect.aj:1)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
[error 2014/06/25 09:14:45.735 PDT <GemfireHeapPoller> tid=0x23] Member: gamera(5640:loner):0:eb9aced3 above critical heap threshold

Run Swing app from Tomcat; can't connect to X11 with DISPLAY=:0:0

I have a small Swing monitoring app that I want to run in the Tomcat 6 JVM. The app is started by dynamically loading the monitoring class from a webservice running under Tomcat. This works in Windows but on Linux (Ubuntu 10.4) I'm getting some errors.
My first error was that I was getting a HeadlessException. I'm not explicitly using headless mode and after searching around I changed Tomcat's library path (via -Djava.library.path in catalina.sh) to point to the client lib (ie. .../java-6-sun-1.6.0.26/jre/lib/i386/client) instead of the server lib. I also set DISPLAY=:0:0 in catalina.sh. This got rid of the headless exception but now I get:
java.lang.InternalError: Can't connect to X11 window server using ':0:0' as the value of the DISPLAY variable.
sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
sun.awt.X11GraphicsEnvironment.access$100(X11GraphicsEnvironment.java:52)
sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:155)
java.security.AccessController.doPrivileged(Native Method)
sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:131)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:169)
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
java.awt.Window.init(Window.java:380)
java.awt.Window.<init>(Window.java:433)
java.awt.Frame.<init>(Frame.java:403)
java.awt.Frame.<init>(Frame.java:368)
javax.swing.JFrame.<init>(JFrame.java:158)
com.quinsoft.zeidon.objectbrowser.ObjectBrowser.startup(ObjectBrowser.java:60)
At this point I'm stuck. I've tried a bunch of different things (like explicitly setting "headless=false" and using different values for DISPLAY) and nothing changes. Does anybody have any ideas?
Version info:
Tomcat 6.0.28
Java 1.6
Ubuntu 10.4
Try setting '-Djava.awt.headless=true' if you have not already tried it.

ClassNoDefFoundError while running a junit test which is instrumented using TPTP probekit agent

I've been dealing with this error message for a while now and nobody has been able to help me...
I am trying to probe a java application using the standalone TPTP probekit agent with the following linux command:
java '-agentlib:JPIBootLoader=JPIAgent:server=standalone;ProbekitAgent:ext-pk-BCILibraryName=BCIEngProbe,ext-pk-probescript=ome/anis/qf-t/core/probe/testProbe.probescript' junit.textui.TestRunner quickfix.test.acceptance.AcceptanceTestSuite
My application is actually a junit testcase from the Quickfixj package (quickfixj.org)...
Running the above command, the probing starts and I am able to see the runtime traces. However, at some point during execution I am getting the runtime exception:
java.lang.NoClassDefFoundError: testProbe_probe$Probe_0
25-Jan-2012 10:25:11 AM quickfix.test.acceptance.ATServer run
SEVERE: error in AT server
java.lang.NoClassDefFoundError: testProbe_probe$Probe_0
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl.<init>(DocumentBuilderFactoryImpl.java)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:147)
at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:233)
at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:123)
at quickfix.DataDictionary.load(DataDictionary.java:906)
at quickfix.DataDictionary.read(DataDictionary.java:893)
at quickfix.DataDictionary.<init>(DataDictionary.java:109)
at quickfix.DefaultSessionFactory.getDataDictionary(DefaultSessionFactory.java:325)
at quickfix.DefaultSessionFactory.createDataDictionary(DefaultSessionFactory.java:219)
at quickfix.DefaultSessionFactory.processFixtDataDictionaries(DefaultSessionFactory.java:258)
at quickfix.DefaultSessionFactory.create(DefaultSessionFactory.java:113)
at quickfix.mina.acceptor.AbstractSocketAcceptor.createSessions(AbstractSocketAcceptor.java:242)
at quickfix.mina.acceptor.AbstractSocketAcceptor.startAcceptingConnections(AbstractSocketAcceptor.java:99)
at quickfix.SocketAcceptor.initialize(SocketAcceptor.java:66)
at quickfix.SocketAcceptor.start(SocketAcceptor.java:59)
at quickfix.test.acceptance.ATServer.run(ATServer.java:193)
at java.lang.Thread.run(Thread.java:662)**
which states that my probe file is missing. But this file has been needed in the first place to print the traces!!???.....
Well, here are some facts:
I am able to probe other applications, including a simple junit test:
java '-agentlib:JPIBootLoader=JPIAgent:server=standalone;ProbekitAgent:ext-pk-BCILibraryName=BCIEngProbe,ext-pk-probescript=ome/anis/qf-t/core/probe/testProbe.probescript' junit.textui.TestRunner quickfix.test.acceptance.AnisJUnitTestExample
I am able to run the quickfix.test.acceptance.AcceptanceTestSuite using junit (no probing):
java junit.textui.TestRunner quickfix.test.acceptance.AcceptanceTestSuite
I have set the path to testProbe_probe$Probe_0 in CLASSPATH
I have called the System.getenv("CLASSPATH") from within my testcase and the CLASSPATH seems to be fine
My testcase deals with threads, sockets, etc
And my system configuration is:
-os: ubuntu 10.04-64bit (on VirtualBox!)
-java version "1.6.0_24"
-junit: junit-4.10.jar
-TPTP agent controller: agntctrl.linux_em64t-TPTP-4.7.2
Any ideas??
Thanks,
Anis