Weblogic startup class: problem calling EJB's

Has anyone ever experienced a problem in using a startup class (registered in weblogic.properties)
and tried to lookup and use an EJB in the same application?
Basically, I have a startup class which registers to receive messages from an
MQ queue, and when it receives a message, it tries to do a lookup of a bean and
use it, but I receive a 'NullPointerException'.
I'm running Weblogic 5.1
(I know that Weblogic 6.0 makes use of MessageDrivenBeans, but my app isn't using
6 or EJB 2.0)
Thanks...

Can you post weblogic.log? Are you sure that EJB was deployed successfully.
Also comment the PROVIDER_URL in initial context and see if that solves the problem
Viresh Garg
BEA Systems
shaun wrote:
The exception is simply a 'NullPointerException' coming from the startup class
(I don't have the old log file or I would include the trace here.). Basically,
when my startup class receives a call to the onMessage(...) method (from listening
for messages), it looks up an EJB on the server, through the InitialContect class
and gets a 'null' returned back, thereby throwing the NullPointerException.
If anyone else is successful in having a startup class which can lookup and call
an EJB within the same Weblogic server, please help.
Thanks again....
Viresh Garg <[email protected]> wrote:
Can you post the exception stack trace? Also what exactly are you doing
in startup class.
Viresh Garg
Principal Developer Relations Engineer
BEA Systems
Shaun wrote:
Has anyone ever experienced a problem in using a startup class (registeredin weblogic.properties)
and tried to lookup and use an EJB in the same application?
Basically, I have a startup class which registers to receive messagesfrom an
MQ queue, and when it receives a message, it tries to do a lookup ofa bean and
use it, but I receive a 'NullPointerException'.
I'm running Weblogic 5.1
(I know that Weblogic 6.0 makes use of MessageDrivenBeans, but my appisn't using
6 or EJB 2.0)
Thanks...

Similar Messages

  • Weblogic Startup Class does not run as Windows Service

    If you know the answer, plase send me an email at [email protected]
    I'm running a weblogic startup class that starts a Thread. I need to
    run a batch program that should be running as long as WebLogic is
    running (to process new orders).
    It works fine when I run WebLogic (5.1 SP8) from a script, but causes
    problem when I'm running it as a Windows Service. It calls the
    startup class, however, the startup class never spawns the Thread
    class.
    Following is excerpts from different components:
    =============================================================
    *** weblogic.properties ***
    weblogic.system.startupClass.pdfCreatorStart=WebLogicStartupPdfCreator
    *** WebLogicStartupPdfCreator.java ***
    public class WebLogicStartupPdfCreator implements T3StartupDef {
    public String startup(String name, Hashtable args) throws
    Exception {
    Thread t = new ProductionPdfBatchRunner();
    t.start();
    return "success";
    *** ProductionPdfBatchRunner.java ***
    public class ProductionPdfBatchRunner extends Thread {
    public void run() {
    try {
    //work being done here
    this.sleep(30000);
    catch (InterruptedException ie) {               
    catch(Exception e) {
    e.printStackTrace();
    =============================================================
    Thanks for any help

    Hi,
    Ok. Few suggestions.
    1. Can you review the SAP note:
    552286  Troubleshooting for the SAP Web Dispatcher
    2. When you said: "web dispatcher does not get started ", what error you got ? Can you be more details here ?
    3. Please check the trace file dev_webdisp" that generated in the work directory. If the log entries is not abvious, increase the trace level to 2 or 3, and reproduce and re-check the trace file.
    4. What is the output of the command "sapwebdisp -v"
    5. How about sapwebdisp.pfl ? Are those settings correct ?
    Hope this helps.
    Regards,
    Vincent

  • WLS 10.0 Mp1 - Weblogic startup class to initialize client's SSL channels

    Hi,
    Is it possible to use Weblogic startup class to initialize client's SSL channels?
    Any pointers are appreciated.
    Thanks in advance.

    Hey
    If possible can you explain the issue in detail.
    What do you mean by “initialize client's SSL channels”
    Regards,
    Hussain

  • Weblogic startup class (urgent)

    Hi All,
    I need a java program (weblogic startup class) which should fetch data from the database and instantiate another one class (it will be the data holder) and store that object into a webapplication context. Anyone tried this? Since its urgent any help will be appreciated.
    Thanks in advance
    Cheers,
    Pandiaraj

    Do this in the init() method of a servlet and start
    the servlet when you start your weblogic server
    second that. just give a value of 1 for <load-on-startup> in web.xml

  • Startup class/process for EJB application

    Hi,
    I have an EJB module deployed on WebLogic8.1. My requirement is I would like to have a startup/shutdown class which is called when the EJB application is deployed. I have made some research and have found I can write startup/shutdown classes when for the server life cycle or for application life cycle events. Can anyone tell me write/deploy a startup/shutdown class for the EJB module life cycle.
    Thanks,
    Faizulla

    Hi,
    For Server life cycle events you can write server startup/shutdown classes.(You can see it from the console application)
    For application life cyccle events, please go through:
    http://e-docs.bea.com/wls/docs81/programming/app_xml.html#1007582
    You can specify it <listener> part of application.xml.
    This is impossible in J2EE standard. But perhaps this can be achieved by some app. server specific extensionYes,in earlier versiobns there was weblogic-ejb-extensions.xml file in which you can specify startup/shutdown class, like:
    <!DOCTYPE weblogic-ejb-extensions SYSTEM "weblogic-ejb-extensions.dtd" >
    <weblogic-ejb-extensions>
    <module-initializer-classs>
    <moduleinitializer-class-name>com.dcons.iss.ejb.MUTBStatusObject</moduleinitializer-class-name>
    </module-initializer-class>
    </weblogic-ejb-extensions>
    But it's no longer in use.
    I am still findind out a way for my EJB module initializer class.
    Regards,
    Faizulla

  • Weblogic startup class and EAR file

    Hi,
    I am using WL 8.1.5.
    I have a weblogic starup class MyStartup that implements T3StartupDef. (it does not specify package).
    I jar-ed it. And I placed MyStartup.jar file into the MyEA.ear file. And I placed that into applications dir.
    With WL Console I defined the startup class and for the ClassName specified MyStartup.
    Yet I get the java.lang.ClassNotFoundException.
    I also have a Manifest.mf file with
    Class-Path: MyStartup.jar
    Please help me solve this problem, I literally don't know what to do next.
    MB

    Hi,
    thanks.
    This seems like a completely opposite method of the depplying startup class with weblogic console.
    Does my class still need to implement T3StartupDef?
    I get this exception. And my classnotfound is still there.
    Exception:weblogic.management.ApplicationException: startup.MyStartup
         at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.createContainer(SlaveDeployer.java:2484)
         at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2396)
         at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:883)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:591)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500)
         at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
    Regards,
    MB

  • Configure weblogic startup class in deployment jar

    We need to invoke a class during weblogic startup that is part of application deployment jar...
    It works if startup class is added to server classpath ( Weblogic documentation also insists that). But our startup class uses application logic and needs to be part of application jar..
    We are getting java.lang.ClassNotFoundException for the class during start up. setting LoadBeforeAppDeployments to false also does not help...
    Is there any other way to invoke a application class during weblogic startup...?
    Any help would be appreciated.
    Thanks,
    Rajasekar.

    here is the solution to this:
    in the conventional method of implementing a startup class, one needs to impletent the T3STartupDef interface and register the class as a startup class in the console / config.xml
    in this method, the startup class need not implement the T3STartupDef interface, it just needs to have a "main" method that will be called. the process of registeration is also simple, if you have an application ear.
    while making the application ear, add a weblogic-application.xml along with the application.xml. the weblogic-application.xml should contain :
    <startup>
    <startup-class>myStartup</startup-class>
    <startup-uri>myStartupArchive.jar</startup-uri>
    </startup>
    the myStartupArchive.jar should contain the startup class and all classes used by it
    also, use a "manifest" file to point to other library jars within the ear
    hope this helps someone !
    going, going, ... gone.

  • Weblogic Startup Class

    Hello,
    I need to set up a start up class for quartz jobs in my weblogic server.
    I have created the startup class from the weblogic console but i dont know where to put the class or java file.
    Where is it read from?

    follow this :
    http://download.oracle.com/docs/cd/E13222_01/wls/docs81/ConsoleHelp/startup_shutdown.html#1108355

  • Problem: call EJB by ejblocalhome

    1.Environment:Jbuilder8/Weblogic7.0
    2.Name of EJB2.0 designer of JBuider8 :EJBBusiness
    3.Name of stateless session EJB:BaseInfoNotify
    4.the EJB includes
    BaseInfoNotifyBean.java
    BaseInfoNotifyLocal.java
    BaseInfoNotifyLocalHome.java
    5.local home jndi name is:BaseInfoNotifyLocal.
    6.I deploy the EJB by Jbuilder automatically.
    Then I want to access the EJB throuth a servlet by the following code:
    Context context = new InitialContext();
    baseInfoNotifyLocalHome = (BaseInfoNotifyLocalHome)context.lookup("BaseInfoNotifyLocal");
    exceptions:
    javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundExcept
    ion: Unable to resolve 'app/ejb/EJBBusiness.jar#BaseInfoNotify/local-home' Resol
    ved: 'app/ejb' Unresolved:'EJBBusiness.jar#BaseInfoNotify' ; remaining name 'EJB
    Business.jar#BaseInfoNotify/local-home'
    at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(Basic
    NamingNode.java:858)
    at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.jav
    a:223)
    at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:18
    7)
    at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:19
    5)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:333)
    at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:19
    7)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:333)
    at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyCo
    ntextWrapper.java:36)
    Why is Unresolved:'EJBBusiness.jar#BaseInfoNotify' ???????????

    i have the same problem!
    i create a sessionbean with local home,
    i call it with an other sessionbean in a same jar,that's ok!but i call it with a jsp file ,throw errs!
    why?
    how can i get a locahome outside a jar?
    thank you very much!

  • Problem calling ejb in oas from non-oracle java client

    I am trying to call an ejb that is deployed in OAS 9i from a java server page running another non-Oracle app server.
    I continue to get the following error:
    java.lang.ExceptionInInitializerError: org.omg.CORBA.INITIALIZE: can't
    instantiate default ORB implementation com.visigenic.vbroker.orb.ORB minor
    code: 0 completed: No
    I don't think it's a classpath problem. In desperation, I added every jar file in the Oracle directory structure to my classpath.
    The ejb works fine with jsp on OAS, but (at the moment) using OAS as our production web container is not an option.
    Is this even possible?
    null

    Hi Andrei,
    is that all you get? No more nested exceptions? This snippet isn't really explaining thery much...
    Best regards
    Stefan

  • Weblogic 7 SP2 - problem in ejb-jar.xml

    Hi,
    I have a problem when trying to move from Weblogic 7 to 7 SP2. In some of our
    ejb-jar.xml descriptors we have something like the following:
    <!ENTITY ENTITY_PROP SYSTEM "Config/entity_config.txt">
    then used this later on in the descriptor:
    <env-entry-value>&ENTITY_PROP;</env-entry-value>
    In all previous versions this would work fine with the Config directory sat in
    the domain directory but when we are trying to move to SP2 the ejb's are failing
    at deployment time with errors like:
    weblogic.xml.process.XMLParsingException: File "zip://C/bea/user_projects/mydomain/myserver/.wlnotdelete/ScanServer/MkpCodeServerEJB.jar!/META-INF/Config/entity_config.txt"
    not found. - with nested exception:
    [org.xml.sax.SAXParseException: File "zip://C/bea/user_projects/mydomain/myserver/.wlnotdelete/ScanServer/MkpCodeServerEJB.jar!/META-INF/Config/entity_config.txt"
    not found.].....
    What has changed? What can I do to solve the problem?
    thank you,
    Ian

    Hi,
    Please ignore the previous post. it is a bug in 10.3. Please contact the support and get the patch. The bug no is 8180493. thanks.
    -Albert
    Edited by: zhao.yong on 2009-6-22 下午11:17

  • Failed to use EJB's from startup class

    Hi,
    we use a startup class to set up some base services of our application.
    The startup class must call some remote methods in a EJB. Unfortunately
    a CLassCastException is thrown when we try to create the EJB by calling
    the create method on its home interface:
    Fr Nov 17 10:47:50 GMT+01:00 2000:<I> <WebLogicServer> Invoking
    T3StartupDef ibs
    startup ch.ebs.ibs.IBSStartup with {}
    java.lang.ClassCastException: weblogic.t3.srvr.StartupThread
    at
    weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicReques
    tHandler.java:34)
    at
    weblogic.rmi.extensions.BasicRequestDispatcher.dispatch(BasicRequestD
    ispatcher.java:82)
    at
    weblogic.rmi.internal.ServerRequest.sendOneWay(ServerRequest.java:73)
    at
    weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:77
    at
    ch.ebs.ibs.ejb.SessionControllerEJBHomeImpl_WLStub.create(SessionCont
    rollerEJBHomeImpl_WLStub.java:151)
    at ch.ebs.ibs.IBSStartup.startup(IBSStartup.java:69)
    at
    weblogic.t3.srvr.StartupThread.runStartup(StartupThread.java:182)
    at weblogic.t3.srvr.StartupThread.doWork(StartupThread.java:146)
    at
    weblogic.t3.srvr.PropertyExecuteThread.run(PropertyExecuteThread.java
    :62)
    The same code works fine if we run it as client code (not in the startup
    sequence).
    Any idea?
    Thanks Pascal

    Regarding your problem and the remark you posted to my question in "Calling
    EJBs from a thread in a startup class": It is possible to call methods of an
    EJB from a startup class. I use this functionality to route messages from
    JMS to my EJBs. From what you say, I assume that you are calling the EJB
    from your startup method, which might be a problem, since WL is not
    initialized at this point and does not accept any connections (this
    obviously includes internal connections). You should wait for this phase to
    finish and then use some other mechanism (e.g. a JMS message) to trigger
    your startup class to invoke any home or remote methods on the EJB.
    Looking at your stack trace, I am reminded of a very similar exception I
    encountered when I was experimenting with WL a short while ago. I had put my
    EJB jar file on WL's JAVA_CLASSPATH, just to see how the different
    classloaders work. Of course I don't know if this has any relevance to your
    configuration.
    Andy
    PS: The only exception to what I wrote in the first paragraph seems to be if
    you start a new thread from the startup class. I still haven't managed to
    call my EJB from this thread.
    Pascal Rudin wrote:
    Hi,
    we use a startup class to set up some base services of our application.
    The startup class must call some remote methods in a EJB. Unfortunately
    a CLassCastException is thrown when we try to create the EJB by calling
    the create method on its home interface:
    Fr Nov 17 10:47:50 GMT+01:00 2000:<I> <WebLogicServer> Invoking
    T3StartupDef ibs
    startup ch.ebs.ibs.IBSStartup with {}
    java.lang.ClassCastException: weblogic.t3.srvr.StartupThread
    at
    weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicReques
    tHandler.java:34)
    at
    weblogic.rmi.extensions.BasicRequestDispatcher.dispatch(BasicRequestD
    ispatcher.java:82)
    at
    weblogic.rmi.internal.ServerRequest.sendOneWay(ServerRequest.java:73)
    at
    weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:77
    at
    ch.ebs.ibs.ejb.SessionControllerEJBHomeImpl_WLStub.create(SessionCont
    rollerEJBHomeImpl_WLStub.java:151)
    at ch.ebs.ibs.IBSStartup.startup(IBSStartup.java:69)
    at
    weblogic.t3.srvr.StartupThread.runStartup(StartupThread.java:182)
    at weblogic.t3.srvr.StartupThread.doWork(StartupThread.java:146)
    at
    weblogic.t3.srvr.PropertyExecuteThread.run(PropertyExecuteThread.java
    :62)
    The same code works fine if we run it as client code (not in the startup
    sequence).
    Any idea?
    Thanks Pascal

  • Call EJB from Start Up class

    I'm using OC4J 10.1.3 Standalone.
    I have a requirement to initialize web services and configuration parameters during app server start up.
    Accordingly,I planned to call a EJB 2.0 stateless session bean from a StartUp class.
    The ejb is responsible for initializing some configurations and web services.The ejb is dependent on some other classes which are present as utility jars .
    However,I cannot somehow figure out how to refer the EJB from my startup class because the EAR which contains the EJB jar is in a child loader to that containing the startup class.
    Please guide me!! Please suggest if some alternative approach could be taken to suffice my requirement.
    TIA

    Avi, I was just waiting for the "servlet hack".
    I really prefer the application client way, much cleaner, no servlet container needed, and could be tested outside the container.
    --olaf                                                                                                                                                                                                                                                                                                                                                                                       

  • Startup Classes and JMS - Suggestions Please!

    I'm in serious need of having several resources initialized before beans
    start handling requests.
    I tried implementing a Weblogic Startup Class, and it works fine - as long
    as it's the first thing
    to run! -- the problem is, when my Message Driven Beans deploy, if there are
    messages waiting
    for them in their durable subscriptions, they immediately start
    processing... then about 30 seconds
    later Weblogic (6.0sp1) gets around to starting my startup class. If I put
    code in each MDB that
    kicks off the initialization when they are invoked I still run into
    problems, because my initialization
    takes a LONG time (more than 2 minutes) - so I end up with lots of
    transaction rollbacks... which
    are very annoying and clutter up the log files, and scare customers of the
    product.
    Is there anyway to make a startup class/servlet/something that runs and
    completes before any
    other processing occurs?
    Thanks,
    James

    Yes, Startup servlet has the same problem - it doesn't 'startup' until after
    jms messages are already being delivered. :( aside from this, there are
    class loader issues -servlet space and ejb space are not the same...
    Thanks though,
    James
    "minjiang" <[email protected]> wrote in message
    news:[email protected]...
    Hi, did you ever try startup servlet? not startup class?
    mj
    James House wrote:
    The only problem with creating a base class to extend is the fact that
    Java only supports single inheritance, -- and I'm already inheriting...
    >>
    I've been involved with many projects that use WLServer, and in
    almost every one of them, there has been a need for a startup class
    that fires before the server starts handling requests.... strange that
    I'd be the only one to need this, when the need has recurred so often.
    James
    "Raja Mukherjee" <[email protected]> wrote in message
    news:[email protected]...
    James,
    If you have common initialization tasks to be shared by multiple MDBs,
    I
    would create an abstract class (a.k.a BeanAdapter class) where you canhave
    all your initialization logics and have your MDB extend from it.
    I am not convinced that the Startup class needs to run first. In fact,
    I
    have the same view that Startup class should run last. My only wishlist
    for
    startup class was that I should be able to specify order, which isaddressed
    in 6.1.
    I am also getting the feeling from different posts that MDB deploymentwould
    have a re-try logic in 6.1, which I am beginning to look into. Check
    (or
    post) in JMS news group.
    .raja
    "James House" <[email protected]> wrote in message
    news:[email protected]...
    Thanks for the help... I like the pattern you pointed me to better
    than
    anything else... ... but in all cases (your method, Gene's, and whatI'm
    currently doing) I still have to put some code in every MDB that
    I deploy... : (
    Put in a good word for me there at BEA and convince the appropriate
    developer that startup classes should run first!
    James
    "Raja Mukherjee" <[email protected]> wrote in message
    news:[email protected]...
    James,
    There are several ways to solve your problem. I normally use
    setMessageDrivenContext to do all my initialization. There are two
    types
    of
    initialization that I have performed here, first, reading theconfiguration
    file and then load some utility classes in specific order. The
    problem
    with
    the second was that you will have to use synchronized block
    w/HotSpot
    2.0
    to
    keep the order, which is ok. I don't use static block to do the
    initialization, instead use an init() metod. Hopefully you got the
    idea.
    Recently, Gene Chuang created a pattern which esentially does the
    same
    and
    I
    liked the pattern because it was a nicer way of doing what I
    needed to
    do.
    I
    have changed all my examples to customer to use the new pattern.
    You
    can
    find it in
    http://theserverside.com/patterns/thread.jsp?thread_id=7270.
    The
    only think I do not use of this pattern is
    initializeEveryContextSwap()
    method. I am not convinced yet that I would need it (of course
    that
    might
    change over the time).
    Hope this helps, and thanks Gene.
    .raja
    "James House" <[email protected]> wrote in message
    news:[email protected]...
    Ok... here's some more detail:
    The application is largely JMS based, and most of my Session
    EJBs
    are
    invoked only my Message Driven Beans.
    I have a large set of properties that need to be read from a
    config
    file,
    and stored somewhere "globally". I also have a number of
    utilities
    that
    need to get "warmed up" before I start doing any real processing(before
    I start receiving messages from the JMS Topics). These
    utilities
    take
    a
    long time to warm up (a long time being about 45-60 seconds) -
    because
    they are loading hundereds of classes, and creating variousconnections
    to external resources.
    Currently I'm creating a Singleton object that reads the
    configuration
    file
    name from an environment property, and it then parses the file,
    and
    starts
    configuring all of these utilities. Since the "Startup Class"
    didn't
    work
    (weblogic invokes it after I'm already receiving messages), I
    put
    code
    at
    the beginning of all of my MDB's onMessage() methods that calls
    the
    singleton's "getInstance()" method - which synchronizes on alock
    object,
    and does all of it's work.
    I don't like this solution because:
    1- I have to put code in EVERY message-driven bean that I
    create -
    if
    I
    forget one, everything is broken.
    2- I have to increase the transaction time out of the entire
    server
    to
    be over 60 seconds since the beans hang that long while theconfiguration
    is
    happening.
    It seems very obvious that a "Startup Class" should be invoked
    after
    the
    server has come completely up, but before it starts listening
    for
    requests -- isn't the whole point of a "startup class" to getthings
    ready
    that need to be done as soon as the server comes up? but alas,
    the
    person
    who designed this at BEA apparently didn't agree with me on this
    point!
    Any suggestion on better solutions would be greatly appreciated.
    James
    "Raja Mukherjee" <[email protected]> wrote in message
    news:[email protected]...
    You can do it this way, but I would not recommend it, unless
    that's
    the
    only
    way to attack the problem at hand. But that's just me.
    I have seen this problem with multiple clients and in most
    cases
    there
    is
    a
    better way to handle it. If James give us a little more
    information
    on
    what
    type of configuration is he talking about and some background
    of
    his
    application, we as a group can think and may be able to come
    up
    with
    some
    idea.
    .raja
    "Joel Nylund" <[email protected]> wrote in message
    news:[email protected]...
    you could wrap the starting of weblogic in your own class
    and do
    initialization
    there. You have to be careful because of the way weblogic
    classloaders
    work, but
    you may be able to do what you want. Weblogic is just a java
    class,
    so
    you
    can
    start your class, then once your done initializing, just
    call
    weblogic.Server.main
    -Joel
    James House wrote:
    I'm in serious need of having several resources
    initialized
    before
    beans
    start handling requests.
    I tried implementing a Weblogic Startup Class, and it
    works
    fine -
    as
    long
    as it's the first thing
    to run! -- the problem is, when my Message Driven Beans
    deploy,
    if
    there
    are
    messages waiting
    for them in their durable subscriptions, they immediately
    start
    processing... then about 30 seconds
    later Weblogic (6.0sp1) gets around to starting my startupclass.
    If
    I
    put
    code in each MDB that
    kicks off the initialization when they are invoked I still
    run
    into
    problems, because my initialization
    takes a LONG time (more than 2 minutes) - so I end up with
    lots
    of
    transaction rollbacks... which
    are very annoying and clutter up the log files, and scarecustomers
    of
    the
    product.
    Is there anyway to make a startup class/servlet/something
    that
    runs
    and
    completes before any
    other processing occurs?
    Thanks,
    James

  • Startup class : Context lookup for a Home fails in a new thread

    Hi All,
    I am having a funny problem with Weblogic Startup class.In the startup method,
    I am creating an instance of InitialContext. I called look up in this context
    for a bean's home. It works and it retuns the proper Home interface.
    But, when I use the same InitialContext instance in a new thread, and again if
    I call look up for the same bean's home, the server fails with a SecurityException.
    I don't have any Role based Security for this bean.
    Btw, I am using Weblogic 5.1 & SP7.
    Any ideas or help, appreciated..
    Thanks in Advance
    Srikanth Goli
    Here is the code.
    public String startup(String name, Hashtable args) throws Exception {
    InitialContext initialContext = null;
    try {
    initialContext = new InitialContext();
    UserPreferencesHome userPreferencesHome =
         (UserPreferencesHome)initialContext.lookup
         (UserPreferencesHome.DEFAULT_URL);
    //This prints Properly
    System.err.println("StartupTest: userPrefsHome is " + userPreferencesHome);
    } catch(Exception e) {
    e.printStackTrace();
    Thread th = new Thread(new TestThread(initialContext));
    th.start();
    return "ok";
    class TestThread implements Runnable {
    Context context;
    public TestThread(InitialContext ctx) {
    context = ctx;
    public void run() {
    try {
    //This is failing
    UserPreferencesHome userPreferencesHome1 =
         (UserPreferencesHome)context.lookup
         (UserPreferencesHome.DEFAULT_URL);
    System.err.println("UserPreferencesHome1 in the thread is " + userPreferencesHome1);
    } catch(Exception e) {
    e.printStackTrace();
    Here is the exception, I am getting
    java.lang.SecurityException: User "guest" does not have Permission "lookup" base
    d on ACL "weblogic.jndi.com.capgroup.btps".
    at weblogic.security.acl.Security.logAndThrow(Security.java:372)
    at weblogic.security.acl.Security.checkPermission(Security.java:254)
    at weblogic.jndi.internal.NamingSecurityManagerImpl.checkPermission(Nami
    ngSecurityManagerImpl.java:98)
    at weblogic.jndi.internal.NamingSecurityManagerImpl.checkLookup(NamingSe
    curityManagerImpl.java:45)
    at weblogic.jndi.toolkit.BasicWLContext.resolveName(BasicWLContext.java:
    737)
    at weblogic.jndi.toolkit.BasicWLContext.lookup(BasicWLContext.java:133)
    at weblogic.jndi.toolkit.BasicWLContext.lookup(BasicWLContext.java:574)
    at javax.naming.InitialContext.lookup(InitialContext.java:350)
    at com.capgroup.btps.server.TestThread.run(StartupTest.java:49)
    at java.lang.Thread.run(Thread.java:484)

    Hi All,
    I am having a funny problem with Weblogic Startup class.In the startup method,
    I am creating an instance of InitialContext. I called look up in this context
    for a bean's home. It works and it retuns the proper Home interface.
    But, when I use the same InitialContext instance in a new thread, and again if
    I call look up for the same bean's home, the server fails with a SecurityException.
    I don't have any Role based Security for this bean.
    Btw, I am using Weblogic 5.1 & SP7.
    Any ideas or help, appreciated..
    Thanks in Advance
    Srikanth Goli
    Here is the code.
    public String startup(String name, Hashtable args) throws Exception {
    InitialContext initialContext = null;
    try {
    initialContext = new InitialContext();
    UserPreferencesHome userPreferencesHome =
         (UserPreferencesHome)initialContext.lookup
         (UserPreferencesHome.DEFAULT_URL);
    //This prints Properly
    System.err.println("StartupTest: userPrefsHome is " + userPreferencesHome);
    } catch(Exception e) {
    e.printStackTrace();
    Thread th = new Thread(new TestThread(initialContext));
    th.start();
    return "ok";
    class TestThread implements Runnable {
    Context context;
    public TestThread(InitialContext ctx) {
    context = ctx;
    public void run() {
    try {
    //This is failing
    UserPreferencesHome userPreferencesHome1 =
         (UserPreferencesHome)context.lookup
         (UserPreferencesHome.DEFAULT_URL);
    System.err.println("UserPreferencesHome1 in the thread is " + userPreferencesHome1);
    } catch(Exception e) {
    e.printStackTrace();
    Here is the exception, I am getting
    java.lang.SecurityException: User "guest" does not have Permission "lookup" base
    d on ACL "weblogic.jndi.com.capgroup.btps".
    at weblogic.security.acl.Security.logAndThrow(Security.java:372)
    at weblogic.security.acl.Security.checkPermission(Security.java:254)
    at weblogic.jndi.internal.NamingSecurityManagerImpl.checkPermission(Nami
    ngSecurityManagerImpl.java:98)
    at weblogic.jndi.internal.NamingSecurityManagerImpl.checkLookup(NamingSe
    curityManagerImpl.java:45)
    at weblogic.jndi.toolkit.BasicWLContext.resolveName(BasicWLContext.java:
    737)
    at weblogic.jndi.toolkit.BasicWLContext.lookup(BasicWLContext.java:133)
    at weblogic.jndi.toolkit.BasicWLContext.lookup(BasicWLContext.java:574)
    at javax.naming.InitialContext.lookup(InitialContext.java:350)
    at com.capgroup.btps.server.TestThread.run(StartupTest.java:49)
    at java.lang.Thread.run(Thread.java:484)

Maybe you are looking for