• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with Filters  RSS feed

 
Venkata Rajesh
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have 4 filters in my app in the order:
1. authentication filter
2. encoding filter
3. audit filter
4. compression filter

I have added the audit filter recently to record the statistics of the application in the db . Not to affect the stats of the actual app, I am inserting/updating the stats by running threads in the filter and from then the problem has started.

The app just hangs in cases where I perform some persist operations in the app. e.g. add a new user

In the above case, the user gets added succesfully but the app hangs after tht.

javax.management.InstanceAlreadyExistsException: PoolController Domain:name=PoolController
at com.sun.jmx.mbeanserver.RepositorySupport.addMBean(RepositorySupport.java:452)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.internal_addObject(DefaultMBeanServerInterceptor.java:1410)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:936)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:337)
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:497)
at uk.org.primrose.pool.jmx.PoolController.init(PoolController.java:845)
at uk.org.primrose.pool.datasource.MasterPoolDataSourceFactory.getObjectInstance(MasterPoolDataSourceFactory.java:99)
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:129)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at org.apache.naming.NamingContext.lookup(NamingContext.java:792)
at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
at org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:96)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at org.apache.naming.NamingContext.lookup(NamingContext.java:792)
at org.apache.naming.NamingContext.lookup(NamingContext.java:139)
at org.apache.naming.NamingContext.lookup(NamingContext.java:780)
at org.apache.naming.NamingContext.lookup(NamingContext.java:139)
at org.apache.naming.NamingContext.lookup(NamingContext.java:780)
at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:136)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at uk.org.primrose.pool.datasource.PoolDataSource.getConnection(PoolDataSource.java:57)

..........................................................................
..........................................................................

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:731)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)


Please let me know what is the issue here.

Thanks in advance.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.management.InstanceAlreadyExistsException:


From the looks of the exception, I'd guess that you're trying to instanciate your memory pool more than once. Do you have duplicate instanciation code in multiple filters?
 
Venkata Rajesh
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by memory pool here?

On a related note, the filter just works fine, if the operation of inserting/updating the audit info in the db is done synchronously(without using threads). But, I don't want to do this as this affects the actual app performance.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Venkata Rajesh:
What do you mean by memory pool here?

I'm just going by what's in your stack trace:

javax.management.InstanceAlreadyExistsException: PoolController Domain:name=PoolController
at com.sun.jmx.mbeanserver.RepositorySupport.addMBean(RepositorySupport.java:452)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.internal_addObject(DefaultMBeanServerInterceptor.java:1410)

On a related note, the filter just works fine, if the operation of inserting/updating the audit info in the db is done synchronously(without using threads). But, I don't want to do this as this affects the actual app performance.[/QB]
Originally posted by Venkata Rajesh:
[QB]

OK, so it sounds like you have a race condition in your code.
Maybe you have two threads trying to instanciate an object that is supposed to be singleton like in nature.

It's going to be hard for someone on a list to help you with this.
It sounds like you're going to need to go through your code and study how you're creating whatever objects you're creating and add some synchronization code somewhere.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!