EJB as startup class
Hello there
I wonder if I can use an EJB as sturtup class. It doesn't matter that sturtup
class connect an EJB or kind of that, but can an EJB be used as startup class.
If it's possible how should I deploy this EJB in Weblogic server?
Should I use the deployment descriptor in such case?
Thank you in advance
No, only startup classes (which are not EJB) can be used.
Michael Girdley
BEA Systems
Learning WebLogic? http://learnweblogic.com
"Aleksey Sevastiyanov" <[email protected]> wrote in message
news:[email protected]..
>
Hello there
I wonder if I can use an EJB as sturtup class. It doesn't matter thatsturtup
class connect an EJB or kind of that, but can an EJB be used as startupclass.
If it's possible how should I deploy this EJB in Weblogic server?
Should I use the deployment descriptor in such case?
Thank you in advance
Similar Messages
-
Invalid guid error looking up EJB from a startup class
Gentlemen,
I am receiving an "invalid guid at GDS" error that is similar to others reported at:
http://softwareforum.sun.com/servlet/ProcessRequest?RHIVEID=181&RPAGEID=135&HOID=50B500000008000000FE090000&UCATEGORY_0=_29_%24_24_6_&UCATEGORY_S=0
and
http://softwareforum.sun.com/servlet/ProcessRequest?RHIVEID=181&RPAGEID=135&HOID=50B500000008000000FE090000&UCATEGORY_0=_29_%24_24_6_&UCATEGORY_S=0
In my case, I can retrieve the EJB from my rich client with no problems. However, if I execute the exact
same code from within a startup class (i.e. com.iplanet.ias.startup.StartupClass) then I get the following error repeated until memory runs out:
javax.naming.NameNotFoundException: MessageRepositoryBean : Invalid guid null in
GDS
at com.netscape.server.ejb.EjbContext.lookup(Unknown Source)
at com.netscape.server.jndi.RootContext.lookup(Unknown Source)
at com.netscape.server.jndi.RootContext.lookup(Unknown Source)
at javax.naming.InitialContext.lookup(InitialContext.java:357)
at com.netscape.ejb.CorbaHomeFactoryImpl.ConstructEJBHome(Unknown Source
at com.netscape.CosNaming.NamingContextImpl.resolve(Unknown Source)
at org.omg.CosNaming._NamingContextImplBase.invoke(_NamingContextImplBas
e.java:233)
at com.sun.corba.ee.internal.corba.ServerDelegate.dispatch(ServerDelegat
e.java:236)
at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:227)
at com.sun.corba.ee.internal.iiop.CachedWorkerThread.doWork(IIOPConnecti
on.java:262)
at com.sun.corba.ee.internal.iiop.CachedWorkerThread.run(IIOPConnection.
java:230)
javax.naming.NameNotFoundException: MessageRepositoryBean : Invalid guid null in
In previous answers people have suggested adding various things to the app server classpath. This does not make any difference for me. I am puzzled why code runs fine in a normal rich client, but not in a startup class. Here is the code that I am running:
try
String contextFactory = "com.sun.jndi.cosnaming.CNCtxFactory";
String providerURL = "iiop://localhost:9010";
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, contextFactory);
p.put(Context.PROVIDER_URL, providerURL);
Context context = new InitialContext(p);
MessageRepositoryHome home = (MessageRepositoryHome)
PortableRemoteObject.narrow(context.lookup("ejb/MessageRepository"), MessageRepositoryHome.class);
MessageRepository repository = home.create();
catch(Exception e)
e.printStackTrace(Log.err);
System.exit(1);
Thanks for your help,
MarkI was mistaken in this posting. I was able to access the EJB from the startup class so there must be something else that I am doing to cause this problem. I'd still like to know why I get those invalid guid errors though.
By the way, please forgive me for using the gender-specific gentlemen in my posting. That was accidental. -
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... -
Sequence of startup classes and EJB deployment
The default sequence when WLS is starting is deploying EJB first and then startUpClasses. Could someone tell me if it's possible to change the sequence.
Thanks a lot in advance.Sure have your startup class do its work and then hot-deploy the EJB.
-- Rob
Jack wrote:
>
The default sequence when WLS is starting is deploying EJB first and then startUpClasses. Could someone tell me if it's possible to change the sequence.
Thanks a lot in advance. -
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 PascalRegarding 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 -
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,
FaizullaHi,
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 -
Refering to startup class in EJB
Hi,
In our application we send exception stacktrace as email to
System Admin.The mails are sent from both Web App and EJB.
The emails have to be buffered and can be sent only after a
limit say 5 stacktraces have been reached. Also in case the
buffer is not full,then the mail should be sent only after a
specific time.
To achieve this I am planning to use a Startup class and start
a thread inside the class to wait for a specified time. The questions are:
1)How to refer to a startup class in EJB or Web (Our
application is deployed as an EAR)
2) If we can refer to the startup class in EJB,is it ok to refer a thread -will
the thread
created by startup class be in the context of the EJB.
ManiStartup classes have the following deficiences:
- they (and all application classes they use) have to be in the system
classpath, which makes them non-redeployable
- they are executed only once when server starts - if your application can be
hot-redeployed and it depends on startup/shutdown logic things can break.
An easy workaround is to use load-on-startup servlet init() and destroy()
methods (or 2.3 servletcontext listener) instead of startup classes - it makes
application redeployable and portable.
Mani <[email protected]> wrote:
Hi,
In our application we send exception stacktrace as email to
System Admin.The mails are sent from both Web App and EJB.
The emails have to be buffered and can be sent only after a
limit say 5 stacktraces have been reached. Also in case the
buffer is not full,then the mail should be sent only after a
specific time.
To achieve this I am planning to use a Startup class and start
a thread inside the class to wait for a specified time. The questions are:
1)How to refer to a startup class in EJB or Web (Our
application is deployed as an EAR)
2) If we can refer to the startup class in EJB,is it ok to refer a thread -will
the thread
created by startup class be in the context of the EJB.
Mani--
Dimitri -
Failed to invoke startup class "MyStartup Class"
Hi,
I configured StartUpClass.java in Weblogic server through Admin Console . Also I set the required jar files in the classpath of the server in WL_HOME\server\bin\startWLS.cmd.
This StartUPClass is written to initialize and create the minimum number of objects in the pool, needed for URLConnection using ObjectPooling API.
I am getting Exceptions while starting the server after deployment of the application. I am pasting the full stack trace.
<Feb 1, 2007 9:49:55 AM IST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) Client VM Version 1.4.2_12-b03 from Sun Microsystems Inc.>
<Feb 1, 2007 9:50:10 AM IST> <Info> <Configuration Management> <BEA-150016> <This server is being started as the administration server.>
<Feb 1, 2007 9:50:10 AM IST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 8.1 SP4 Mon Nov 29 16:21:29 PST 2004 471647
WebLogic XMLX Module 8.1 SP4 Mon Nov 29 16:21:29 PST 2004 471647 >
<Feb 1, 2007 9:50:11 AM IST> <Notice> <Management> <BEA-140005> <Loading domain configuration from configuration repository at D:\bea\user_projects\domains\nessdomain\.\config.xml.>
<Feb 1, 2007 9:50:15 AM IST> <Notice> <Log Management> <BEA-170019> <The server log file D:\bea\user_projects\domains\nessdomain\myserver\myserver.log is opened. All server side log events will be written to this file.>
<Feb 1, 2007 9:50:18 AM IST> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.>
<Feb 1, 2007 9:50:18 AM IST> <Notice> <WebLogicServer> <BEA-000327> <Starting WebLogic Admin Server "myserver" for domain "nessdomain">
<Feb 1, 2007 9:50:31 AM IST> <Warning> <HTTP> <BEA-101248> <[Application: 'D:\MSM\Workspace\MSM2.0Jan9', Module: 'MSM31']: Deployment descriptor "web.xml" is malformed. Check against the DTD: org.xml.sax.SAXParseException: The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)". (line 96, column 11).>
<Feb 1, 2007 9:50:31 AM IST> <Warning> <HTTP> <BEA-101248> <[Application: 'D:\MSM\Workspace\MSM2.0Jan9', Module: 'MSM31']: Deployment descriptor "weblogic.xml" is malformed. Check against the DTD: org.xml.sax.SAXParseException: The content of element type "weblogic-web-app" must match "(description?,weblogic-version?,security-role-assignment*,run-as-role-assignment*,reference-descriptor?,session-descriptor?,jsp-descriptor?,auth-filter?,container-descriptor?,charset-params?,virtual-directory-mapping*,url-match-map?,preprocessor*,preprocessor-mapping*,security-permission?,context-root?,wl-dispatch-policy?,servlet-descriptor*,init-as*,destroy-as*)". (line 23, column 20).>
<Feb 1, 2007 9:50:35 AM IST> <Critical> <WebLogicServer> <BEA-000286> <Failed to invoke startup class "MyStartup Class", java.lang.ClassNotFoundException: com.helio.msm.ws.util.StartUpClass
java.lang.ClassNotFoundException: com.helio.msm.ws.util.StartUpClass
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at weblogic.t3.srvr.StartupClassService.invokeClass(StartupClassService.java:156)
at weblogic.t3.srvr.StartupClassService.access$000(StartupClassService.java:36)
at weblogic.t3.srvr.StartupClassService$1.run(StartupClassService.java:121)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.t3.srvr.StartupClassService.invokeStartupClass(StartupClassService.java:116)
at weblogic.t3.srvr.PostDeploymentStartupService.resume(PostDeploymentStartupService.java:63)
at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:966)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:361)
at weblogic.Server.main(Server.java:32)
>
<Feb 1, 2007 9:50:36 AM IST> <Error> <Socket> <BEA-000438> <Unable to load performance pack. Using Java I/O instead. Please ensure that wlntio.dll is in: 'D:\j2sdk1.4.2_12\bin;.;C:\WINDOWS\system32;C:\WINDOWS;D:\j2sdk1.4.2_12\bin;c:\windows\system32;C:\apache-ant-1.6.5\bin;'
>
<Feb 1, 2007 9:50:36 AM IST> <Notice> <WebLogicServer> <BEA-000331> <Started WebLogic Admin Server "myserver" for domain "nessdomain" running in Development Mode>
<Feb 1, 2007 9:50:36 AM IST> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>
<Feb 1, 2007 9:50:36 AM IST> <Notice> <WebLogicServer> <BEA-000355> <Thread "ListenThread.Default" listening on port 7001, ip address *.*>
<Feb 1, 2007 9:50:55 AM IST> <Warning> <Socket> <BEA-000402> <There are: 5 active sockets, but the maximum number of socket reader threads allowed by the configuration is: 4. You may want to alter your configuration.>
Please help me in resolving this problem. I need it asap
Thanks,
DharaniI should be more specific and have a bit more to add....
We have our app in an .ear file. I find that when I put the startup
classes in a seperate directory which is in the classpath specified in the
startWeblogic.cmd file they will be run on startup. I don't think I should
have to do this since these files exist in the ear file. I think this is
causing other problems too such as an illegalAccessError I get when an EJB
tries to load a class which was previously accessed by the startup classes.
Thanks,
Steve
Steve Snodgrass wrote:
Hi,
I am beggining to upgrade our app from Weblogic 5.1 to 6.0. So far it
has been progressing nicely and everything works with one exception. I
can not get the start up classes to run. I get the following exception:
<Failed to invoke startup class "MyStartup Class",
java.lang.ClassNotFoundException:
followed by my fully qualified class name. The class is reference
elsewhere in the code and works fine. Is a seperate classpath used for
startup classes? If not why might Weblogic have a hard time finding my
class?
Thanks,
Steve -
A startup class to enable MQ Queues to trigger MDBs in WLS 6.1(sp4)
Hi,
I am hoping for references to documentation or opinions on the following method
allowing the use of MQ queues to drive MDBs in WLS. The technique involves rebinding
the connection factory in jndi at "weblogic.jms.MessageDrivenBeanConnectionFactory"
with MQs connection factory.
I read in various newsgroup posts that replacing WLS' ConnectionFactory with MQ's
in a startup class will not allow MDBs to be linked to an MQ queue because startup
classes are run after MDB deployment during startup. However I found some unused
in-house code which appeared to do just that and it works.
Here is the code in abbreviated form:
public String startup(String str, Hashtable args) throws Exception
bindMQFactory();
bindMQQueues();
return "";
private void bindMQFactory() throws Exception
// Create MQ Factory and configure it
MQQueueConnectionFactory factory = new MQQueueConnectionFactory();
factory.setChannel(channel );
factory.setHostName(host);
factory.setPort(Integer.parseInt(port));
factory.setQueueManager(qmanager);
factory.setTransportType( JMSC.MQJMS_TP_CLIENT_MQ_TCPIP );
// bind connection factory into WLS JNDI for later use by clients
_wlsContext.bind( connectionFactoryJndi, factory );
// Force mq connection factory to be the one used for mdb's
_wlsContext.rebind("weblogic.jms.MessageDrivenBeanConnectionFactory", factory);
private void bindMQQueue() throws Exception
// create queue and configure it
MQQueue queue = new MQQueue();
queue.setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ );
queue.setBaseQueueName( mqQueueName );
// bind queue in WLS JNDI
_wlsContext.bind( wlsJndi, queue );
Thanks in advance for any comments or opinions on the above.
regards
Martin
Start with the white-paper:
"Using Foreign JMS Providers with WebLogic Server"
Note that to get transactional behavior you
will need to use the WebLogic Messaging Bridge feature.
Note that integrating MQ is easier in 8.1 - consider
using WL 8.1 if you can.
One more comment in-line.
Martin wrote:
> Hi,
>
> I am hoping for references to documentation or opinions on the following method
> allowing the use of MQ queues to drive MDBs in WLS. The technique involves rebinding
> the connection factory in jndi at "weblogic.jms.MessageDrivenBeanConnectionFactory"
> with MQs connection factory.
Not recommended. Highly not recommended. Do not use the same name
as the internal factory. Create your own name for a CF, and change the
weblogic ejb jar to reference your name. The above white-paper
states how to do this.
>
> I read in various newsgroup posts that replacing WLS' ConnectionFactory with MQ's
> in a startup class will not allow MDBs to be linked to an MQ queue because startup
> classes are run after MDB deployment during startup. However I found some unused
> in-house code which appeared to do just that and it works.
>
> Here is the code in abbreviated form:
> public String startup(String str, Hashtable args) throws Exception
> {
> bindMQFactory();
> bindMQQueues();
>
> return "";
> }
>
> private void bindMQFactory() throws Exception
> {
>
> // Create MQ Factory and configure it
> MQQueueConnectionFactory factory = new MQQueueConnectionFactory();
> factory.setChannel(channel );
> factory.setHostName(host);
> factory.setPort(Integer.parseInt(port));
> factory.setQueueManager(qmanager);
> factory.setTransportType( JMSC.MQJMS_TP_CLIENT_MQ_TCPIP );
>
> // bind connection factory into WLS JNDI for later use by clients
> _wlsContext.bind( connectionFactoryJndi, factory );
>
> // Force mq connection factory to be the one used for mdb's
> _wlsContext.rebind("weblogic.jms.MessageDrivenBeanConnectionFactory", factory);
> }
>
> private void bindMQQueue() throws Exception
> {
> // create queue and configure it
> MQQueue queue = new MQQueue();
> queue.setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ );
> queue.setBaseQueueName( mqQueueName );
>
> // bind queue in WLS JNDI
> _wlsContext.bind( wlsJndi, queue );
> }
>
> Thanks in advance for any comments or opinions on the above.
>
> regards
>
> Martin
-
How to define my startup class in an .ear package?
I am using WL6.0SP2 on solaris.
I plan to package my application as an .ear file and to put all necesarry class
files in there (it will has one .war file for the web tier and one .jar file for
the EJBs).
I want, when Weblogic loads my .ear file (i.e. my application), to execute my
special startup class, which initializes some caches, etc.
I do not want to define a startup/shutdown class in the console, because it is
only specific to my application and this startup class is not present in the weblogic
classpath during weblogic startup.
The correct place should be in application.xml, but I don't see such thing in
the DTD.
Thank you,
Ivaylo ZlatevThere is no way to do this on the EAR level - you can use load-on-startup
servlet(s) in your web component, or initial-beans-in-free-pool=1 EJB.
Ivaylo Zlatev <[email protected]> wrote:
I am using WL6.0SP2 on solaris.
I plan to package my application as an .ear file and to put all necesarry class
files in there (it will has one .war file for the web tier and one .jar file for
the EJBs).
I want, when Weblogic loads my .ear file (i.e. my application), to execute my
special startup class, which initializes some caches, etc.
I do not want to define a startup/shutdown class in the console, because it is
only specific to my application and this startup class is not present in the weblogic
classpath during weblogic startup.
The correct place should be in application.xml, but I don't see such thing in
the DTD.
Thank you,
Ivaylo Zlatev--
Dimitri -
Startup Class in WebLogic server 6.1
I Have a Java application as startup class in Weblogic server 6.1 . I need to stop
the application without restarting the Weblogi server (The startup class should
be removed and the change should be reflected in WebLogic server). Is it possible
to achieve this. I Know that we can remove the startup class from the console
but the change is getting reflected only if i restart the WebLogic Server. Can
some one help me out ?.
Thanks,
S GopikrishnaEven if it is EJB-only, adding .war with startup logic will be more convinient
than startup classes.
S Gopikrishna <[email protected]> wrote:
Hi
Thanks a lot for the info. My application is not servlet based rather not
web based. In this case how to solve my startupclass problem.
Regards,
S Gopikrishna
Dimitri Rakitine <[email protected]> wrote:
You can deploy web-app(stand-alone, or as a part of an EAR), which has
servlets marked as
load-on-startup (in that case you can use servlet's init() method to
perform your startup
logic), or has servlet context listeners registered
(http://e-docs.bea.com/wls/docs61/webapp/app_events.html#177041) - contextInitialized()
callback will be called when application is deployed, and contextDestroyed()
will be called when application is undeployed.
S Gopikrishna <[email protected]> wrote:
Thanks a lot for the info. Iam pretty new to WeblogicServer. Can utell me about
how to use load-on-startup servlets or application listeners ?.
Thanks in Advance
S Gopikrishna
Dimitri Rakitine <[email protected]> wrote:
You can look into using load-on-startup servlets or application listeners
instead
of startup classes in 6.1 - that way you can redeploy your application
and re-execute
it's startup logic without placing any classes in the system classpath
or restarting
WebLogic.
S Gopikrishna <[email protected]> wrote:
I Have a Java application as startup class in Weblogic server 6.1
I need to stop
the application without restarting the Weblogi server (The startupclass should
be removed and the change should be reflected in WebLogic server).Is it possible
to achieve this. I Know that we can remove the startup class from
the
console
but the change is getting reflected only if i restart the WebLogicServer. Can
some one help me out ?.
Thanks,
S Gopikrishna--
Dimitri--
Dimitri
Dimitri -
Probelems with MDB listening to MQ (Startup class issue )
Hello ,
I am supposed to write a Message driven bean that would reside on
Weblogic7.0 and listen to a particular queue of IBM MQ.
I understand that we need to write a Start-up class for this. I have
written the start-up class but I am getting the following error:
<Apr 16, 2003 3:17:14 PM EDT> <Warning> <EJB> <010061> <The
Message-Driven EJB: SimpleMDB is unable
to connect to the JMS destination: ivtQ. The EJB container will
automatically attempt to re-establis
h the connection with the JMS server. This warning may occur during
WebLogic Cluster start-up if the
JMS destination is located on another server. When the JMS server
connection is re-established, the
Message-Driven EJB will again receive JMS messages.
The Error was:
The JMS destination with the JNDI name: ivtQ could not be found.
Please ensure that the JNDI name in
the weblogic-ejb-jar.xml is correct, and the JMS destination has been
deployed.>
I understand that there are some configuration issues:
Can you please guide where am I going wrong:
1. What should be the value of the <destination-jndi-name> in the
Weblogic-ejb-jar. I have not passed any Queue name through the
start-up class …Is it ok?
2. Then what queue name should I specify. (ofcousrse it should be the
MQ queue name but do I need to add that in the JNDI or in the
weblogic console…?
3. Please confirm that the <connection-factory-jndi-name> mentioned in
the weblogic-ejb-jar.xml should be the same as what I am passing as
JNDIName (through weblogic console).
4. Kindly advice if I am missing anything (especially in my start-ip
class)
Here are my Deployemnt descriptors:
weblogic-ejb-jar
<?xml version="1.0"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic
7.0.0 EJB//EN" "http://www.bea.com/servers/wls700/dtd/weblogic-ejb-jar.dtd">
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>SimpleMDB</ejb-name>
<message-driven-descriptor>
<pool>
<max-beans-in-free-pool>8</max-beans-in-free-pool>
<initial-beans-in-free-pool>1</initial-beans-in-free-pool>
</pool>
<destination-jndi-name>ivtQ</destination-jndi-name>
<initial-context-factory>
com.sun.jndi.fscontext.RefFSContextFactory
</initial-context-factory>
<provider-url>
file:/D:/JNDI/
</provider-url>
<connection-factory-jndi-name>
MyQCF
</connection-factory-jndi-name>
</message-driven-descriptor>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
ejb-jar.xml
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<message-driven>
<ejb-name>SimpleMDB</ejb-name>
<ejb-class>weblogic.jms.whitepaper.SimpleMDB</ejb-class>
<transaction-type>Container</transaction-type>
<message-driven-destination>
<!-- In WebLogic Server 6.0, this next parameter is named
"jms-destination-type" -->
<destination-type>javax.jms.Queue</destination-type>
</message-driven-destination>
</message-driven>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>SimpleMDB</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
My Start-up class is as follows:
import com.ibm.mq.jms.*;
import java.util.*;
import javax.jms.*;
import javax.naming.*;
import weblogic.common.*;
public class MQJMSStartup implements T3StartupDef
/** * The name of the queue manager to connect to. The startup class
* will throw an exception if this parameter is not set. */
public final static String QM_NAME_PROPERTY = "QManager";
/** * The host name where the queue manager runs. If not set, the *
startup class will create a "bindings mode" connection to a * queue
manager on the local host. */
public final static String QM_HOST_PROPERTY = "QManagerHost";
/** * The port number where the queue manager listens. If not set,
this * defaults to 1414, the default MQSeries port */
public final static String QM_PORT_PROPERTY = "QManagerPort";
/** * The name in JNDI to store this queue manager object under. * If
not set, the startup class will throw an exception. */
public static final String JNDI_NAME_PROPERTY = "JNDIName";
// Required
public MQJMSStartup()
// Required, but not needed
public void setServices(T3ServicesDef services)
public String startup(String name, Hashtable args) throws Exception
String qmName = (String)args.get(QM_NAME_PROPERTY);
System.out.println("*****The qmName is "+qmName);
if (qmName == null)
throw new Exception("Startup parameter " + QM_NAME_PROPERTY + "
must be set");
String jndiName = (String)args.get(JNDI_NAME_PROPERTY);
System.out.println("***The JNDI Nname is "+jndiName);
if (jndiName == null)
throw new Exception("Startup parameter " + JNDI_NAME_PROPERTY + "
must be set");
String qmHost = (String)args.get(QM_HOST_PROPERTY);
System.out.println("*****The qmHost is "+qmHost);
String qmPort = (String)args.get(QM_PORT_PROPERTY);
System.out.println("*****The qmPort is "+qmPort);
MQQueueConnectionFactory factory = new MQQueueConnectionFactory();
factory.setQueueManager(qmName);
if (qmHost == null)
factory.setTransportType(JMSC.MQJMS_TP_BINDINGS_MQ);
factory.setHostName(qmHost);
if (qmPort != null)
try
int portNum = Integer.parseInt(qmPort);
factory.setPort(portNum);
catch (NumberFormatException ignore)
else
factory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
InitialContext context = new InitialContext();
context.bind(jndiName, factory);
context.close();
StringBuffer buf = new StringBuffer();
buf.append( "A connection factory was created for the MQ Queue
Manager ");
buf.append(qmName);
buf.append(" and stored in JNDI at ");
buf.append(jndiName);
System.out.println("*****The mqstartup is executed
succesfully"+buf.toString());
return buf.toString();
The args that I pass through the weblogic console is as follows:
QManager=QM_mphasis_eight, JNDIName=MyQCF
Please advice,
regards,
Milan Doshi
Thanks for the response.
I have written the startUp class but I am getting the following error:
The Error was:
The JMS destination with the JNDI name: MySenderQueue could not be
found. Please ensure that the
JNDI name in the weblogic-ejb-jar.xml is correct, and the JMS
destination has been deployed.>
=====
My startup class is as follows:
String qmPort = (String)args.get(QM_PORT_PROPERTY);
String qmHost = (String)args.get(QM_HOST_PROPERTY);
String qmName = (String)args.get(QM_NAME_PROPERTY);
MQQueueConnectionFactory factory = new MQQueueConnectionFactory();
factory.setQueueManager(qmName);
factory.setHostName(qmHost);
if (qmPort != null)
try
int portNum = Integer.parseInt(qmPort);
factory.setPort(portNum);
catch (NumberFormatException ignore)
if (qmHost == null)
factory.setTransportType(JMSC.MQJMS_TP_BINDINGS_MQ);
else
factory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
InitialContext context = new InitialContext();
context.bind(jndiName, factory);
QueueConnection connection = factory.createQueueConnection();
boolean transacted = false;
QueueSession session = connection.createQueueSession( transacted,
Session.AUTO_ACKNOWLEDGE);
Queue ioQueue = session.createQueue("MySenderQueue");
context.bind("MySenderQueue",ioQueue);
context.close();
===================================================
My Weblogic-ejb-jar.xml is like this:
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>SimpleMDB</ejb-name>
<message-driven-descriptor>
<pool>
<max-beans-in-free-pool>8</max-beans-in-free-pool>
<initial-beans-in-free-pool>1</initial-beans-in-free-pool>
</pool>
<destination-jndi-name>MySenderQueue</destination-jndi-name>
<connection-factory-jndi-name>
MyQCF
</connection-factory-jndi-name>
</message-driven-descriptor>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
======================================================
Can you please guide me what is wrong in registering the Queue?
Thanks once again for the response,
Milan Doshi
"sudhir" <[email protected]> wrote in message news:<[email protected]>...
> Mian,
>
> You should pass the Queue Name in the startup class arguments. This would be
> the same name as the MQ Queue you have defined. There is no need to specify to
> provider URL to the file ... If you do, then ensure that the the queue name should
> refer to the MQ Administered Queue object defined by jmsadmin.
>
> -Sudhir
>
>
>
> [email protected] (Milan Doshi) wrote:
> >Hello ,
> >
> >I am supposed to write a Message driven bean that would reside on
> >Weblogic7.0 and listen to a particular queue of IBM MQ.
> >
> >I understand that we need to write a Start-up class for this. I have
> >written the start-up class but I am getting the following error:
> >
> ><Apr 16, 2003 3:17:14 PM EDT> <Warning> <EJB> <010061> <The
> >Message-Driven EJB: SimpleMDB is unable
> >to connect to the JMS destination: ivtQ. The EJB container will
> >automatically attempt to re-establis
> >h the connection with the JMS server. This warning may occur during
> >WebLogic Cluster start-up if the
> > JMS destination is located on another server. When the JMS server
> >connection is re-established, the
> > Message-Driven EJB will again receive JMS messages.
> >The Error was:
> >The JMS destination with the JNDI name: ivtQ could not be found.
> >Please ensure that the JNDI name in
> > the weblogic-ejb-jar.xml is correct, and the JMS destination has been
> >deployed.>
> >
> >I understand that there are some configuration issues:
> >
> >Can you please guide where am I going wrong:
> >1. What should be the value of the <destination-jndi-name> in the
> >Weblogic-ejb-jar. I have not passed any Queue name through the
> >start-up class ?Is it ok?
> >2. Then what queue name should I specify. (ofcousrse it should be the
> >weblogic console??
> >3. Please confirm that the <connection-factory-jndi-name> mentioned in
> >the weblogic-ejb-jar.xml should be the same as what I am passing as
> >JNDIName (through weblogic console).
> >4. Kindly advice if I am missing anything (especially in my start-ip
> >class)
> >
> >Here are my Deployemnt descriptors:
> >
> >weblogic-ejb-jar
> >
> ><?xml version="1.0"?>
> ><!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic
> >7.0.0 EJB//EN" "http://www.bea.com/servers/wls700/dtd/weblogic-ejb-jar.dtd">
> ><weblogic-ejb-jar>
> > <weblogic-enterprise-bean>
> > <ejb-name>SimpleMDB</ejb-name>
> > <message-driven-descriptor>
> > <pool>
> > <max-beans-in-free-pool>8</max-beans-in-free-pool>
> > <initial-beans-in-free-pool>1</initial-beans-in-free-pool>
> > </pool>
> > <destination-jndi-name>ivtQ</destination-jndi-name>
> > <initial-context-factory>
> > com.sun.jndi.fscontext.RefFSContextFactory
> > </initial-context-factory>
> > <provider-url>
> > file:/D:/JNDI/
> > </provider-url>
> > <connection-factory-jndi-name>
> > MyQCF
> > </connection-factory-jndi-name>
> > </message-driven-descriptor>
> > </weblogic-enterprise-bean>
> ></weblogic-ejb-jar>
> >
> >
> >
> >
> >
> >
> >
> >ejb-jar.xml
> >
> ><?xml version="1.0"?>
> ><!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
> >JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
> ><ejb-jar>
> > <enterprise-beans>
> > <message-driven>
> > <ejb-name>SimpleMDB</ejb-name>
> > <ejb-class>weblogic.jms.whitepaper.SimpleMDB</ejb-class>
> > <transaction-type>Container</transaction-type>
> > <message-driven-destination>
> > <!-- In WebLogic Server 6.0, this next parameter is named
> >"jms-destination-type" -->
> > <destination-type>javax.jms.Queue</destination-type>
> > </message-driven-destination>
> > </message-driven>
> > </enterprise-beans>
> > <assembly-descriptor>
> > <container-transaction>
> > <method>
> > <ejb-name>SimpleMDB</ejb-name>
> > <method-name>*</method-name>
> > </method>
> > <trans-attribute>Required</trans-attribute>
> > </container-transaction>
> > </assembly-descriptor>
> ></ejb-jar>
> >
> >
> >My Start-up class is as follows:
> >
> >import com.ibm.mq.jms.*;
> >import java.util.*;
> >import javax.jms.*;
> >import javax.naming.*;
> >import weblogic.common.*;
> >
> >
> >public class MQJMSStartup implements T3StartupDef
> >{
> > /** * The name of the queue manager to connect to. The startup class
> >* will throw an exception if this parameter is not set. */
> > public final static String QM_NAME_PROPERTY = "QManager";
> >
> > /** * The host name where the queue manager runs. If not set, the *
> >startup class will create a "bindings mode" connection to a * queue
> >manager on the local host. */
> > public final static String QM_HOST_PROPERTY = "QManagerHost";
> >
> > /** * The port number where the queue manager listens. If not set,
> >this * defaults to 1414, the default MQSeries port */
> > public final static String QM_PORT_PROPERTY = "QManagerPort";
> >
> > /** * The name in JNDI to store this queue manager object under. * If
> >not set, the startup class will throw an exception. */
> > public static final String JNDI_NAME_PROPERTY = "JNDIName";
> >
> > // Required
> > public MQJMSStartup()
> > {
> > }
> >
> > // Required, but not needed
> > public void setServices(T3ServicesDef services)
> > {
> > }
> >
> > public String startup(String name, Hashtable args) throws Exception
> > {
> > String qmName = (String)args.get(QM_NAME_PROPERTY);
> > System.out.println("*****The qmName is "+qmName);
> > if (qmName == null)
> > {
> > throw new Exception("Startup parameter " + QM_NAME_PROPERTY + "
> >must be set");
> > }
> > String jndiName = (String)args.get(JNDI_NAME_PROPERTY);
> > System.out.println("***The JNDI Nname is "+jndiName);
> > if (jndiName == null)
> > {
> > throw new Exception("Startup parameter " + JNDI_NAME_PROPERTY + "
> >must be set");
> > }
> > String qmHost = (String)args.get(QM_HOST_PROPERTY);
> > System.out.println("*****The qmHost is "+qmHost);
> > String qmPort = (String)args.get(QM_PORT_PROPERTY);
> > System.out.println("*****The qmPort is "+qmPort);
> > MQQueueConnectionFactory factory = new MQQueueConnectionFactory();
> > factory.setQueueManager(qmName);
> > if (qmHost == null)
> > {
> > factory.setTransportType(JMSC.MQJMS_TP_BINDINGS_MQ);
> > factory.setHostName(qmHost);
> > if (qmPort != null)
> > {
> > try
> > {
> > int portNum = Integer.parseInt(qmPort);
> > factory.setPort(portNum);
> > }
> > catch (NumberFormatException ignore)
> > {
> >
> > }
> > }
> > }
> > else
> > {
> > factory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
> > }
> >
> > InitialContext context = new InitialContext();
> > context.bind(jndiName, factory);
> > context.close();
> > StringBuffer buf = new StringBuffer();
> > buf.append( "A connection factory was created for the MQ Queue
> >Manager ");
> > buf.append(qmName);
> > buf.append(" and stored in JNDI at ");
> > buf.append(jndiName);
> > System.out.println("*****The mqstartup is executed
> >succesfully"+buf.toString());
> > return buf.toString();
> > }
> >}
> >
> >
> >
> >
> >The args that I pass through the weblogic console is as follows:
> >
> >QManager=QM_mphasis_eight, JNDIName=MyQCF
> >
> >
> >
> >
> >
> >Please advice,
> >
> >regards,
> >
> >Milan Doshi
-
I'm having a problem when I do a JNDI lookup for JMS connection factory from startup
class. I can use JNDI normally to bind and lookup but when I do lookup for JMS
connection factory like this:
Context naming = new InitialContext();
factory = (TopicConnectionFactory)naming.lookup("myapp.factory");
It fails like this:
java.lang.NullPointerException:
at javax.naming.InitialContext.getURLScheme (InitialContext.java:222)
at javax.naming.InitialContext.getURLOrDefaultInitCtx (InitialContext.java:271)
at javax.naming.InitialContext.lookup(InitialContext.java:345)
The same lookup is successful when I do it from EJB or from client. What could
be the problem?Sorry, my fault. I double checked and triple checked the code before posting, but
I should have quadruple checked it. NullPointerException was propably caused by
calling lookup() with null argument :) -
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,
JamesYes, 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 -
BEA-000286 Failed to invoke startup class
Have created a class which implements T3StartupDef has a setServices and startup methods. Put inside a JAR which is the WLS 8.1 sp3 Classpath.
Have deployed the startup class from the WL Console;
Deployments | Startup & Shutdown. Given the class the full package name.
However when WLS starts I get;
<30-Sep-2004 17:57:46 o'clock BST> <Critical> <WebLogicServer> <BEA-000286> <Fai
led to invoke startup class "NOTiFYMonitorListener", java.lang.ClassNotFoundException: uk.co.notify.agent.NOTiFYMonitorListener
java.lang.ClassNotFoundException: uk.co.notify.agent.NOTiFYMonitorListener
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at weblogic.t3.srvr.StartupClassService.invokeClass(StartupClassService.
java:156)
at weblogic.t3.srvr.StartupClassService.access$000(StartupClassService.java:36)
at weblogic.t3.srvr.StartupClassService$1.run(StartupClassService.java:1
21)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.t3.srvr.StartupClassService.invokeStartupClass(StartupClassS
ervice.java:116)
at weblogic.t3.srvr.PostDeploymentStartupService.resume(PostDeploymentSt
artupService.java:63)
at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:966)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:361)
at weblogic.Server.main(Server.java:32)
Any pointers? ThanksThanks for that. Followed your instructions now get;
Your environment has been set.
C:\bea\weblogic81\server\bin>
C:\bea\weblogic81\server\bin>
C:\bea\weblogic81\server\bin>javap uk.co.notify.agent.NOTiFYMonitorListener
Compiled from "NOTiFYMonitorListener.java"
public class uk.co.notify.agent.NOTiFYMonitorListener extends java.lang.Object i
mplements uk.co.notify.ejb.utilities.NOTiFYConstants,weblogic.common.T3StartupDe
f{
static java.lang.Class class$uk$co$notify$agent$NOTiFYMonitorListener;
weblogic.management.runtime.LogBroadcasterRuntimeMBean logBroadcaster;
weblogic.management.MBeanHome mBeanHome;
static uk.co.notify.valueobjects.NotificationVO notificationVO;
static java.lang.String password;
weblogic.management.RemoteMBeanServer rmbs;
java.lang.String sDomainName;
static java.lang.String serverName;
static java.lang.String url;
static java.lang.String userName;
public uk.co.notify.agent.NOTiFYMonitorListener();
static java.lang.Class class$(java.lang.String);
public static void main(java.lang.String[]);
public void setServices(weblogic.common.T3ServicesDef);
public void startListening();
public java.lang.String startup(java.lang.String,java.util.Hashtable);
throws java/lang/Exception
Still get ClassNotFoundException. Is the JAR containing my NOTiFYListener class being loaded or not?
Maybe you are looking for
-
My "Mac Help" on my Mac Mini does not work!
I have a Mac Mini, OS X 10.3.9. When I go into Mac Help, nothing happens when I try to ask questions, and I experience other problems when I try to go through Mac Help's library. And sometimes it works as if nothing was wrong. It's just plain sick. I
-
ISSUE - Automatic Payment Program
Hi Gurus, I am using Tcode F110 to do a APP for my vendor. After i have maintained the parameters, printer details etc and when i schedule the proposal to 'start immediately' i get the status as "Proposal has been released 19.08.10 13:20:48" other th
-
Calling function in before insert trigger
HELLO, **TRIGGER IS NOT DISPLAYING THE DATA ACCURATELY** **PLZ HELP ITS URGENT...** THE CODE IS BELOW..... create or replace TRIGGER GENSTUDYID BEFORE INSERT ON ER_PATPROT REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW DECLARE lPatStudyID varcha
-
Material Substitution by Sales Group?
We will be trying to rollout a new product in place of another, but we want to do it in "waves" -- like by different groups of customers. Is anyone aware of any functionality within SAP that would support doing this? What we are thinking is that w
-
Hi All, One of my clients is using dotmatrix printer to print invoices but end of the month volume is too high and it takes around 2 minutes print 1 document. I have tried using Microsoft Generic Driver and it increases printer speed but disturbs rep