Singleton service

Hi guys
I tried to create singleton service by implement SingletonService interface which provided by weblogic.
And configure singleton service in
weblogic-application.xml file.
And define singleton service in
environment->cluster->singleton service tab in weblogic console.
I used to create Singleton service instance like such a way
SingletonServiceTest singletonServiceTest =
(SingletonServiceTest)SingletonServicesManager.
getInstance().
getService("SingletonServiceTest");
Problem was
     SingletonServicesManager give the different singleton service instance for different server.

I have partial solution now:
For proper work of SingletonService, the servers (cluster nodes) must be run using node manager. Then SingletonService as pure java class works - methods activate and deactivate are called as expected.
However it seems, that MDB cannot be a SingletonService.
zmach

Similar Messages

  • Error with running Singleton Service in a non-clustered mode

    Hello,
    I'm getting this error when try to deploy an app with defined Singleton Service in a WebLogic 10.3.5:
    <Error> <Deployer> <localdomain> <AdminServer><[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default(self-tuning)'> <<WLS Kernel>> <><7785ef355ffde3d6:-4c7bfbbc:138dd48f82b:-8000-0000000000000002><1343742871514> <BEA-149231> <Unable to set the activation state to true for the application 'MyApp'.
    weblogic.management.DeploymentException:
    at weblogic.application.internal.flow.SingletonServicesFlow.activate(SingletonServicesFlow.java:67)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:636)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
    at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
    at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
    at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
    at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:52)
    at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
    at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:31)
    at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
    at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:170)
    at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:124)
    at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:181)
    at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:97)
    at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused By: java.lang.IllegalArgumentException: Cannot add Singleton Service MySingletonService as SingletonServicesManager not started. Check if MigrationBasis for cluster is configured.
    at weblogic.cluster.singleton.SingletonServicesManager.addConfiguredService(SingletonServicesManager.java:280)
    at weblogic.cluster.singleton.SingletonServicesManager.addConfiguredService(SingletonServicesManager.java:297)
    at weblogic.application.internal.flow.SingletonServicesFlow.activate(SingletonServicesFlow.java:65)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:637)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:54)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
    at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
    at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
    at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
    at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:52)
    at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
    at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:31)
    at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
    at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:170)
    at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:124)
    at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:181)
    at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:97)
    at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    It gets run only after deleting singleton-service entry from weblogic-application.xml:
    <singleton-service>
         <class-name>my.app.SingletonClass</class-name>
         <name>MySingletonService</name>
    </singleton-service>
    Is it possible to run it in a non-clustered server without deleting Singleton entry from weblogic-application.xml?
    Thanks

    Did this help you ??
    Not sure if it's related as here the issue is with clustered/non clustred and versioning!! the application which the bug talks about.

  • Singleton service example

    Hi
              In order to create and deploy a singleton service on WebLogic 92, I did exactly as the book said (http://edocs.bea.com/wls/docs92/cluster/migration.html#wp1045262). But it didn't work.
              So I wish to find a tested example (all required files), or an artical that describes the whole process of creating and deploying a singleton-service, with one of you.
              Thx in advanse

    Hi,
              I'm runing into issues trying to build a simple singleton service. Actually, I do not even know how to invoke methods on the singleton. I guess there is not enough documentation on this. Just curious whether or not you get this working. I will really appreciate it if you can share some ideas/knowledge.
              Thanks, Adam

  • Is Singleton service available in oracle application server

    Is Singleton service available in oracle application server
    if yes please provide documentation

    Hi,
    what do you mean with singleton service? I know singletons as a design pattern in J2EE, so you may have to provide more information to get this question answered.
    Frank

  • Singleton service/task in a cluster

    I have a timer that schecules multiple task. This runs fine in a single JVM.
    When I cluster using coherence does coherence provide any framework to convert this task to a singleton service so that only a node in the cluster executes it?
    Thanks
    Kumar Pandey

    Hi Kumar,
    Yes, WorkManager is clearly one way to do it. It is most useful when your tasks come from a single client thread.
    In a scenario, when you have many clients in a cluster that may want to execute the same task at the same time, a concurrency API could be an answer. Please see this postas an example for using this pattern.
    Regards,
    Gene

  • Singleton Service in Cluster

    Has anybody created the singleton servince in cluster and migrated once the server goes down. If so can you please share the sameple and steps for the migration.
    Thanks,

    Here is an example on how to create a singleton service: http://middlewaremagic.com/weblogic/?p=5799
    Example on configuring migration can be found here: http://middlewaremagic.com/weblogic/?p=7188

  • Weblogic Singleton Service concurrent updates

    Our environment has 1 cluster with 4 managed servers(each in a different physical servers).We have a requirement to maintain a cache which is transparent to all the 4 servers(only one copy is expected to be available at any point of time in the cluster) . This cache contains hashmap which gets updated every millisecond by clients performing calculations.This cache does not grow in volume overtime but has very frequent updates. We plan to implement a weblogic singleton service to handle this caching requirement .
    1. Based on your past experience, Is weblogic singleton an ideal candidate for such a requirement. Does this introduce any delay because of synchronizing between the 4 managed servers? This will be used by the pricing engine and we do not want this to introduce any additional delay using this technology.
    2. Also can you let me know what is the underlying technology weblogic(does it use IP multicast??? or do we have a choice choosing either IP socket, ip unicast or mulicast) uses to syncronize the data in singleton object with the managed servers.
    3. Can I have this setup without a nodemanager as nodemanages are not allowed in our environment. According to what I read from weblogic documentation, nodemanager is required if we use consensus leasing only.If I choose to use database leasing, node manager is not required. Is that true?
    Thanks for your help.

    I'd be seriously looking at Oracle Coherence, which is specifically designed to solve this sort of distributing caching/map problem.
    http://coherence.oracle.com/display/COH/Oracle+Coherence+Knowledge+Base+Home
    -steve-

  • How to implement singleton service if i m using only jar and war component

    hello,
    in my application i m using only jar and war component .
    as i m not using EAR for deployment so i dont have weblogic-application.xml file.
    so in this case how i implement weblogic singleton service .and how to call active method

    From the documentation:
    After you have created a singleton service class using the SingletonService interface, you must define it as a singleton service within WebLogic Server. This singleton service object contains the following information:
    The path to the class to load as the singleton service.
    The preferred server and other candidate servers for the singleton service.
    The following excerpt from the cluster element of config.xml shows how a singleton service is defined:
    <singleton-service>
    <name>SingletonTestServiceName</name>
    <user-preferred-server>myManaged1</user-preferred-server>
    <class-name>mycompany.myprogram.subpackage.SingletonTestServiceImpl</class-name>
    <cluster>myCluster</cluster>
    </singleton-service>
    Note that the config.xml is located in the <domain-home>/config directory

  • Admin Server Shows Singleton Services Manager not started

    Hi,
    I have an environment with 1 Admin Server and 2 Managed Servers in the cluster.
    I am using Migration basis as database for the cluster. I checked by installing one singleton service that it is working fine in cluster.
    Then I created one migratable target having auto migration as the migration policy and migratable target is also working as expected.
    Now the problem is whenever I start my Admin Server it is throwing exception:
    Cannot add Singleton Service <Migratable Target Name> as Singleton not started.  Check if MigrationBasis for cluster is configured.
    Anyone is having any idea about this problem, what can be the issue is?
    Thanks in Advance

    Hi Ramprakash Arun,
    To prevent the java.net.BindException, use a unique combination of the IP:port as the listen address for every channel configured on the server. No other process should be listening on that address (IP:port).
    Using netstat, verify whether the port specified is already in use by another process or not. Also check if the listen address is valid (using ipconfig/ifconfig).
    Regards,
    Vijaya

  • Weblogic clustering - share a singleton services without implementing weblogic  singletonService interface

    I have a singleton object java object in my application , when i deploy my application in clustering each cluster node creates a separate singleton object thus data integrity is lost. More over I am not in a position to change any of my code with specific to web-logic and implement any third party library such as teracotta.
    Can any one help me out of it in how to maintain the data integrity between the cluster nodes . Thanks in Advance

    Hi,
    I'm not sure if singleton services works with stateless session beans. By other hand, I understand as follow:-
    1. After you have created a singleton service class using the SingletonService interface, you must define it as a singleton service within WebLogic Server, see http://download.oracle.com/docs/cd/E1284001/wls/docs103/ConsoleHelp/taskhelp/clusters/ConfigureSingletonService.html_
    2. A singleton service is a service (application) on a cluster that is available and active on only one server at any given time, you must deploy the service on only one member of the cluster.
    3. For high avalability, you must implement WebLogic Service Migration for your singleton service, see http://download.oracle.com/docs/cd/E1284001/wls/docs103/cluster/service_migration.html#wp1051458_
    4. The clients connecting to the service, you must implement a special mechanism. See http://download.oracle.com/docs/cd/E1322201/wls/docs81/jndi/jndi.html#475689_

  • Clustered Singleton Service in WLS?

    Hello,
              I'm working on a clustered system that needs a distributed
              singleton. Specifically I need a timer/listener pair that
              will do work in the system, but I it would be bad to have
              more than one listener fired off within the cluster.
              How can I design this feature such that:
              1) There is only one active timer/listener in the clustered
              app active at any one time
              2) If this active instance dies, another somewhere in the
              cluster will be spooled up to take its place?
              I'm considering some kind of JXTA-based solution but before
              I invest a lot of energy in that direction I want to be
              sure I'm not trying to kill a fly with a bazooka.
              Thanks
              Greg
              

    I'm working on a clustered system that needs a distributed          > singleton. Specifically I need a timer/listener pair that
              > will do work in the system, but I it would be bad to have
              > more than one listener fired off within the cluster.
              > 1) There is only one active timer/listener in the clustered
              > app active at any one time
              > 2) If this active instance dies, another somewhere in the
              > cluster will be spooled up to take its place?
              See the clustered singleton example using Coherence:
              http://www.tangosol.net/forums/thread.jspa?forumID=6&threadID=82&tstart=0
              Peace,
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com/coherence.jsp
              Tangosol Coherence: Clustered Replicated Cache for Weblogic
              "Greg" <[email protected]> wrote in message
              news:[email protected]..
              >
              

  • SERVICE LOCATOR ?? Is it really an interesting Design pattern??

    Hi everybody,
    i've a problem with the J2EE Design Pattern "Services locator" (it's a singleton).
    It is said that by making use of a Service Locator we can :
    - hide to the client the complexities of initial context creation, EJB home object lookup,and EJB objectre-creation.
    - multiple clients can reuse the Service Locator object to reduce code complexity, provide a single point of control, and improve performance by providing a caching facility.
    But i would like to understand at which side should that service locator object reside??!!??
    If it is at server side then the clients need well an initial context in order to make a lookup on that object.
    Conclusion :
    the service locator doesn't hide the complexities of initial context!!
    Furthermore the client has to perform a look-up on that service locator object!! The only advantage left is caching facility.
    If it is at client side, each client needs his own services locator object
    Conclusion :
    multiple client don't reuse the same service locator. What's the advantage to be a singleton ???
    There is certainly something that i don't understand so help me please!! Thanks.

    Hi Yves,
    But i would like to understand at which side should
    that service locator object reside??!!??
    If it is at client side, each client needs his own
    services locator object
    Conclusion :
    multiple client don't reuse the same service locator.
    What's the advantage to be a singleton ???The service locator resides on the client side and is implemented as
    a singleton. Since it is possible that there could be multiple
    class loaders/JVMs on the client side, and therefore, multiple
    instances of the "singleton" service locator. This is typical
    in a distributed environment (e.g. servlets/JSPs in a web-tier
    cluster using service locator). Thus service locator is not
    a truly "distributed singleton" object. But, the empahsis
    is to design the service locator such that it does not hold
    any state that needs to be replicated across multiple
    instances across different JVMs as mentioned. Thus, there
    is no need for multiple clients to use the "same" service locator,
    but still the benefits of implementing this pattern is realized.
    By making it a singleton, and keeping it from holding state
    that needs to be replicated, we realize the benefits of this pattern.
    You may also want to visit the J2EE Pattern interest list
    and see these relevant discussions :
    Topic: Service Locator and passivation
    http://archives.java.sun.com/cgi-bin/wa?A2=ind0106&L=j2eepatterns-interest&F=&S=&P=1026
    Topic: Caching EJBHome interfaces
    http://archives.java.sun.com/cgi-bin/wa?A2=ind0106&L=j2eepatterns-interest&F=&S=&P=9226
    Topic: Using Service Locator for Data Source caching
    http://archives.java.sun.com/cgi-bin/wa?A1=ind0106&L=j2eepatterns-interest#31
    hope this helps,
    thanks,
    -deepak

  • Distributed Transaction Processing Services in Oracle RAC 11.2

    Hi,
    Do we have to set the DTP parameter to TRUE for workload services that are going to be used for distributed transaction processing?
    Something like this ...
    srvctl modify service -d crm -s xa_01.service.us.oracle.com -x TRUE
    Oracle 11.2 document is not very clear on this requirement. At one stage it says...
    "Tightly coupled XA transactions no longer require the special type of singleton services (that is, Oracle Distributed Transaction Processing (DTP) services) to be deployed on Oracle RAC database. XA transactions are transparently supported on Oracle RAC databases with any type of services configuration."
    But at the end of the same section...
    "An external transaction manager, such as OraMTS, coordinates DTP/XA transactions. However, an internal Oracle transaction manager coordinates distributed SQL transactions. Both DTP/XA and distributed SQL transactions must use the DTP service in Oracle RAC."
    So do we have to use DTP services with RAC or not?
    Thanks,
    -Sanjeev
    Edited by: user12219014 on 28 Jan, 2011 8:04 PM

    Hi Sanjeev,
    I have some critical applications using Tuxedo on 10gR1/R2 RAC databases and there is no doubt to have with this versions.
    Starting with 11gR1 it seems the main limitation is over...but there are still limitations ! To be honest I will keep the DTP parameter to true after the migration in 11.2 to avoid any problem. It is still recommended even if not mandatory :
    To provide improved application performance with distributed transaction processing in Oracle RAC, you may want to take advantage of DTP services. Using DTP services, you can direct all branches of a distributed transaction to a single instance in the cluster. To load balance across the cluster, it is better to have several groups of smaller application servers with each group directing its transactions to a single service, or set of services, than to have one or two larger application servers.
    Also check note 462060.1.
    Best regards
    Phil
    Edited by: Philippe Florent on Jan 30, 2011 10:07 AM -- add documentation precision

  • Singletons running on two servers at the same time

    Hello,
              we faced one interesting situation with our application, running on clustered BEA Weblogic 9.2. We implemented some Singletons (ie. Singleton Service in a Weblogic cluster) and they are running fine. Most of the time.
              Common scenarios: cluster is started -> the singletons run on one server; the server is brought down -> the singletons are started on the second server.
              However, we had recently two situations where the Singletons started on both servers! Here they are:
              1) We use Database Migration Basis and we have a dedicated table for Weblogic to capture current state of the singletons. Due to the fact that database (Oracle RAC) was partially available one of the Managed Server could not get the lease and probably assumed that no singleton is running, therefore started the singletons locally.
              2) Network outage: we had several minutes where none of our servers could communicate between them (neither between SASU MS nor with the database). Consequence: each MS decided to start the singleton locally (after some time, which I assume is the waiting time). Once the network came back the servers could communicate again but the duplicate singletons are not deactivate, so they are running in parallel.
              Anyone experienced the same or similar issues? How to prevent the above? Is the Consensus Migration Basis a better choice? (I think yes for #1 but not for situation #2).
              Any helpful answer is appreciated.
              Thank you, best regards,
              Remus.

    In general its not a good idea.  Running PSConfig will try to establish a lock on the configuration database.  Doing that from two servers at the same time may cause the update to fail.
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

  • Singleton ejb?

    Hi
              I need to wrapp an EJB service in a singleton service.
              But I don't know which class should be implements the weblogic.cluster.singleton.SingletonService interface (the home, remote or the bean).
              So what is the class that should implement this interface weblogic.cluster.singleton.SingletonService?
              Thanks in advance

    EJB 3.0 only supports programmatic timer creation. The app can contain an enterprise bean component that supports timer callbacks (a "timed object" in spec parlance) , but the actual timers can only be created by calling TimerService.createTimer(). Given that :
    1. There is no automatic timer creation as a result of deployment. Some developers approximate automatic timer creation
    by calling a stateless session bean method from a web application initialization callback, but from the ejb container's perspective
    that's just a normal run-time timer creation. In all cases you'll have as many timers as the number of times TimerService.createTimer() was called.
    2. In a cluster, for each unique timer, each timer timeout callback will happen in only one server instance in the cluster. We do that
    by using the underlying timer database and an ownership semantic that assigns each timer to a particular server instance. During
    failover, ownership of timers owned by the failed server instance is reassigned to a healthy server instance. Note that this only applies
    to timeout callbacks. All timers created by a bean are always visible to any instances of that bean in any server instance in the cluster.
    In other words, getTimers() always returns the total number of timers associated with the bean component, even if the callbacks
    happen in a different server instance in the cluster.
    3. Each call to TimerService.createTimer() is unique across the cluster. However, the burden of ensuring that createTimer() is only
    called once is on the application. EJB 3.1 will address this problem by adding "automatic timers". These are timers that are
    specified via metadata (annotation or ejb-jar.xml) and are created automatically as a result of deployment.

Maybe you are looking for