6 Replies Latest reply on Dec 9, 2003 2:45 PM by sugramoin

    Perform computation at start up

    sugramoin

      I wanted to do some computation at start up which deals with entity beans.

      I Used MBean to do that; in the start method i am invoking a entity bean using java:comp/env .

      As MBean are deployed before entity beans; its abvious that i get an error regarding env saying env not bound.

      Is there a different way to do that ...
      I'm i do'in any thing wrong...

      help me out
      Moin

        • 1. Re: Perform computation at start up
          sugramoin

          Can any one help me out , here...

          When jboss server starts i want it to do same clean up task in database through its deployed entity beans.

          I wanted to use a MBean to do this which works on startup of a server.

          Tell me how to do this.

          TIA
          Moin

          • 2. Re: Perform computation at start up
            raja05

            Have a depends clause in the jboss-service.xml for ur mbean. something like



            jboss.j2ee:jndiName=local/TestMDB,service=EJB




            The depends should have the objectname for ur EJB. Look up the JMX-Console to get the objectname for ur ejb. it will be in the jboss.j2ee domain.

            -Raj

            • 3. Re: Perform computation at start up
              sugramoin

              Thanx Raj

              i will try this.

              • 4. Re: Perform computation at start up
                sugramoin

                i did that change in mbean tag. but this din't slove my problem.

                It says env not bound..

                14:02:11,734 INFO [TimeLineScheduler] starting Scheduler MBean
                14:02:11,734 INFO [TimeLineScheduler] Removing all aged time line schedules
                14:02:11,734 ERROR [STDERR] javax.naming.NameNotFoundException: env not bound
                14:02:11,734 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
                14:02:11,750 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
                14:02:11,750 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
                14:02:11,750 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:253)
                14:02:11,750 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:492)
                14:02:11,750 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:606)
                14:02:11,750 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
                


                I guess the mbean is looking up the EJB before they are deployed.
                What do i need to do to stop MBeans for some more time, like till all the EJB are deployed there DB is configured and they are ready to use.

                looking for help

                Moin

                • 5. Re: Perform computation at start up
                  raja05

                  Just lookup the bean using the absolute jndi name and not using java:comp/env

                  • 6. Re: Perform computation at start up
                    sugramoin

                    Hey Raj

                    I tried that, but thats also not working ...
                    throwing this error saying name not found

                    15:41:22,015 INFO [STDOUT] Started the K5Scanner to implement the schedules for Kommander
                    15:41:22,015 INFO [TimeLineScheduler] starting Scheduler MBean
                    15:41:22,015 INFO [TimeLineScheduler] Removing all aged time line schedules
                    15:41:22,015 ERROR [STDERR] javax.naming.NameNotFoundException: TimeLine_Home not bound
                    15:41:22,015 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
                    15:41:22,015 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
                    15:41:22,015 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
                    15:41:22,015 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
                    15:41:22,015 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:492)
                    15:41:22,015 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
                    15:41:22,015 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:347)
                    


                    Is there any thing else i need to do ...
                    Guess i am missing somthing.

                    Moin