possible dead-lock with nested transactions in grails service - spring
I have a transactional grails service which is doing some (long running) processing. While processing, I would like to update a "percentComplete" value (which will ultimately be used to display a progress bar on the front-end). This obviously has to be written immediately (i.e. not as part of the current transaction), otherwise it is of no value.
Hence, I'm using the Grails Transaction Handling Plugin and specifically the "withNewTransaction" method to start up a new transaction, within which the percentComplete attribute is updated.
My problem is that, second time around in to the "updatePercentComplete()" method, the application hangs when attempting to exit the "withNewTransaction" method (presumably when it is trying to commit the transaction).
Notes:
if I comment out the session flushing in the main service method, there is no problem (btw, this flushing, along with clearing, is required for performance reasons in my real application)
using the hsql database, there is no problem (see DataSources.groovy).
also using the grails executor plugin, but I don't think this is causing any problems in itself (see the LibraryServiceTests, which also hangs and bypasses the plugin).
Where should I go looking to debug this problem? Maybe there are some log levels I can set in grails/hibernate somewhere to pin-point what is happening?
The thread doing the work seems to be getting stuck trying to read from a socket, see stack trace below. There don't appear to be any actual deadlocks in the JVM itself.
Here is my service class, link to full project below:
package withtransactiontest
class LibraryService {
static transactional = true
def sessionFactory
def loadBooks(library) {
int repeat = 5
repeat.times {
updatePercentComplete(library, it * (100 / repeat))
// Simulate some long running process in order to be able to see percentComplete getting written to DB.
Thread.sleep(2000)
// Update some property (within the default transaction)
library.name += "x"
library.save()
// Comment out the following, and the current method will complete successfully.
def session = sessionFactory?.currentSession
session?.flush()
}
library.percentComplete = 100
library.save()
}
void updatePercentComplete(library, val) {
println "before new transaction"
Library.withNewTransaction {
println "Percent complete: " + val
library.refresh()
library.percentComplete = val
library.save()
println "after save"
// Hang here, second time around.
}
println "Percent complete transaction committed"
library.refresh()
}
}
Link to grails project with integration test case which re-creates the problem
Stacktrace of "worker" thread:
Thread [pool-1-thread-1] (Suspended)
SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int) line: not available [native method]
SocketInputStream.read(byte[], int, int) line: 129
ReadAheadInputStream.fill(int) line: 114
ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(byte[], int, int) line: 161
ReadAheadInputStream.read(byte[], int, int) line: 189
MysqlIO.readFully(InputStream, byte[], int, int) line: 2499
MysqlIO.reuseAndReadPacket(Buffer, int) line: 2952
MysqlIO.reuseAndReadPacket(Buffer) line: 2941
MysqlIO.checkErrorPacket(int) line: 3489
MysqlIO.sendCommand(int, String, Buffer, boolean, String, int) line: 1959
MysqlIO.sqlQueryDirect(StatementImpl, String, String, Buffer, int, int, int, boolean, String, Field[]) line: 2113
JDBC4Connection(ConnectionImpl).execSQL(StatementImpl, String, int, Buffer, int, int, boolean, String, Field[], boolean) line: 2568
JDBC4PreparedStatement(PreparedStatement).executeInternal(int, Buffer, boolean, boolean, Field[], boolean) line: 2113
JDBC4PreparedStatement(PreparedStatement).executeUpdate(byte[][], InputStream[], boolean[], int[], boolean[], boolean) line: 2409
JDBC4PreparedStatement(PreparedStatement).executeUpdate(boolean, boolean) line: 2327
JDBC4PreparedStatement(PreparedStatement).executeUpdate() line: 2312
DelegatingPreparedStatement.executeUpdate() line: 105
DelegatingPreparedStatement.executeUpdate() line: 105
GroovyAwareSingleTableEntityPersister(AbstractEntityPersister).update(Serializable, Object[], Object[], Object, boolean[], int, Object, Object, String, SessionImplementor) line: 2435
GroovyAwareSingleTableEntityPersister(AbstractEntityPersister).updateOrInsert(Serializable, Object[], Object[], Object, boolean[], int, Object, Object, String, SessionImplementor) line: 2335
GroovyAwareSingleTableEntityPersister(AbstractEntityPersister).update(Serializable, Object[], int[], boolean, Object[], Object, Object, Object, SessionImplementor) line: 2635
EntityUpdateAction.execute() line: 115
ActionQueue.execute(Executable) line: 279
ActionQueue.executeActions(List) line: 263
ActionQueue.executeActions() line: 168
PatchedDefaultFlushEventListener.performExecutions(EventSource) line: 46
PatchedDefaultFlushEventListener(DefaultFlushEventListener).onFlush(FlushEvent) line: 50
SessionImpl.flush() line: 1027
SessionImpl.managedFlush() line: 365
JDBCTransaction.commit() line: 137
GrailsHibernateTransactionManager(HibernateTransactionManager).doCommit(DefaultTransactionStatus) line: 656
GrailsHibernateTransactionManager(AbstractPlatformTransactionManager).processCommit(DefaultTransactionStatus) line: 754
GrailsHibernateTransactionManager(AbstractPlatformTransactionManager).commit(TransactionStatus) line: 723
TransactionTemplate.execute(TransactionCallback) line: 147
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
PojoMetaMethodSite$PojoCachedMethodSite.invoke(Object, Object[]) line: 188
PojoMetaMethodSite$PojoCachedMethodSite(PojoMetaMethodSite).call(Object, Object[]) line: 52
PojoMetaMethodSite$PojoCachedMethodSite(AbstractCallSite).call(Object, Object) line: 124
GroovyDynamicMethods$_doWith_closure1.doCall(Map, Map, Closure) line: 55
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(Object, Object[]) line: 266
PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce(PogoMetaMethodSite).callCurrent(GroovyObject, Object[]) line: 51
PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce(AbstractCallSite).callCurrent(GroovyObject, Object, Object, Object) line: 157
GroovyDynamicMethods$_doWith_closure1.call(Map, Map, Closure) line: not available
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(Object, Object[]) line: 266
PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce(PogoMetaMethodSite).call(Object, Object[]) line: 63
PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce(AbstractCallSite).call(Object, Object, Object, Object) line: 132
GroovyDynamicMethods$_doWith_closure3.doCall(Map, Closure) line: 65
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
PogoMetaMethodSite$PogoCachedMethodSite.invoke(Object, Object[]) line: 225
PogoMetaMethodSite$PogoCachedMethodSite(PogoMetaMethodSite).callCurrent(GroovyObject, Object[]) line: 51
PogoMetaMethodSite$PogoCachedMethodSite(AbstractCallSite).callCurrent(GroovyObject, Object, Object) line: 153
GroovyDynamicMethods$_doWith_closure3.doCall(Closure) line: not available
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
CachedMethod.invoke(Object, Object[]) line: 90
CachedMethod(MetaMethod).doMethodInvoke(Object, Object[]) line: 233
ExpandoMetaClass(MetaClassImpl).invokeMethod(Class, Object, String, Object[], boolean, boolean) line: 1058
ExpandoMetaClass.invokeMethod(Class, Object, String, Object[], boolean, boolean) line: 1070
ExpandoMetaClass(MetaClassImpl).invokeMethod(Object, String, Object[]) line: 886
GroovyDynamicMethods$_doWith_closure3(Closure).call(Object[]) line: 282
ClosureStaticMetaMethod.invoke(Object, Object[]) line: 59
StaticMetaMethodSite$StaticMetaMethodSiteNoUnwrapNoCoerce.invoke(Object, Object[]) line: 148
StaticMetaMethodSite$StaticMetaMethodSiteNoUnwrapNoCoerce(StaticMetaMethodSite).call(Object, Object[]) line: 88
StaticMetaMethodSite$StaticMetaMethodSiteNoUnwrapNoCoerce(AbstractCallSite).call(Object, Object) line: 124
LibraryService.updatePercentComplete(Object, Object) line: 34
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
CachedMethod.invoke(Object, Object[]) line: 90
CachedMethod(MetaMethod).doMethodInvoke(Object, Object[]) line: 233
ExpandoMetaClass(MetaClassImpl).invokeMethod(Class, Object, String, Object[], boolean, boolean) line: 1058
ExpandoMetaClass.invokeMethod(Class, Object, String, Object[], boolean, boolean) line: 1070
ExpandoMetaClass(MetaClassImpl).invokeMethod(Object, String, Object[]) line: 886
ExpandoMetaClass(MetaClassImpl).invokeMethod(Class, Object, String, Object[], boolean, boolean) line: 1003
ExpandoMetaClass.invokeMethod(Class, Object, String, Object[], boolean, boolean) line: 1070
ExpandoMetaClass(MetaClassImpl).invokeMethod(Object, String, Object[]) line: 886
PogoMetaClassSite.callCurrent(GroovyObject, Object[]) line: 66
PogoMetaClassSite(AbstractCallSite).callCurrent(GroovyObject, Object, Object) line: 153
LibraryService$_loadBooks_closure1.doCall(Object) line: 13
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
CachedMethod.invoke(Object, Object[]) line: 90
CachedMethod(MetaMethod).doMethodInvoke(Object, Object[]) line: 233
ExpandoMetaClass(MetaClassImpl).invokeMethod(Class, Object, String, Object[], boolean, boolean) line: 1058
ExpandoMetaClass.invokeMethod(Class, Object, String, Object[], boolean, boolean) line: 1070
ExpandoMetaClass(MetaClassImpl).invokeMethod(Object, String, Object[]) line: 886
LibraryService$_loadBooks_closure1(Closure).call(Object[]) line: 282
LibraryService$_loadBooks_closure1(Closure).call(Object) line: 295
DefaultGroovyMethods.times(Number, Closure) line: 9487
dgm$630.invoke(Object, Object[]) line: not available
PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(Object, Object[]) line: 270
PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce(PojoMetaMethodSite).call(Object, Object[]) line: 52
PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce(AbstractCallSite).call(Object, Object) line: 124
LibraryService.loadBooks(Object) line: 12
LibraryService$$FastClassByCGLIB$$f97d911e.invoke(int, Object, Object[]) line: not available
MethodProxy.invoke(Object, Object[]) line: 149
Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint() line: 688
Cglib2AopProxy$CglibMethodInvocation(ReflectiveMethodInvocation).proceed() line: 150
TransactionInterceptor.invoke(MethodInvocation) line: 110
Cglib2AopProxy$CglibMethodInvocation(ReflectiveMethodInvocation).proceed() line: 172
Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Object, Method, Object[], MethodProxy) line: 621
LibraryService$$EnhancerByCGLIB$$c098c6ba.loadBooks(Object) line: not available
LibraryService$loadBooks.call(Object, Object) line: not available
LibraryController$_closure4_closure9.doCall(Object) line: 30
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
PogoMetaMethodSite$PogoCachedMethodSite.invoke(Object, Object[]) line: 225
PogoMetaMethodSite$PogoCachedMethodSite(PogoMetaMethodSite).callCurrent(GroovyObject, Object[]) line: 51
PogoMetaMethodSite$PogoCachedMethodSite(AbstractCallSite).callCurrent(GroovyObject, Object) line: 149
LibraryController$_closure4_closure9.doCall() line: not available
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
CachedMethod.invoke(Object, Object[]) line: 90
CachedMethod(MetaMethod).doMethodInvoke(Object, Object[]) line: 233
ExpandoMetaClass(MetaClassImpl).invokeMethod(Class, Object, String, Object[], boolean, boolean) line: 1058
ExpandoMetaClass.invokeMethod(Class, Object, String, Object[], boolean, boolean) line: 1070
ExpandoMetaClass(MetaClassImpl).invokeMethod(Object, String, Object[]) line: 886
LibraryController$_closure4_closure9(Closure).call(Object[]) line: 282
ConvertedClosure.invokeCustom(Object, Method, Object[]) line: 51
ConvertedClosure(ConversionHandler).invoke(Object, Method, Object[]) line: 82
$Proxy6.call() line: not available
java_util_concurrent_Callable$call.call(Object) line: not available
PersistenceContextCallableWrapper$_call_closure1.doCall(Object) line: 36
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
PogoMetaMethodSite$PogoCachedMethodSite.invoke(Object, Object[]) line: 225
PogoMetaMethodSite$PogoCachedMethodSite(PogoMetaMethodSite).callCurrent(GroovyObject, Object[]) line: 51
PogoMetaMethodSite$PogoCachedMethodSite(AbstractCallSite).callCurrent(GroovyObject, Object) line: 149
PersistenceContextCallableWrapper$_call_closure1.doCall() line: not available
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
CachedMethod.invoke(Object, Object[]) line: 90
CachedMethod(MetaMethod).doMethodInvoke(Object, Object[]) line: 233
ExpandoMetaClass(MetaClassImpl).invokeMethod(Class, Object, String, Object[], boolean, boolean) line: 1058
ExpandoMetaClass.invokeMethod(Class, Object, String, Object[], boolean, boolean) line: 1070
ExpandoMetaClass(MetaClassImpl).invokeMethod(Object, String, Object[]) line: 886
PersistenceContextCallableWrapper$_call_closure1(Closure).call(Object[]) line: 282
PersistenceContextCallableWrapper$_call_closure1(Closure).call() line: 277
Closure$call.call(Object) line: not available
PersistenceContextCallableWrapper(PersistenceContextWrapper).wrap(Closure) line: 35
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(Object, Object[]) line: 266
PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce(PogoMetaMethodSite).callCurrent(GroovyObject, Object[]) line: 51
PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce(AbstractCallSite).callCurrent(GroovyObject, Object) line: 149
PersistenceContextCallableWrapper.call() line: 36
FutureTask$Sync.innerRun() line: 303
FutureTask.run() line: 138
ThreadPoolExecutor$Worker.runTask(Runnable) line: 886
ThreadPoolExecutor$Worker.run() line: 908
Thread.run() line: 680
Workaround is to introduce a new domain class, Progress, which has the property percentComplete and belongsTo Library. This is updated in the new (nested) transaction, rather than the Library instance itself.
Related
Unable to run any services in cloudera manager express 5.9
Server Error A server error has occurred. Send the following information to Cloudera. Version: Cloudera Express 5.9.1 (#8 built by jenkins on 20170112-1158 git: a66d8bbdbe8bc3ee54235e55423f2f76c7d9f3b1) Detected pause in JVM or host machine (e.g. a stop the world GC, or JVM not scheduled): paused approximately 2936ms: no GCs detected. org.springframework.web.bind.MissingServletRequestParameterException:Required String parameter 'action' is not present at AnnotationMethodHandlerAdapter.java line 738 in org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker raiseMissingParameterException() Stack Trace: AnnotationMethodHandlerAdapter.java line 738 in org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker raiseMissingParameterException() HandlerMethodInvoker.java line 501 in org.springframework.web.bind.annotation.support.HandlerMethodInvoker resolveRequestParam() HandlerMethodInvoker.java line 340 in org.springframework.web.bind.annotation.support.HandlerMethodInvoker resolveHandlerArguments() HandlerMethodInvoker.java line 171 in org.springframework.web.bind.annotation.support.HandlerMethodInvoker invokeHandlerMethod() AnnotationMethodHandlerAdapter.java line 436 in org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter invokeHandlerMethod() AnnotationMethodHandlerAdapter.java line 424 in org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter handle() DispatcherServlet.java line 790 in org.springframework.web.servlet.DispatcherServlet doDispatch() DispatcherServlet.java line 719 in org.springframework.web.servlet.DispatcherServlet doService() FrameworkServlet.java line 669 in org.springframework.web.servlet.FrameworkServlet processRequest() FrameworkServlet.java line 574 in org.springframework.web.servlet.FrameworkServlet doGet() HttpServlet.java line 707 in javax.servlet.http.HttpServlet service() HttpServlet.java line 820 in javax.servlet.http.HttpServlet service() ServletHolder.java line 511 in org.mortbay.jetty.servlet.ServletHolder handle() ServletHandler.java line 1221 in org.mortbay.jetty.servlet.ServletHandler$CachedChain doFilter() UserAgentFilter.java line 78 in org.mortbay.servlet.UserAgentFilter doFilter() GzipFilter.java line 131 in org.mortbay.servlet.GzipFilter doFilter() ServletHandler.java line 1212 in org.mortbay.jetty.servlet.ServletHandler$CachedChain doFilter() JAMonServletFilter.java line 48 in com.jamonapi.http.JAMonServletFilter doFilter() ServletHandler.java line 1212 in org.mortbay.jetty.servlet.ServletHandler$CachedChain doFilter() JavaMelodyFacade.java line 109 in com.cloudera.enterprise.JavaMelodyFacade$MonitoringFilter doFilter() ServletHandler.java line 1212 in org.mortbay.jetty.servlet.ServletHandler$CachedChain doFilter() FilterChainProxy.java line 311 in org.springframework.security.web.FilterChainProxy$VirtualFilterChain doFilter() FilterSecurityInterceptor.java line 116 in org.springframework.security.web.access.intercept.FilterSecurityInterceptor invoke() FilterSecurityInterceptor.java line 83 in org.springframework.security.web.access.intercept.FilterSecurityInterceptor doFilter() FilterChainProxy.java line 323 in org.springframework.security.web.FilterChainProxy$VirtualFilterChain doFilter() ExceptionTranslationFilter.java line 113 in org.springframework.security.web.access.ExceptionTranslationFilter doFilter() FilterChainProxy.java line 323 in org.springframework.security.web.FilterChainProxy$VirtualFilterChain doFilter() SessionManagementFilter.java line 101 in org.springframework.security.web.session.SessionManagementFilter doFilter() FilterChainProxy.java line 323 in org.springframework.security.web.FilterChainProxy$VirtualFilterChain doFilter() AnonymousAuthenticationFilter.java line 113 in org.springframework.security.web.authentication.AnonymousAuthenticationFilter doFilter() FilterChainProxy.java line 323 in org.springframework.security.web.FilterChainProxy$VirtualFilterChain doFilter() RememberMeAuthenticationFilter.java line 146 in org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter doFilter() FilterChainProxy.java line 323 in org.springframework.security.web.FilterChainProxy$VirtualFilterChain doFilter() SecurityContextHolderAwareRequestFilter.java line 54 in org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter doFilter() FilterChainProxy.java line 323 in org.springframework.security.web.FilterChainProxy$VirtualFilterChain doFilter() RequestCacheAwareFilter.java line 45 in org.springframework.security.web.savedrequest.RequestCacheAwareFilter doFilter() FilterChainProxy.java line 323 in org.springframework.security.web.FilterChainProxy$VirtualFilterChain doFilter() AbstractAuthenticationProcessingFilter.java line 182 in org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter doFilter() FilterChainProxy.java line 323 in org.springframework.security.web.FilterChainProxy$VirtualFilterChain doFilter() LogoutFilter.java line 105 in org.springframework.security.web.authentication.logout.LogoutFilter doFilter() FilterChainProxy.java line 323 in org.springframework.security.web.FilterChainProxy$VirtualFilterChain doFilter() SecurityContextPersistenceFilter.java line 87 in org.springframework.security.web.context.SecurityContextPersistenceFilter doFilter() FilterChainProxy.java line 323 in org.springframework.security.web.FilterChainProxy$VirtualFilterChain doFilter() ConcurrentSessionFilter.java line 125 in org.springframework.security.web.session.ConcurrentSessionFilter doFilter() FilterChainProxy.java line 323 in org.springframework.security.web.FilterChainProxy$VirtualFilterChain doFilter() FilterChainProxy.java line 173 in org.springframework.security.web.FilterChainProxy doFilter() DelegatingFilterProxy.java line 237 in org.springframework.web.filter.DelegatingFilterProxy invokeDelegate() DelegatingFilterProxy.java line 167 in org.springframework.web.filter.DelegatingFilterProxy doFilter() ServletHandler.java line 1212 in org.mortbay.jetty.servlet.ServletHandler$CachedChain doFilter() CharacterEncodingFilter.java line 88 in org.springframework.web.filter.CharacterEncodingFilter doFilterInternal() OncePerRequestFilter.java line 76 in org.springframework.web.filter.OncePerRequestFilter doFilter() ServletHandler.java line 1212 in org.mortbay.jetty.servlet.ServletHandler$CachedChain doFilter() ServletHandler.java line 399 in org.mortbay.jetty.servlet.ServletHandler handle() SecurityHandler.java line 216 in org.mortbay.jetty.security.SecurityHandler handle() SessionHandler.java line 182 in org.mortbay.jetty.servlet.SessionHandler handle() SecurityHandler.java line 216 in org.mortbay.jetty.security.SecurityHandler handle() ContextHandler.java line 767 in org.mortbay.jetty.handler.ContextHandler handle() WebAppContext.java line 450 in org.mortbay.jetty.webapp.WebAppContext handle() HandlerWrapper.java line 152 in org.mortbay.jetty.handler.HandlerWrapper handle() StatisticsHandler.java line 53 in org.mortbay.jetty.handler.StatisticsHandler handle() HandlerWrapper.java line 152 in org.mortbay.jetty.handler.HandlerWrapper handle() Server.java line 326 in org.mortbay.jetty.Server handle() HttpConnection.java line 542 in org.mortbay.jetty.HttpConnection handleRequest() HttpConnection.java line 928 in org.mortbay.jetty.HttpConnection$RequestHandler headerComplete() HttpParser.java line 549 in org.mortbay.jetty.HttpParser parseNext() HttpParser.java line 212 in org.mortbay.jetty.HttpParser parseAvailable() HttpConnection.java line 404 in org.mortbay.jetty.HttpConnection handle() SelectChannelEndPoint.java line 410 in org.mortbay.io.nio.SelectChannelEndPoint run() QueuedThreadPool.java line 582 in org.mortbay.thread.QueuedThreadPool$PoolThread run()
The error message JVM pause points to the low heap size assigned to carry out its operations Detected pause in JVM or host machine (e.g. a stop the world GC, or JVM not scheduled): paused approximately 2936ms: no GCs detected. You should increase the CM server heap size. It can be set at CM server host in /etc/default/cloudera-scm-server change -Xmx option to a higher value preferably double the size. Save changes and restart Cloudera Manager.
spring-cloud-bus-kafka create applciationcontext twice
cloud version is Brixton.SR1.... i use sping-cloud-bus-kafka and sping-cloud-zookeeper-all (using zookeeper to discovery) ,every time ,there are two items in zookeeper,as : zookeeper data : zookeeper data image my yml is: my yml when started, it create applicationcontext twice , kafka producer twice, zookeeperclient twice, the stack trace is: first time: Thread [main] (Suspended (breakpoint at line 765 in ZooKeeper)) ZooKeeper.create(String, byte[], List<ACL>, CreateMode) line: 765 CreateBuilderImpl$11.call() line: 721 CreateBuilderImpl$11.call() line: 704 RetryLoop.callWithRetry(CuratorZookeeperClient, Callable<T>) line: 108 CreateBuilderImpl.pathInForeground(String, byte[]) line: 701 CreateBuilderImpl.protectedPathInForeground(String, byte[]) line: 477 CreateBuilderImpl.forPath(String, byte[]) line: 467 CreateBuilderImpl.forPath(String, byte[]) line: 44 ServiceDiscoveryImpl<T>.internalRegisterService(ServiceInstance<T>) line: 224 ServiceDiscoveryImpl<T>.reRegisterServices() line: 444 ServiceDiscoveryImpl<T>.start() line: 131 ZookeeperLifecycle.register() line: 55 ZookeeperLifecycle(AbstractDiscoveryLifecycle).start() line: 102 DefaultLifecycleProcessor.doStart(Map<String,Lifecycle>, String, boolean) line: 173 DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor, Map, String, boolean) line: 51 DefaultLifecycleProcessor$LifecycleGroup.start() line: 346 DefaultLifecycleProcessor.startBeans(boolean) line: 149 DefaultLifecycleProcessor.onRefresh() line: 112 AnnotationConfigApplicationContext(AbstractApplicationContext).finishRefresh() line: 852 AnnotationConfigApplicationContext(AbstractApplicationContext).refresh() line: 541 SpringApplication.refresh(ApplicationContext) line: 766 SpringApplication.createAndRefreshContext(SpringApplicationRunListeners, ApplicationArguments) line: 361 SpringApplication.run(String...) line: 307 SpringApplicationBuilder.run(String...) line: 134 BootstrapApplicationListener.bootstrapServiceContext(ConfigurableEnvironment, SpringApplication) line: 140 BootstrapApplicationListener.onApplicationEvent(ApplicationEnvironmentPreparedEvent) line: 84 BootstrapApplicationListener.onApplicationEvent(ApplicationEvent) line: 62 SimpleApplicationEventMulticaster.invokeListener(ApplicationListener, ApplicationEvent) line: 166 SimpleApplicationEventMulticaster.multicastEvent(ApplicationEvent, ResolvableType) line: 138 SimpleApplicationEventMulticaster.multicastEvent(ApplicationEvent) line: 121 EventPublishingRunListener.publishEvent(SpringApplicationEvent) line: 111 EventPublishingRunListener.environmentPrepared(ConfigurableEnvironment) line: 65 SpringApplicationRunListeners.environmentPrepared(ConfigurableEnvironment) line: 54 SpringApplication.createAndRefreshContext(SpringApplicationRunListeners, ApplicationArguments) line: 330 SpringApplication.run(String...) line: 307 BaseApplication.main(String[]) line: 42 Hello.main(String[]) line: 15 second time : Thread [main] (Suspended (breakpoint at line 765 in ZooKeeper)) ZooKeeper.create(String, byte[], List<ACL>, CreateMode) line: 765 CreateBuilderImpl$11.call() line: 721 CreateBuilderImpl$11.call() line: 704 RetryLoop.callWithRetry(CuratorZookeeperClient, Callable<T>) line: 108 CreateBuilderImpl.pathInForeground(String, byte[]) line: 701 CreateBuilderImpl.protectedPathInForeground(String, byte[]) line: 477 CreateBuilderImpl.forPath(String, byte[]) line: 467 CreateBuilderImpl.forPath(String, byte[]) line: 44 ServiceDiscoveryImpl<T>.internalRegisterService(ServiceInstance<T>) line: 224 ServiceDiscoveryImpl<T>.reRegisterServices() line: 444 ServiceDiscoveryImpl<T>.start() line: 131 ZookeeperLifecycle.register() line: 55 ZookeeperLifecycle(AbstractDiscoveryLifecycle).start() line: 102 DefaultLifecycleProcessor.doStart(Map<String,Lifecycle>, String, boolean) line: 173 DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor, Map, String, boolean) line: 51 DefaultLifecycleProcessor$LifecycleGroup.start() line: 346 DefaultLifecycleProcessor.startBeans(boolean) line: 149 DefaultLifecycleProcessor.onRefresh() line: 112 AnnotationConfigApplicationContext(AbstractApplicationContext).finishRefresh() line: 852 AnnotationConfigApplicationContext(AbstractApplicationContext).refresh() line: 541 SpringApplication.refresh(ApplicationContext) line: 766 SpringApplication.createAndRefreshContext(SpringApplicationRunListeners, ApplicationArguments) line: 361 SpringApplication.run(String...) line: 307 SpringApplicationBuilder.run(String...) line: 134 BootstrapApplicationListener.bootstrapServiceContext(ConfigurableEnvironment, SpringApplication) line: 140 BootstrapApplicationListener.onApplicationEvent(ApplicationEnvironmentPreparedEvent) line: 84 BootstrapApplicationListener.onApplicationEvent(ApplicationEvent) line: 62 SimpleApplicationEventMulticaster.invokeListener(ApplicationListener, ApplicationEvent) line: 166 SimpleApplicationEventMulticaster.multicastEvent(ApplicationEvent, ResolvableType) line: 138 SimpleApplicationEventMulticaster.multicastEvent(ApplicationEvent) line: 121 EventPublishingRunListener.publishEvent(SpringApplicationEvent) line: 111 EventPublishingRunListener.environmentPrepared(ConfigurableEnvironment) line: 65 SpringApplicationRunListeners.environmentPrepared(ConfigurableEnvironment) line: 54 SpringApplication.createAndRefreshContext(SpringApplicationRunListeners, ApplicationArguments) line: 330 SpringApplication.run(String...) line: 307 SpringApplicationBuilder.run(String...) line: 134 DefaultBinderFactory<T>.getBinder(String) line: 156 ChannelBindingService.getBinderForChannel(String) line: 142 ChannelBindingService.bindProducer(MessageChannel, String) line: 104 BindableProxyFactory.bindOutputs(ChannelBindingService) line: 205 OutputBindingLifecycle.start() line: 57 DefaultLifecycleProcessor.doStart(Map<String,Lifecycle>, String, boolean) line: 173 DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor, Map, String, boolean) line: 51 DefaultLifecycleProcessor$LifecycleGroup.start() line: 346 DefaultLifecycleProcessor.startBeans(boolean) line: 149 DefaultLifecycleProcessor.onRefresh() line: 112 AnnotationConfigEmbeddedWebApplicationContext(AbstractApplicationContext).finishRefresh() line: 852 AnnotationConfigEmbeddedWebApplicationContext(EmbeddedWebApplicationContext).finishRefresh() line: 140 AnnotationConfigEmbeddedWebApplicationContext(AbstractApplicationContext).refresh() line: 541 AnnotationConfigEmbeddedWebApplicationContext(EmbeddedWebApplicationContext).refresh() line: 118 SpringApplication.refresh(ApplicationContext) line: 766 SpringApplication.createAndRefreshContext(SpringApplicationRunListeners, ApplicationArguments) line: 361 SpringApplication.run(String...) line: 307 BaseApplication.main(String[]) line: 42 Hello.main(String[]) line: 15 who knows what happens???? thanks.....
Julia: How to profile parallel code
Whats an appropriate way to profile parallel code in julia? When I run #profile foo(...) where foo is my function, I get julia> Profile.print() 1234 task.jl; anonymous; line: 23 4 multi.jl; remotecall_fetch; line: 695 2 multi.jl; send_msg_; line: 172 2 serialize.jl; serialize; line: 74 2 serialize.jl; serialize; line: 299 2 serialize.jl; serialize; line: 130 2 serialize.jl; serialize; line: 299 1 dict.jl; serialize; line: 369 1 serialize.jl; serialize_type; line: 278 1 serialize.jl; serialize; line: 199 1 serialize.jl; serialize; line: 227 1 serialize.jl; serialize; line: 160 1 serialize.jl; serialize; line: 160 1 serialize.jl; serialize; line: 299 1 serialize.jl; serialize; line: 294 1 io.jl; write; line: 47 1 ./iobuffer.jl; write; line: 234 1 ./iobuffer.jl; ensureroom; line: 151 1 ./array.jl; resize!; line: 503 2 multi.jl; send_msg_; line: 178 2 stream.jl; write; line: 724 1230 multi.jl; remotecall_fetch; line: 696 1230 ./multi.jl; wait_full; line: 595 1230 ./task.jl; wait; line: 189 1229 ./task.jl; wait; line: 269 1229 ./stream.jl; process_events; line: 529 1 ./task.jl; wait; line: 282 1 ./stream.jl; process_events; line: 529 402 task.jl; anonymous; line: 95 402 REPL.jl; eval_user_input; line: 53 401 profile.jl; anonymous; line: 14 401 ...mba/src/model/mcmc.jl; mcmc; line: 314 401 ./task.jl; sync_end; line: 306 401 task.jl; wait; line: 48 401 ./task.jl; wait; line: 189 401 ./task.jl; wait; line: 269 401 ./stream.jl; process_events; line: 529 1 profile.jl; anonymous; line: 16 217 task.jl; task_done_hook; line: 83 217 ./task.jl; wait; line: 269 217 ./stream.jl; process_events; line: 529
Don't know if it will work, but you might want to consider having the workers call a function that looks something like this: function profile_function(func, args...) Profile.clear() ret = #profile apply(func, args) pdata = Profile.retrieve() ret, pdata end pdata should contain the profiling data from that worker. You should be able to view it in ProfileView.
You may try VTune Amplifier (https://software.intel.com/en-us/intel-vtune-amplifier-xe) to profile Julia code at function level as described at https://software.intel.com/en-us/blogs/2013/10/10/profiling-julia-code-with-intel-vtune-amplifier. You may also need to apply a patch to LLVM (https://gist.github.com/ArchRobison/d3601433d160b05ed5ee) to workaround source level performance information bug to get correct data at a source line level
Method postToSystem() is automatically called on deployment in spring
I have a simple Spring application, with a bean which contains a method with the name postToSystem(parameters) without any annotations and it is automatically called on deployment (and throws an exception). Could someone explain me what is the problem here? Is it the method name? The stacktrace when it is called is: Daemon Thread [http-bio-127.0.0.1-8080-exec-1] (Suspended (breakpoint at line 128 in CustomerExportServiceImpl)) owns: ConcurrentHashMap<K,V> (id=93) owns: Object (id=94) owns: StandardContext (id=95) owns: ManagerServlet (id=96) owns: SocketWrapper<E> (id=97) CustomerExportServiceImpl.<init>() line: 128 NativeConstructorAccessorImpl.newInstance0(Constructor, Object[]) line: not available [native method] [local variables unavailable] NativeConstructorAccessorImpl.newInstance(Object[]) line: 57 DelegatingConstructorAccessorImpl.newInstance(Object[]) line: 45 Constructor<T>.newInstance(Object...) line: 526 BeanUtils.instantiateClass(Constructor<T>, Object...) line: 148 CglibSubclassingInstantiationStrategy(SimpleInstantiationStrategy).instantiate(RootBeanDefinition, String, BeanFactory) line: 87 DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).instantiateBean(String, RootBeanDefinition) line: 1000 DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).createBeanInstance(String, RootBeanDefinition, Object[]) line: 953 DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).doCreateBean(String, RootBeanDefinition, Object[]) line: 487 DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).createBean(String, RootBeanDefinition, Object[]) line: 458 AbstractBeanFactory$1.getObject() line: 295 DefaultListableBeanFactory(DefaultSingletonBeanRegistry).getSingleton(String, ObjectFactory) line: 223 DefaultListableBeanFactory(AbstractBeanFactory).doGetBean(String, Class<T>, Object[], boolean) line: 292 DefaultListableBeanFactory(AbstractBeanFactory).getBean(String) line: 194 DefaultListableBeanFactory.preInstantiateSingletons() line: 626 XmlWebApplicationContext(AbstractApplicationContext).finishBeanFactoryInitialization(ConfigurableListableBeanFactory) line: 932 XmlWebApplicationContext(AbstractApplicationContext).refresh() line: 479 ContextLoaderListener(ContextLoader).configureAndRefreshWebApplicationContext(ConfigurableWebApplicationContext, ServletContext) line: 389 ContextLoaderListener(ContextLoader).initWebApplicationContext(ServletContext) line: 294 ContextLoaderListener.contextInitialized(ServletContextEvent) line: 112 StandardContext.listenerStart() line: 4973 StandardContext.startInternal() line: 5467 StandardContext(LifecycleBase).start() line: 150 StandardHost(ContainerBase).addChildInternal(Container) line: 901 StandardHost(ContainerBase).addChild(Container) line: 877 StandardHost.addChild(Container) line: 632 HostConfig.deployWAR(ContextName, File) line: 1083 HostConfig.deployApps(String) line: 553 HostConfig.check(String) line: 1671 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43 Method.invoke(Object, Object...) line: 606 BaseModelMBean.invoke(String, Object[], String[]) line: 301 DefaultMBeanServerInterceptor.invoke(ObjectName, String, Object[], String[]) line: 819 JmxMBeanServer.invoke(ObjectName, String, Object[], String[]) line: 801 ManagerServlet.check(String) line: 1485 ManagerServlet.deploy(PrintWriter, ContextName, String, boolean, HttpServletRequest, StringManager) line: 709 ManagerServlet.doPut(HttpServletRequest, HttpServletResponse) line: 450 ManagerServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 649 ManagerServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 727 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 303 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 208 WsFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 52 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 241 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 208 SetCharacterEncodingFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 108 ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 241 ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 208 StandardWrapperValve.invoke(Request, Response) line: 220 StandardContextValve.invoke(Request, Response) line: 122 BasicAuthenticator(AuthenticatorBase).invoke(Request, Response) line: 610 StandardHostValve.invoke(Request, Response) line: 171 ErrorReportValve.invoke(Request, Response) line: 102 AccessLogValve.invoke(Request, Response) line: 950 StandardEngineValve.invoke(Request, Response) line: 116 CoyoteAdapter.service(Request, Response) line: 408 Http11Processor(AbstractHttp11Processor<S>).process(SocketWrapper<S>) line: 1040 Http11Protocol$Http11ConnectionHandler(AbstractProtocol$AbstractConnectionHandler<S,P>).process(SocketWrapper<S>, SocketStatus) line: 607 JIoEndpoint$SocketProcessor.run() line: 314 ThreadPoolExecutor(ThreadPoolExecutor).runWorker(ThreadPoolExecutor$Worker) line: 1145 ThreadPoolExecutor$Worker.run() line: 615 TaskThread$WrappingRunnable.run() line: 61 TaskThread(Thread).run() line: 745 applicationContext.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd"> <!-- post-processors for all standard config annotations --> <context:annotation-config /> <context:component-scan base-package="com.mydomain.service" /> <bean id="jndiDataSourceLookup" class="org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup"/> <!-- + OTHER BEANS ARE ALSO DEFINED--> </beans> Spring version: 3.2.3
double-initialization of spring beans in jetty 7.1.4
When I start a webapp that has a spring configuration in jetty, I see two calls to initialization (#PostConstruct methods). web.xml declares a ContextLoaderListener and provides contextConfigLocation. This seems wrong. (spring 3.0.3). Is there something I've done? EDIT My web.xml calls out both the DispatcherServlet and the org.springframework.web.context.ContextLoaderListener. If I remove the later, I stop seeing two initializations --- but my app fails in the jetty-maven-plugin with No WebApplicationContext found: no ContextLoaderListener registered? EDIT 2: Got it. The dispatch servlet will find some context files by conventional name (*-servlet.xml), and so calling that file out again in the contextConfigLocation led to it being loaded twice. Stack trace 1: Segmenter.initialize() line: 63 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 597 InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(Object) line: 340 InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(Object, String) line: 293 CommonAnnotationBeanPostProcessor(InitDestroyAnnotationBeanPostProcessor).postProcessBeforeInitialization(Object, String) line: 130 DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).applyBeanPostProcessorsBeforeInitialization(Object, String) line: 394 DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).initializeBean(String, Object, RootBeanDefinition) line: 1405 DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).doCreateBean(String, RootBeanDefinition, Object[]) line: 519 DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).createBean(String, RootBeanDefinition, Object[]) line: 456 AbstractBeanFactory$1.getObject() line: 291 DefaultListableBeanFactory(DefaultSingletonBeanRegistry).getSingleton(String, ObjectFactory) line: 222 DefaultListableBeanFactory(AbstractBeanFactory).doGetBean(String, Class<T>, Object[], boolean) line: 288 DefaultListableBeanFactory(AbstractBeanFactory).getBean(String) line: 190 DefaultListableBeanFactory.preInstantiateSingletons() line: 574 XmlWebApplicationContext(AbstractApplicationContext).finishBeanFactoryInitialization(ConfigurableListableBeanFactory) line: 895 XmlWebApplicationContext(AbstractApplicationContext).refresh() line: 425 ContextLoaderListener(ContextLoader).createWebApplicationContext(ServletContext, ApplicationContext) line: 276 ContextLoaderListener(ContextLoader).initWebApplicationContext(ServletContext) line: 197 ContextLoaderListener.contextInitialized(ServletContextEvent) line: 47 JettyWebAppContext(ContextHandler).startContext() line: 645 JettyWebAppContext(ServletContextHandler).startContext() line: 200 JettyWebAppContext(WebAppContext).startContext() line: 995 JettyWebAppContext(ContextHandler).doStart() line: 588 JettyWebAppContext(WebAppContext).doStart() line: 381 JettyWebAppContext.doStart() line: 114 JettyWebAppContext(AbstractLifeCycle).start() line: 55 ContextHandlerCollection(HandlerCollection).doStart() line: 165 ContextHandlerCollection.doStart() line: 162 ContextHandlerCollection(AbstractLifeCycle).start() line: 55 HandlerCollection.doStart() line: 165 HandlerCollection(AbstractLifeCycle).start() line: 55 JettyServer(HandlerWrapper).doStart() line: 92 JettyServer(Server).doStart() line: 228 JettyServer.doStart() line: 67 Stack trace 2: Segmenter.initialize() line: 63 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 597 InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(Object) line: 340 InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(Object, String) line: 293 CommonAnnotationBeanPostProcessor(InitDestroyAnnotationBeanPostProcessor).postProcessBeforeInitialization(Object, String) line: 130 DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).applyBeanPostProcessorsBeforeInitialization(Object, String) line: 394 DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).initializeBean(String, Object, RootBeanDefinition) line: 1405 DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).doCreateBean(String, RootBeanDefinition, Object[]) line: 519 DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).createBean(String, RootBeanDefinition, Object[]) line: 456 AbstractBeanFactory$1.getObject() line: 291 DefaultListableBeanFactory(DefaultSingletonBeanRegistry).getSingleton(String, ObjectFactory) line: 222 DefaultListableBeanFactory(AbstractBeanFactory).doGetBean(String, Class<T>, Object[], boolean) line: 288 DefaultListableBeanFactory(AbstractBeanFactory).getBean(String) line: 190 DefaultListableBeanFactory.preInstantiateSingletons() line: 574 XmlWebApplicationContext(AbstractApplicationContext).finishBeanFactoryInitialization(ConfigurableListableBeanFactory) line: 895 XmlWebApplicationContext(AbstractApplicationContext).refresh() line: 425 DispatcherServlet(FrameworkServlet).createWebApplicationContext(ApplicationContext) line: 442 DispatcherServlet(FrameworkServlet).createWebApplicationContext(WebApplicationContext) line: 458 DispatcherServlet(FrameworkServlet).initWebApplicationContext() line: 339 DispatcherServlet(FrameworkServlet).initServletBean() line: 306 DispatcherServlet(HttpServletBean).init() line: 127 DispatcherServlet(GenericServlet).init(ServletConfig) line: 241 ServletHolder.initServlet() line: 421 ServletHolder.doStart() line: 245 ServletHolder(AbstractLifeCycle).start() line: 55 ServletHandler(ServletHandler).initialize() line: 691 JettyWebAppContext(ServletContextHandler).startContext() line: 204 JettyWebAppContext(WebAppContext).startContext() line: 995 JettyWebAppContext(ContextHandler).doStart() line: 588 JettyWebAppContext(WebAppContext).doStart() line: 381 JettyWebAppContext.doStart() line: 114 JettyWebAppContext(AbstractLifeCycle).start() line: 55 ContextHandlerCollection(HandlerCollection).doStart() line: 165 ContextHandlerCollection.doStart() line: 162 ContextHandlerCollection(AbstractLifeCycle).start() line: 55 HandlerCollection.doStart() line: 165 HandlerCollection(AbstractLifeCycle).start() line: 55 JettyServer(HandlerWrapper).doStart() line: 92 JettyServer(Server).doStart() line: 228 JettyServer.doStart() line: 67
Actally, you have two Spring application contexts: Context loaded by ContextLoaderListener from the XML files specified by context-param named contextConfigLocation (or applicationContext.xml by default). Context loaded by DispatcherServlet from the XML files specified by the dispatcher servlet's init-param named contextConfigLocation (or <servletname>-servlet.xml by default). The former is a parent context of the latter. So, you somehow got a definitions of the same bean in both contexts (perhaps, both contextConfigLocations point to the same XML files).