Servlets and Execute Queues
6.0 doc in the "Known Issues" has the following:
039575
If your servlet makes an HTTP connection back to the same server there is the
possibility of deadlock under load. To work around the problem, use a separate
execute queue for the servlet that returns the DTD.
My question is: is the process of setting up servlets etc to use separate execute
queues documented somewhere?
TIA
Dimitri
In fact, it is (sort of) documented in 6.0sp1 (for some reason console
didnt use this in 6.0):
Thread dump shows
2 threads for queue: '__weblogic_admin_html_queue'"
and
2 threads for queue: '__weblogic_admin_rmi_queue'"
looking at the console.war/WEB-INF/web.xml shows how console servlets are
configured to use separate execute queue:
<servlet>
<servlet-name>...servlet name...</servlet-name>
<servlet-class>...servlet class...</servlet-class>
<init-param>
<param-name>wl-dispatch-policy</param-name>
<param-value>__weblogic_admin_html_queue</param-value>
</init-param>
</servlet>
For RMI (as rmi_queue name suggests) stuff looking at things generated
by weblogic.ejbc shows that dispatchpolicy is mentioned in the .ser'ialzed
deployment descriptor.
Cameron Purdy <[email protected]> wrote:
> (I thought you asked this before.) I haven't seen it doc'd yet, and they
> said it might not be 'til the next release. I've been checking the "dima"
> web site for doc on it, but haven't found any yet ;-).
> --
> Cameron Purdy
> Tangosol, Inc.
> http://www.tangosol.com
> +1.617.623.5782
> WebLogic Consulting Available
> "Dimitri Rakitine" <[email protected]> wrote in message
> news:[email protected]...
>> 6.0 doc in the "Known Issues" has the following:
>>
>> 039575
>> If your servlet makes an HTTP connection back to the same server there is
> the
>> possibility of deadlock under load. To work around the problem, use a
> separate
>> execute queue for the servlet that returns the DTD.
>>
>> My question is: is the process of setting up servlets etc to use separate
> execute
>> queues documented somewhere?
>>
>> TIA
>> Dimitri
>>
Dimitri
Similar Messages
-
Problem while assigning Servlet to Execute queue
Hi,
We implement a IMS S-CSCF on BEA container 2.2.
A call for us may be several times reentrant. Meaning that for one call we have to handle at least three different dialogs but in major use cases, it will be 6 or 7 for our next deployment.
We are currently facing to bottlenecks problems and BEA support advised me to try to check if assigning servelt to execute queue could improve the preformances.
I just wanted to make a try with one of our servlet but I have an exception java.lang.NoClassDefFoundError: org/jaxen/JaxenException.
Here is what I did:
In web.xml I have:
<web-app>
<distributable/>
<servlet>
<servlet-name>register</servlet-name>
<servlet-class>com.netcentrex.scscf.registrar.RegistrarServlet</servlet-class>
<init-param>
<param-name>wl-dispatch-policy</param-name>
<param-value>REGISTRARQueue</param-value>
</init-param>
<load-on-startup/>
</servlet>
<listener>
<listener-class>com.bea.wcp.sip.engine.server.ContextEventHook</listener-class>
</listener>
</web-app>
In sip.xml I have:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sip-app
PUBLIC "-//Java Community Process//DTD SIP Application 1.0//EN"
"http://www.jcp.org/dtd/sip-app_1_0.dtd">
<sip-app>
<display-name>SIP Servlet based Registrar</display-name>
<distributable/>
<context-param>
<param-name>usc.configFile</param-name>
<param-value>/etc/neotip/usc.ini</param-value>
</context-param>
<context-param>
<param-name>icscf.configFile</param-name>
<param-value>/etc/neotip/icscf.ini</param-value>
</context-param>
<context-param>
<param-name>usc.dnsSrvFile</param-name>
<param-value>/etc/neotip/uscDnsSrv.cache</param-value>
</context-param>
<listener>
<listener-class>com.netcentrex.scscf.session.SessionServlet</listener-class>
</listener>
<servlet>
<servlet-name>register</servlet-name>
<servlet-class>com.netcentrex.scscf.registrar.RegistrarServlet</servlet-class>
<load-on-startup/>
</servlet>
<servlet>
<servlet-name>session</servlet-name>
<servlet-class>com.netcentrex.scscf.session.SessionServlet</servlet-class>
<load-on-startup/>
</servlet>
<servlet>
<servlet-name>route</servlet-name>
<servlet-class>com.netcentrex.scscf.fork.RouteServlet</servlet-class>
<load-on-startup/>
</servlet>
<servlet>
<servlet-name>icscf</servlet-name>
<servlet-class>com.netcentrex.scscf.embeddedI.IEmbeddedServlet</servlet-class>
<load-on-startup/>
</servlet>
<servlet-mapping>
<servlet-name>register</servlet-name>
<pattern>
<equal>
<var>request.method</var>
<value>REGISTER</value>
</equal>
</pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>session</servlet-name>
<pattern>
<and>
<not>
<equal>
<var>request.method</var>
<value>REGISTER</value>
</equal>
</not>
<not>
<exists>
<var>request.uri.param.uscroute</var>
</exists>
</not>
<not>
<exists>
<var>request.uri.param.icscfroute</var>
</exists>
</not>
</and>
</pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>route</servlet-name>
<pattern>
<and>
<not>
<equal>
<var>request.method</var>
<value>REGISTER</value>
</equal>
</not>
<exists>
<var>request.uri.param.uscroute</var>
</exists>
</and>
</pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>icscf</servlet-name>
<pattern>
<and>
<not>
<equal>
<var>request.method</var>
<value>REGISTER</value>
</equal>
</not>
<exists>
<var>request.uri.param.icscfroute</var>
</exists>
</and>
</pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</sip-app>
In msi-config.xml, we have:
<Server Cluster="BEA_ENGINE_TIER_CLUST" EnabledForDomainLog="false"
ListenAddress="192.168.150.26" ListenPort="8001" Name="engine1"
NativeIOEnabled="true" NetworkAccessPoints="sipchannel"
ServerVersion="8.1.5.0" StdoutDebugEnabled="true"
StdoutEnabled="true" StdoutSeverityLevel="64">
<NetworkAccessPoint ListenAddress="192.168.150.34"
ListenPort="5060" Name="sipchannel" Protocol="sip"
PublicAddress="192.168.150.34" SourcePorts="41000-42000"/>
<SSL Enabled="false" IdentityAndTrustLocations="KeyStores" Name="engine1"/>
<Log FileCount="10" FileMinSize="60000" Name="engine1" NumberOfFilesLimited="true"/>
<ExecuteQueue Name="sip.transport.Default" QueueLength="2048" ThreadCount="25"/>
<ExecuteQueue Name="REGISTRARQueue" QueueLength="2048" ThreadCount="25"/>
<ExecuteQueue Name="sip.transport.Default" QueueLength="2048" ThreadCount="25"/>
<ExecuteQueue Name="weblogic.kernel.Default"/>
<ExecuteQueue Name="sip.timer.Default" QueueLength="2048" ThreadCount="25"/>
<ExecuteQueue Name="sip.tracing.local" QueueLength="1024"
ThreadCount="1" ThreadsMaximum="1" ThreadsMinimum="1"/>
<ExecuteQueue Name="sip.tracing.domain" QueueLength="1024"
ThreadCount="1" ThreadsMaximum="1" ThreadsMinimum="1"/>
</Server>
Then when I launch a SIP REGISTRATION operation I get the following trace:
2007-05-30 17:37:03,649 ERROR RegistrarServlet [ExecuteThread: '23' for queue: 'sip.transport.Default'] : Error while processing request: REGISTER sip:netcentrexbench.net SIP/2.0
P-Charging-Vector: icid-value=AyretyU0dm+1970294253=0465138796
P-Access-Network-Info: ADSL;dsl-location="netcentrexbench.net;1.2.3.4"
CSeq: 2 REGISTER
Call-ID: [email protected]
Supported: path
Via: SIP/2.0/UDP 192.168.254.56:5063;branch=z9hG4bK-19606-1-2
From: dench0 <sip:[email protected]>;tag=1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
To: dench0 <sip:[email protected]>
Authorization: Digest username="dench0",realm="netcentrexbench.net",cnonce="6b8b4567",nc=00000001,qop=auth,uri="sip:192.168.150.34:5060",nonce="NQei3RIBAAA=le+kkCcrZcahXxQ7M6r7dw==",response="b824a93822b267ddfaa07f4039d99d95",algorithm=MD5
Content-Length: 0
Contact: sip:[email protected]:5063
User-Agent: LYNX_BENCH
Path: <sip:[email protected]:5063;lr>
Require: path
Expires: 36000
Max-Forwards: 70
java.lang.NoClassDefFoundError: org/jaxen/JaxenException
at org.dom4j.DocumentFactory.createXPath(DocumentFactory.java:230)
My first doubt is that I think I should get "ERROR RegistrarServlet [ExecuteThread: '23' for queue: 'REGISTRARQueue'] " instead of "ERROR RegistrarServlet [ExecuteThread: '23' for queue: 'sip.transport.Default'] "
First question: did I miss something or did something wrong in the configuration?
Second question: is it really possible to assign a single servlet (from an application containing many other servlets) to a dediacted execute queue?
Third question: any help is welcome :-)
Thanks in advance,
Lionel,At teh end I found the basic :-) problem on my exception but anyway , the used execute queue for REGISTER is always sip.transport.default
Help on this point is welcome!
Thanks -
Hi Folks,
as we got problems on thread deadlocks using JMS, we decided to define our own thread
queue to be used by our application. In the documentation it is described, that you
need to generate all your EJBs with java weblogic.ejbc -dispatchPolicy xyz. By this
you connect your EJB to the named thread queue, which you will need to add to your
config.xml.
What I could find out was, that this works fine for stateful or stateless session
beans, but it looks like message driven beans do ignore this option.
So here are my questions:
Which thread queue is used by message driven beans?
How can I change the thread queue?
Many thanks,
NicoleUnfortunately, MDBs do not currently support running on a separate queue. They run on
the default queue.
-- Rob
Nicole wrote:
Hi Folks,
as we got problems on thread deadlocks using JMS, we decided to define our own thread
queue to be used by our application. In the documentation it is described, that you
need to generate all your EJBs with java weblogic.ejbc -dispatchPolicy xyz. By this
you connect your EJB to the named thread queue, which you will need to add to your
config.xml.
What I could find out was, that this works fine for stateful or stateless session
beans, but it looks like message driven beans do ignore this option.
So here are my questions:
Which thread queue is used by message driven beans?
How can I change the thread queue?
Many thanks,
Nicole -
Can servlets/ jsp automatically run perl scripts and executables?
I'm a student and am new to to servlets and web programming in general.
I need to know if it's possible to run perl scripts and executables automatically from servlets/ jsp.
The program I am planning on creating should have a client outside a firewall that uploads perl files to a gateway machine inside the firewall, the servlet should be able to run this perl file, and then pass the resulting file as an argument to an executable, to be run by another servlet on a different server.
I've tried looking everwhere for an answer to this and am about to revert to a cgi based approach because I'm not sure if it would work so any help/ suggestions would be much appreciated.Hallo,
I think using java Runtime will help. you can do Processes that execute shell or system commands through
Process process = Runtime.getRuntime().exec("your perl scripts here!");
Bye -
Same JSP/Servlet is executing again and again
Hello,
We have some JSPs which do a lot of processing and is 'alive' for a long period
of time. If we use the JSP with small amouts of data, it is fine. But when we
use the JSP with lot of data, it seems to 'go in a loop'.
It is processing the data again and again and again and brings down our server.
We do not think it is the code that is wrong - as it processes perfectly if the
data is small or when our server is not busy. This problem happens if the data
is lot and the server is also busy. The JSP seems to be executing again and again.
Is there some type of 'refresh' logic in weblogic that refreshes the JSP/servlet
and makes it 'execute' again and again.
We are using WL 6.1
Thanks,
Oleg.Hi Oleg,
Could you tell us how you find out that there is an additional request?
Regards,
Slava Imeshev
"Oleg" <[email protected]> wrote in message
news:[email protected]...
>
Thank you Varad and Slava,
We don't use plagin for iplanet,
but our problem is very similar:
Weblogic generate additional request if the previous request toservlet/jsp is
taking long time.
Where I can configure JSP timeout to fix this problem?
Thank you very much.
Oleg.
"Varadharajan" <[email protected]> wrote:
Hi Oleg,
Are you using weblogic plugin for iplanet webserver ?
In weblogic server 6.1 sp3 there is a problem with this plugin. It would
generate
additional request if the previous request to servlet/jsp is taking more
than
the configurable timeout set in the obj.conf file of iplanet webserver.
This plugin problem is fixed in wls6.1 sp4.
Rgds,
Varad
"Slava Imeshev" <[email protected]> wrote:
Hi Oleg,
See my answers inline.
"Oleg" <[email protected]> wrote in message
news:[email protected]...
Hello,
We have some JSPs which do a lot of processing and is 'alive' for
a
long
period
of time. If we use the JSP with small amouts of data, it is fine.But
when we
use the JSP with lot of data, it seems to 'go in a loop'.I guess you need to figure out if "seems" really "does".
It is processing the data again and again and again and brings downour
server.
How do you know that a JSP goes into a loop?
We do not think it is the code that is wrong - as it processes
perfectly
if the
data is small or when our server is not busy. This problem happensif the
data
is lot and the server is also busy. The JSP seems to be executingagain
and again.
What load is considered to be high/low for you
application? Are you running a load test?
Is there some type of 'refresh' logic in weblogic that refreshes
the
JSP/servlet
and makes it 'execute' again and again.Normally Servlet/JSP enters service() method when
there is an incoming request. It should not be happening
at JSP's will.
Regards,
Slava Imeshev -
How to compile and execute servlet file in j2ee
In j2ee server when iam compiling servet i am getting error messages like package javax.servlet,and javax.servlet.http does not exist like that.
i hsve set path like this.and i gave path for j2sdk .
set CPATH=.;%J2EE_HOME%\lib\j2ee.jar
javac -classpath %CPATH% AdderServlet.java
can anybody tell me where to place
servlet and how to compile it.
Thank u,
RenugaMake sure that '%J2EE_HOME%\lib\j2ee.jar' is existing. Where is your J2EE_HOME pointing to?
The best thing I can suggest is, create your own bat file to compile the servlets. Like this,
Save the lines below as "MyCompiler.bat" file.
@echo off
set JDK_HOME=<path to you jdk home upto bin directory>
set J2EE_HOME=<path to you je22 home>
set CLASSPATH=.;%J2EE_HOME%\lib\j2ee.jar
%JDK_HOME%\javac %1
Use the command,
MyCompiler AdderServlet.java
You can improve this MyCompiler.bat further, can add additional jar files to the classpath whenever you want. You can put this bat file in System's path, so that you can invoke it just by the name (MyCompiler) without giving the full path to it (like C:\mydir\MyCompiler).
Hope this helps.
Sudha -
How can I tell how long a request has been sitting on an execute queue?
Is it possible to determine (in WL 8.1 and/or 10.3) how long an HTTP request has been sitting on the execute queue before being assigned to a servlet?
Under heavy load, I'm finding that the caller times out by the time the servlet tries to write the response because the request has been waiting on the execute queue for too long. To prevent doing all the work to process the request, I want to be able to see how long the request has been waiting to determine whether it's worth processing the request.
Currently I use the getExecuteThreadTotalCount() method in ExecuteQueueRuntimeMBean and assume that if the count is high, the request has probably been waiting for a while, but getting the actual time on the queue would be much better.
Thanks.Further investigation and a bunch of speed tests later, I'm even more puzzled. Between 7 pm and 9pm this evening, download speed has been consistently at 112kb, except for the 1 in 10 occasions where it hits 1.5mb, for 30 or 40 seconds, before dropping back to 112kb.
Does anyone have any ideas what is going on?
thanks in advance
Ben -
Problem in assigning the execute queue to EJB.
I have a enterprise application in that a have many web application.I want to assign
the low priority threads to one web application e.g. "A". The "A" is using one
ejb to execute the some task.
I am making a execute queue with name let "TestQueue"
and assigning it to my servlet thru these entries in
weblogic-ejb-jar :-
<weblogic-enterprise-bean>
<ejb-name>InferenceEngine</ejb-name>
<reference-descriptor>
<resource-description>
<res-ref-name>jdbc/MyDB</res-ref-name>
<jndi-name>jdbc/MyDB</jndi-name>
</resource-description>
</reference-descriptor>
<jndi-name>ejb/InferenceEngine</jndi-name>
<dispatch-policy>TestQueue</dispatch-policy>
</weblogic-enterprise-bean>
Here is my code of config.xml file for execute queue.
<?xml version="1.0" encoding="UTF-8"?>
<Domain ConfigurationVersion="8.1.0.0" Name="ACM_1">
<Server ListenAddress="" ListenPort="8003" Name="ACM"
NativeIOEnabled="true" ReliableDeliveryPolicy="RMDefaultPolicy" ServerVersion="8.1.1.0">
<SSL Enabled="false" HostnameVerificationIgnored="false"
IdentityAndTrustLocations="KeyStores" Name="ACM"/>
<ExecuteQueue Name="TestQueue" ThreadPriority="1"/>
</Server>
I tried the ejbc command line argument -dispatchPolicy TestQueue also. But it
is also not sending request to my TestQueue.One thing to note is the execute queue is chosen when the request enters
the server. So if a webapp is assigned to Queue-1 and an ejb to
Queue-2, and the webapp calls the ejb, the request will remain on queue-1.
-- Rob
Sunil Kumar Mehta wrote:
I have a enterprise application in that a have many web application.I want to assign
the low priority threads to one web application e.g. "A". The "A" is using one
ejb to execute the some task.
I am making a execute queue with name let "TestQueue"
and assigning it to my servlet thru these entries in
weblogic-ejb-jar :-
<weblogic-enterprise-bean>
<ejb-name>InferenceEngine</ejb-name>
<reference-descriptor>
<resource-description>
<res-ref-name>jdbc/MyDB</res-ref-name>
<jndi-name>jdbc/MyDB</jndi-name>
</resource-description>
</reference-descriptor>
<jndi-name>ejb/InferenceEngine</jndi-name>
<dispatch-policy>TestQueue</dispatch-policy>
</weblogic-enterprise-bean>
Here is my code of config.xml file for execute queue.
<?xml version="1.0" encoding="UTF-8"?>
<Domain ConfigurationVersion="8.1.0.0" Name="ACM_1">
<Server ListenAddress="" ListenPort="8003" Name="ACM"
NativeIOEnabled="true" ReliableDeliveryPolicy="RMDefaultPolicy" ServerVersion="8.1.1.0">
<SSL Enabled="false" HostnameVerificationIgnored="false"
IdentityAndTrustLocations="KeyStores" Name="ACM"/>
<ExecuteQueue Name="TestQueue" ThreadPriority="1"/>
</Server>
I tried the ejbc command line argument -dispatchPolicy TestQueue also. But it
is also not sending request to my TestQueue. -
Specifying multiple JSP's in Execute Queue
Hi
Bea's documentation says that you can specify the execute queue for a
perticular JSP as follows:
<servlet>
<servlet-name>MainServlet</servlet-name>
<jsp-file>/myapplication/critical.jsp</jsp-file>
<init-param>
<param-name>wl-dispatch-policy</param-name>
<param-value>CriticalAppQueue</param-value>
</init-param>
</servlet>
Am wondering if there is a way to specify the execute queue for a
whole set of JSP's. Was trying wildcards in the jsp-file tag but
havent yet had success. I would like to tell weblogic to use the queue
I specify for all jsp's in a certain directory and I dont want to have
to create <servlet> tags for each one since there are many!.
If anyone has solved this or has any suggestions, please let me know.
ThanksDid you try in SM58( in the menu edit / Execute LUW's ? There send you to screen " Execute Calls Not Yet Executed" where you can select some parameters as excution date, destination user name..... and other options with check boxes.
I have used it and is good -
Thread pools for execute queues
We've set up thread pools for several execute queues dedicated to high-load servlets
in our application. Once in a while, we get into a condition in which none of
these threads are available and then the threads never become available - we have
to restart the server.
I realize that this is a pretty generic description of the problem :-) but I wonder
if anyone else has encountered this and has an idea what might be causing it ?
Right now I am guessing that something in our code causes a resource contention
that eventually deadlocks all the threads. But that is just a guess.Ethan,
"Ethan Allen" <[email protected]> wrote in message
news:3e0220a1$[email protected]..
Thanks, Dimitri and Slava !
I will do this and learn a little emore ...FYI, there is a web site dedicated to weblogic documentation -
http://e-docs.bea.com/
Pick your server version, go to "Search", type "thread dump".
Regards,
Slava Imeshev
>
ethan
"Slava Imeshev" <[email protected]> wrote:
Hi Ethan,
For windows press <Ctrl>+<Break> in the server shell window,
for *nix send kill -3 {server PID}.
Regards,
Slava Imeshev
"Ethan Allen" <[email protected]> wrote in message
news:3e020fb4$[email protected]..
Thanks for your reply, Dimitri.
We have not looked at thread dumps. How may we do this ?
Ethan
"Dimitri I. Rakitine" <[email protected]> wrote:
Did you try looking at thread dumps when this happens ?
Ethan Allen <[email protected]> wrote:
We've set up thread pools for several execute queues dedicated to
high-load
servlets
in our application. Once in a while, we get into a condition in
which
none of
these threads are available and then the threads never become
available
- we have
to restart the server.
I realize that this is a pretty generic description of the problem:-) but I wonder
if anyone else has encountered this and has an idea what might be
causing
it ?
Right now I am guessing that something in our code causes a
resource
contention
that eventually deadlocks all the threads. But that is just a
guess.
>>>>
Dimitri -
Run my web service in custom Execute Queue
i developed my web service using the WorkShop 8.1 Sp3
I created a custom execute queuem in my weblogic server
Can anyone guide how i can instruct my web serivce to run in my custom execute queue.
Always it's going to the Default execute queue.
Found for servlet and jsp the dispatch policy can be specified in the deployment descriptor.
But how i can specify for the web service ?
thanksHi Senthil
If you are still in Sp3 then the solution will NOT work.
You cannot edit the web.xml and get it working.
Sp4 is better compared to sp3 and you should be able to run your application on sp4 without any changes.
Below is some details on how it works and why you cannot use it on Sp3:
If you can move to Sp4, yes you can follow the docs provided by Raj (http://e-docs.bea.com/workshop/docs81/doc/en/workshop/reference/configfiles/con_web_xml_ConfigurationFile.html)and configure the dispath-policy in web.xml
After the build the information in web.xml will go into the EJB xml descriptor weblogic-ejb-jar.xml of the workshop internal EJB (SyncDispatcherBean)
Your weblogic-ejb-jar.xml for the SyncDispatcherBean will have
<dispatch-policy>
weblogic.jws.sync.dispatch
</dispatch-policy>
However if you remain on sp3, this config put into the web.xml will not work as the functionality was introduced only in sp4.
For Sp3, BEA does not support the manual editing of the weblogic-ejb-jar.xml of the SyncDispatcherBean as these get regenerated everytime on build.
Thanks,
Vimala -
Assigning MBeans to own execute queue
We are trying to monitor the internal activities of the WLS by using the
MBeans (JMX).
However, when load is high we see that the MBean access halts or is
seriously impared. Ideally we would like the MBeans (or the classes that
access them) to run in their own execute queue.
We access MBeans from stand-alone Java classes that then use JNDI to locate
the MBeanHome and make calls from there.
Is there any way to get this design to run in its own execute queue?
If not, am I right in thinking if I put a session (facade) bean in the
design I could designate that this bean ran in its own queue?
TIA
EdDimitri I. Rakitine wrote:
That should work - if I understand correctly how this works, request is placed on an
appropriate queue when it first arrives.
I have a question - it looks like console servlets are configured to run on
'__weblogic_admin_html_queue', but what is configured to execute on
'__weblogic_admin_rmi_queue' ?
Managed servers could make RMI calls to admin server to get config
MBeans? etc....
In weblogic.developer.interest.performance Ed Barrett <[email protected]> wrote:
We are trying to monitor the internal activities of the WLS by using the
MBeans (JMX).
However, when load is high we see that the MBean access halts or is
seriously impared. Ideally we would like the MBeans (or the classes that
access them) to run in their own execute queue.
We access MBeans from stand-alone Java classes that then use JNDI to locate
the MBeanHome and make calls from there.
Is there any way to get this design to run in its own execute queue?
If not, am I right in thinking if I put a session (facade) bean in the
design I could designate that this bean ran in its own queue?
TIA
Ed -
Different execute queues with different thread priorities
We are running WebLogic 6.1, SP2 on Solaris 2.8 and I have a question related to the
use of Execute queues
I'm aware that the administration console servlets, and the rest of requests given
to the server run in separate execution queues each with their own pool of threads.
There is an <executequeue> element in the config.xml that allows you to change the
parameters of the default execute queue that most requests are handled in.
My question is is it possible to create new execute queues, each with a given number
of threads running at a different priority. Then one could assign a particular WAR
deployment to a queue and hence control the priority that certain requests run at
governed by the deployment that received the initial request.
Essentially the problem that I'm trying to address is that I have a JAR with MDBs
in it. I also have JARs with Entity and Session EJBs and WARs. They are all using
the same pool of threads to execute. I want to be able to throttle the MDBs as they
receive messages so they don't take over the machine and interfere with interactive
use. Now I can limit the number of MDBs in the MDB pool, but then if the machine
is not being used by users, then the machine resources are wasted only allowing one
MDB to be active at a time when there are a lot of messages in the queue.
What I want to be able to do is to have as many MDBs run as I can, up to a certain
limit, say 15 for example, but not to pull from the same thread pool/execute queue
as the requests for URLs in the WAR. Also I want the MDB threads to run at a much
lower priority and always give preference to interactive requests.
So interactive threads will always win and grab the processors if interactive use
is high, but if it's not, the MDBs can run instead.
Regs,
PaulHi,
I had a chat with BEA support about my issue. You can create multiple ExecuteQueues
and assign them to servlet definitions in WARs in the web.xml, and with an option
to the EJBC compiler, you can assign a particular class of EJB to an ExecuteQeueue.
For details see http://e-docs.bea.com/wls/docs61/perform/AppTuning.html#1106284
Presumably it's the thread of the initial request that counts, i.e. if a WAR calls
an EJB, then it's the thread in the execute queue of the WAR that will be used right
the way through the request, not that of the EJB being called, assuming they are
both deployed in the same WebLogic instance. If they were in different instances,
you would obviously have a thread from the WAR queue on one instance, and a thread
from the EJB queue on another instance.
If a plain Java command-line client connected directly to an EJB, then it would be
the thread from the ExecuteQueue of the EJB that would get used.
I've been told that MDBs always run in the default queue, so it seems that the way
for me to do what I want is just to create an ExecuteQueue, set the priority of the
threads in this queue to be higher than that of the default queue, and assign this
queue to my WARs. I can leave my EJBs running in the default queue.
Regs,
Paul
"Dimitri I. Rakitine" <[email protected]> wrote:
Don't know about 6.1 (One can find out very easily what the possible config
parameters
are by deploting
http://dima.dhs.org/misc/listMBeans.jsp and
http://dima.dhs.org/misc/showMBean.jsp
abd looking at the XXXConfig mbeans), but in 7.0 there are quite a few
things which
can be tuned in the executequeue config (and priority is one of them. also
interesting
is that it is possible to configure it to increase number of execute threads
when queue
length exceeds some specified threshold) :
QueueLength
Returns the maximum length of this queue.
ThreadPriority
Returns the priority of the threads associated with this queue.
ThreadCount
Returns the number of threads assigned to this queue.
QueueLengthThresholdPercent
Returns the threshold percent for length of this queue, set in QueueLength.
ThreadsIncrease
Returns the number of threads to grow when a queue is within QueueLengthThresholdPercent
of the set QueueLength.
ThreadsMaximum
Returns the maximum number of threads in the pool.
ThreadsMinimum
Returns the minimum number of threads in the pool.
Dimitri -
Using database connection in a servlet and get errors after 8 hours
Hey,
I'm running a poker script using applet/servlets and it works great. But for some reason about about 8 hours that database layer stops working. At first I thought it was the connections to mySQL that were timing out (because im using connection pooling) but after turning pooling off (I now create the connection each time) I'm still seeing that same error (I can create a connection but when I do an action ex. like a select statment I get an error). What i'm wondering could it be that the driver I load with Class.forName() some how unloads it's self after x amount of time not being used? Not sure if that is it but if anyone could give me some insight that would be great. The Error i recieve is below:
INFO: Database Event:DatabaseController: Error executing database query.
ERROR: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: Software caused connection abort: recv failed
STACKTRACE:
java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:104)
at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:144)
at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:172)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1839)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2288)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2784)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2370)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2297)
at com.mysql.jdbc.Statement.executeQuery(Statement.java:1183)
at com.softnet.database.DatabaseController.executeDatabaseQuery(DatabaseController.java:190)
at com.softnet.games.GameServer.validateUser(GameServer.java:438)
at com.softnet.games.GameServer.handleData(GameServer.java:113)
at com.softnet.network.HttpConnectionThread.run(HttpServletListener.java:191)
** END NESTED EXCEPTION **
I know the query is good because it works all other times just not after about 8 hours.
--Z3r0CooLHey,
Thanks for the responces. For the connection pooling I would open 5 connections and keep them open. So i though maybe after 8 hours after not being used they would timeout. Thats why i turned off conection pooling and create a new connection each time. Anyways i'll post the code below incase i made a mistake somewhere.
package com.softnet.database;
/************************ DatabaseControler **************************/
import java.sql.*;
import java.util.*;
import com.softnet.database.DatabaseConnectionPool;
import com.softnet.database.DatabaseSettings;
public class DatabaseController
implements DatabaseListener
//Used to make sure the database driver is loaded
private boolean databaseDriverState = false;
//Used to store a database connection
private Connection databaseConnection = null;
//If to user connection pooling or not
private boolean useConnectionPooling = false;
//Used to hold the connection pool varible
private DatabaseConnectionPool connectionPool = null;
//Used to store database settings
private DatabaseSettings databaseSettings;
//Used to hold the DatabaseController listeners
private List databaseControllerListeners = new ArrayList();
//min number of connections for connection pool
private int minNumberOfConnections = 1;
//max number of connections for connection pool -1 is unlimited
private int maxNumberOfConnections = -1;
//DatabaseController Constructors
public DatabaseController(DatabaseSettings databaseSettings)
this.databaseSettings = databaseSettings;
databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
public DatabaseController(DatabaseSettings databaseSettings, boolean useConnectionPooling, int minNumberOfConnections, int maxNumberOfConnections)
this.databaseSettings = databaseSettings;
this.useConnectionPooling = useConnectionPooling;
this.minNumberOfConnections = minNumberOfConnections;
this.maxNumberOfConnections = maxNumberOfConnections;
if(useConnectionPooling == true)
connectionPool = new DatabaseConnectionPool(databaseSettings, minNumberOfConnections, maxNumberOfConnections);
connectionPool.addDatabaseListener(this);
else
databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
public DatabaseController() {}
//Database Settings Get/Set
public DatabaseSettings getDatabaseSettings()
return databaseSettings;
public void setDatabaseSettings(DatabaseSettings databaseSettings)
this.databaseSettings = databaseSettings;
//Connection Pooling Get/Set
public boolean getConnectionPooling()
return useConnectionPooling;
public void setConnectionPooling(boolean useConnectionPooling, int minNumberOfConnections, int maxNumberOfConnections)
this.useConnectionPooling = useConnectionPooling;
this.minNumberOfConnections = minNumberOfConnections;
this.maxNumberOfConnections = maxNumberOfConnections;
if(useConnectionPooling == true)
if(connectionPool == null)
connectionPool = new DatabaseConnectionPool(databaseSettings, minNumberOfConnections, maxNumberOfConnections);
connectionPool.addDatabaseListener(this);
else
if(connectionPool != null)
connectionPool.destroyConnections();
connectionPool.removeDatabaseListener(this);
connectionPool = null;
//Return if there connected
public boolean isConnected()
boolean isConnected;
if(databaseConnection != null)
isConnected = true;
else
isConnected = false;
return isConnected;
//Used to connect to database or get a connection for the connection pool
public void connect()
if(databaseDriverState == false)
databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
//If we dont have a current connection, make one
if(databaseConnection == null && databaseDriverState == true)
if(useConnectionPooling == false)
try
databaseConnection = DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword());
catch (SQLException sqle)
//Raise event
raiseDatabaseEvent("DatabaseController: Error connecting to database. \nERROR: " + sqle.getMessage());
databaseConnection = null;
else
databaseConnection = connectionPool.getConnection();
//Used to disconnect from the database or give back the connection to the connection pool
public void disconnect()
if(databaseConnection != null)
if(useConnectionPooling == false)
try
//Close DB Connection
databaseConnection.close();
catch(SQLException ignore) {}
finally
databaseConnection = null;
else
connectionPool.returnConnection(databaseConnection);
databaseConnection = null;
public ResultSet executeDatabaseQuery(String sSQL)
ResultSet databaseResult = null;
if(databaseConnection != null)
try
Statement databaseStatement = databaseConnection.createStatement();
databaseResult = databaseStatement.executeQuery(sSQL);
catch(SQLException sqle)
//Raise event
raiseDatabaseEvent("DatabaseController: Error executing database query.\nSQL: " + sSQL + "\nERROR: " + sqle.getMessage());
return databaseResult;
public int executeDatabaseUpdate(String sSQL)
int rowsAffected = -1;
if(databaseConnection != null)
try
Statement databaseStatement = databaseConnection.createStatement();
rowsAffected = databaseStatement.executeUpdate(sSQL);
catch(SQLException sqle)
//Raise event
raiseDatabaseEvent("DatabaseController: Error executing database update.\nSQL: " + sSQL + "\nERROR: " + sqle.getMessage());
return rowsAffected;
//Used to load the Database Driver
private boolean loadDatabaseDriver(String databaseDriver)
boolean driverLoaded;
if(databaseDriver.equals("") == false)
try
//Load Database Driver
Class.forName(databaseDriver).newInstance();
driverLoaded = true;
catch (Exception e)
//Raise event
raiseDatabaseEvent("DatabaseController: Error loading database driver. \nERROR: " + e.getMessage());
driverLoaded = false;
else
driverLoaded = false;
return driverLoaded;
//Wrap the DatabaseConnectionPool Error to the DatabaseController
public void databaseEventOccurred(DatabaseEvent de)
raiseDatabaseEvent(de.getErrorMessage());
//Event Handling Code
//Used to add database listeners (Its sync'd so you can change the listeners when firing an event)
public synchronized void addDatabaseListener(DatabaseListener databaseControllerListener)
databaseControllerListeners.add(databaseControllerListener);
//Used to remove a listener from the list (Its sync'd so you can change the listeners when firing an event)
public synchronized void removeDatabaseListener(DatabaseListener databaseControllerListener)
databaseControllerListeners.remove(databaseControllerListener);
//Used to send the raise event to the listeners
private synchronized void raiseDatabaseEvent(String databaseError)
DatabaseEvent databaseEvent = new DatabaseEvent(this, databaseError);
Iterator listeners = databaseControllerListeners.iterator();
while(listeners.hasNext())
DatabaseListener listener = (DatabaseListener) listeners.next();
listener.databaseEventOccurred(databaseEvent);
/********************* DatabaseConnectionPool **************/
package com.softnet.database;
import java.io.*;
import java.sql.*;
import java.util.*;
import com.softnet.database.*;
import com.softnet.database.DatabaseSettings;
public class DatabaseConnectionPool
//min number of connections
private int minNumberOfConnections = 1;
//max number of connections -1 is unlimited
private int maxNumberOfConnections = -1;
//Store the connections
protected Hashtable databaseConnections = null;
//Database Info
protected DatabaseSettings databaseSettings;
//to hold Driver state
private boolean databaseDriverState = false;
//To hold connection checker
private DatabaseConnectionCheck connectionChecker = null;
//Used to hold the DatabaseConnectionPool listeners
private List databaseConnectionPoolListeners = new ArrayList();
public DatabaseConnectionPool(DatabaseSettings databaseSettings, int minNumberOfConnections, int maxNumberOfConnections)
this.databaseSettings = databaseSettings;
this.minNumberOfConnections = minNumberOfConnections;
this.maxNumberOfConnections = maxNumberOfConnections;
//Load Driver
databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
//Create connection
createConnections();
public DatabaseConnectionPool(int minNumberOfConnections, int maxNumberOfConnections)
this.minNumberOfConnections = minNumberOfConnections;
this.maxNumberOfConnections = maxNumberOfConnections;
//Database Settings Get/Set
public DatabaseSettings getDatabaseSettings()
return databaseSettings;
public void setDatabaseSettings(DatabaseSettings databaseSettings)
this.databaseSettings = databaseSettings;
//Driver State Get
public boolean getDatabaseDriverState()
return databaseDriverState;
public void createConnections()
if(databaseDriverState == false)
databaseDriverState = loadDatabaseDriver(databaseSettings.getDatabaseDriver());
//Create all connections and load the minimum in the Hashtable
if(databaseConnections == null)
if(databaseDriverState == true && minNumberOfConnections != 0)
databaseConnections = new Hashtable();
for(int i = 0; i < minNumberOfConnections; i++)
try
databaseConnections.put(DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword()), Boolean.FALSE);
catch(SQLException sqle)
//Problem break loop and destroy any connections
destroyConnections();
//Raise event
raiseDatabaseEvent("DatabaseConnectionPool: Error creating database connections. \nERROR: " + sqle.getMessage());
break;
//If no connection check exists create one
if(connectionChecker == null)
connectionChecker = new DatabaseConnectionCheck(this);
connectionChecker.start();
public Connection getConnection()
Connection connection = null;
boolean errorWithConnection = false;
Enumeration connections = databaseConnections.keys();
synchronized (databaseConnections)
while(connections.hasMoreElements())
errorWithConnection = false;
connection = (Connection) connections.nextElement();
Boolean state = (Boolean) databaseConnections.get(connection);
//If connection is not used, use it.
if(state == Boolean.FALSE)
try
connection.setAutoCommit(true);
catch(SQLException e)
//Problem with connection remove connection and replace it
databaseConnections.remove(connection);
try
connection = DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword());
catch(SQLException sqle)
errorWithConnection = true;
if(errorWithConnection == false)
// Update the Hashtable to show this one's taken
databaseConnections.put(connection, Boolean.TRUE);
// Return the connection
return connection;
//All connections being used check to max to see if we can make a new one
if(maxNumberOfConnections == -1 || maxNumberOfConnections > databaseConnections.size())
try
connection = DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword());
catch(SQLException sqle)
errorWithConnection = true;
if(errorWithConnection == false)
databaseConnections.put(connection, Boolean.TRUE);
return connection;
//If not connections free and max connections reached wait for a free connection
return getConnection();
public void returnConnection(Connection connection)
boolean errorWithConnection = false;
//Make sure connection still works
try
connection.setAutoCommit(true);
catch(SQLException e)
//Problem with connection remove connection and replace it
databaseConnections.remove(connection);
try
connection = DriverManager.getConnection(databaseSettings.getDatabaseURL(), databaseSettings.getUserName(), databaseSettings.getUserPassword());
catch(SQLException sqle)
errorWithConnection = true;
if(errorWithConnection == false)
databaseConnections.put(connection, Boolean.FALSE);
public void destroyConnections()
Connection connection = null;
if(databaseConnections != null)
//Close all connections
Enumeration connections = databaseConnections.keys();
while (connections.hasMoreElements())
connection = (Connection) connections.nextElement();
try
connection.close();
catch(SQLException ignore) {}
//Free up hashtable
databaseConnections = null;
private boolean loadDatabaseDriver(String databaseDriver)
boolean driverLoaded;
if(databaseDriver.equals("") == false)
try
//Load Database Driver
Class.forName(databaseDriver);
driverLoaded = true;
catch (ClassNotFoundException cnfe)
//Raise event
raiseDatabaseEvent("DatabaseController: Error loading database driver. \nERROR: " + cnfe.getMessage());
driverLoaded = false;
else
driverLoaded = false;
return driverLoaded;
//Event Handling Code
//Used to add database listeners (Its sync'd so you can change the listeners when firing an event)
public synchronized void addDatabaseListener(DatabaseListener databaseConnectionPoolListener)
databaseConnectionPoolListeners.add(databaseConnectionPoolListener);
//Used to remove a listener from the list (Its sync'd so you can change the listeners when firing an event)
public synchronized void removeDatabaseListener(DatabaseListener databaseConnectionPoolListener)
databaseConnectionPoolListeners.remove(databaseConnectionPoolListener);
//Used to send the raise event to the listeners
private synchronized void raiseDatabaseEvent(String databaseError)
DatabaseEvent databaseEvent = new DatabaseEvent(this, databaseError);
Iterator listeners = databaseConnectionPoolListeners.iterator();
while(listeners.hasNext())
DatabaseListener listener = (DatabaseListener) listeners.next();
listener.databaseEventOccurred(databaseEvent);
class DatabaseConnectionCheck extends Thread
private DatabaseConnectionPool connectionPool;
DatabaseConnectionCheck(DatabaseConnectionPool connectionPool)
this.connectionPool = connectionPool;
public void run()
try
while(true)
//check threads every 30 seconds
this.sleep(300000);
if(connectionPool.databaseConnections != null)
Connection connection = null;
Enumeration connections = connectionPool.databaseConnections.keys();
synchronized (connectionPool.databaseConnections)
while(connections.hasMoreElements())
connection = (Connection) connections.nextElement();
Boolean state = (Boolean) connectionPool.databaseConnections.get(connection);
//If connection is not used, use it.
if(state == Boolean.FALSE)
try
connection.setAutoCommit(true);
catch(SQLException e)
//Problem with connection remove connection and replace it
connectionPool.databaseConnections.remove(connection);
try
connection = DriverManager.getConnection(connectionPool.databaseSettings.getDatabaseURL(), connectionPool.databaseSettings.getUserName(), connectionPool.databaseSettings.getUserPassword());
catch(SQLException sqle)
connection = null;
// Update the Hashtable with new connection if its not null
if(connection != null)
connectionPool.databaseConnections.put(connection, Boolean.FALSE);
catch(InterruptedException ignored) {}
Basicly the why it works is the connection pool hold the database connections. When the user needs a connection they use the database controller to request a connection (By create a instance and called the connect() method) and the connection is either created or grabed from the connection pool. After the user is done with the connection they call the disconnect() method which closes the connection or returns it to the connection pool.
--Z3r0CooL -
Compare creation of Datasources and JMS Queues : SAP vs (Weblogic/Websphere
I am used to creating JDBC Datasources and JMS Queues on Weblogic/Websphere thru their Admin applications.
Can someone compare/contrast that process to that on SAP's netweaver ( either using NWA or Visual Administrator).
ThanksHi Parag,
For the process of creating JDBC datasources and JMS resources @ SAP NetWeaver you can refer to the documents here on SDN and help.sap.com, and compare that process for yourself, thus not being influenced by others' biased or unbiased opinions.
For NetWeaver 04 and 04s these would be:
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/b0/6e62f30cbe9e44977c78dbdc7a6b27/frameset.htm">JDBC Connector Service</a>
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/22/cf4e71c46cdb4da31153be96c5389f/frameset.htm">JMS Connector Service</a>
For the <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/javaee5">Java EE 5 Edition</a>:
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/7bb9751d-0e01-0010-febd-c3adce2c408c">Working with Database Tables, DataSources and JMS Resources</a>
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/806e75a0-0e01-0010-2587-fc518de8ac1a">Administration Guide</a> -> section "Application Resources Management" (pages 89-104)
Hope that helps!
Your feedback/findings are very welcome!
-Vladimir
Maybe you are looking for
-
Transport request : tp check buffer for already imported requests
Hi, I want to put a transport request on my prod. There was no problem on the quality. But on the prod, i have the message : "tp check buffer for already imported requests" and nothing appends. Do you have any idea how i can unlock this transport req
-
Hi Guys Working on Actions, what is the need to schedule an action when you can set a condition and initiate the action using the start condition ? Hope I make sense... Cheers Jessy
-
Do we still need relational databases?
Dears, will this new in-memory technology reduce the need of a relational database? There are also rumors about a column-based database... are we talking about the same product? Thanks, Federico Biavati
-
Weblogic 8.1: Remote/Foreign Server JMS - Destination not found error
Hi This is our current setup: Weblogic Server 8.1 with JMS module running on the same instance as the application. We would like to move JMS out into its own box. I am currently setting up my development environment to test the new setup. These are t
-
Error while installing Agent using Agent Push Method
Hi All, I have installed Oracle EM Grid 10.2.0.1 on Linux 4 (Enterprise). I have moved my repository database to another host. Grid(oms,repo db,agent) is working fine. But i am trying to install one agent in remote host using Agent push method. I am