Dynamically Undeploying EJBs / MDBs
Hi,
Is there a way to programmatically undeploy EJBs or MDBs. I am working with WLS6.1.
I have a Message Driven Bean which should take messages from the Queue and parse
the XML body of the message and save it into the database.
In the MDB, onMessage(), I am checking if the Database is available, if it is
not available, I am rolling back the message. But the problem is the message
is consumed again. So I want to undeploy the MDB after some retries.
Can I programmatically undeploy a Message Driven Bean or EJB.
Thanks in advance
Venkatesan
Hi,
Is there a way to programmatically undeploy EJBs or MDBs. I am working with WLS6.1.
I have a Message Driven Bean which should take messages from the Queue and parse
the XML body of the message and save it into the database.
In the MDB, onMessage(), I am checking if the Database is available, if it is
not available, I am rolling back the message. But the problem is the message
is consumed again. So I want to undeploy the MDB after some retries.
Can I programmatically undeploy a Message Driven Bean or EJB.
Thanks in advance
Venkatesan
Similar Messages
-
Hi,
I am using Weblogic 6.1 SP4 - Integrating with MQ5.2 using IBM MQ Classes.
I have an MDB which points to a MQ Queue. MDB takes the message and delegates
to specific Java Classes which parse the XML (body of the message) into Java Objects
and save them into database.
I have implemented Container Managed transactional MDBs. Before processing the
message I am checking to see if the database connection is available. If the
database connection is not available, I am rolling back the message into the Queue.
The problem is that this is getting into a loop, till the database connection
is available. (MDB picks up the message and checks up for database connectivity
and rolls back into the queue).
The solution that I have thought of doing is to check upto 5 times (just a count
I have decided), after which I will undeploy the MDBs dynamically. Then I will
start a new Thread (Thread class) which will check if the database connection
is available and once the connection is available, I will redeploy the MDB to
process the message again.
I have following questions here:
(1) How to dynamically undeploy & re-deploy MDB
(2) How can I check Redelivered Count. I know that I can use Message.getJMSRedelivered
(), which will return me a boolean stating the message is redelivered. If I
can't check for Redelivered count, then if getJMSRedelivered() is "true", then
I will undeploy the MDB.
(3) Will there be any issues/problems in the solution discussed above.
Thanks in advance for any help.
Regards,
Venkatesan.
As I wrote below, I think there is a way, but I don't
know how. For programmatically undeploying the MDB,
I suggest posting your needs to the "ejb" newsgroup, which has
more experience in this area. (I mentioned this already
in another part of this email thread.)
Tom
Sastry wrote:
> Hi Tom,
>
> Is there any way to use weblogic 7.0 JMX API's to suspend a MDB so that it won't
> process any messages from the queue until the next destination like oracle database
> connection is up and running.
>
> Thanks
> Sastry
>
> Tom Barnes <[email protected]> wrote:
>
>>9.0 - I don't know the official release date, but I
>>imagine its in the latter half of 2004. For now,
>>there is undeploying the MDBs, or shutting down JMS.
>>
>>Tom
>>
>>Mikhail Stolpner wrote:
>>
>>
>>>Yes. Exactly.
>>>What next release do you mean? Is it 8.1SP2 or 9.0?
>>>
>>>Thank you very much,
>>>Mikhail
>>>
>>>"Tom Barnes" <[email protected]> wrote in message
>>>news:[email protected]...
>>>
>>>
>>>>Clarification. You can pause "produces", but not "consumes",
>>>>using the console or programmatically via JMX.
>>>>I assumed you meant to pause "consumes".
>>>>
>>>>Tom Barnes wrote:
>>>>
>>>>
>>>>
>>>>>Hi Mikhail,
>>>>>
>>>>>There is no direct way. In 7.0 and later you can
>>>>>programmatically shutdown
>>>>>the entire JMS server, while leaving the WL server up,
>>>>>by setting the JMS server mbean's "target"
>>>>>field to null.
>>>>>
>>>>>Note that you can have multiple JMS server's per WL
>>>>>server.
>>>>>
>>>>>Tom
>>>>>
>>>>>P.S. A rich featured pause capability is planned
>>>>>for the next release. This includes the ability
>>>>>to pause an MDB, as well as an entire destination
>>>>>in various ways.
>>>>>
>>>>>Mikhail Stolpner wrote:
>>>>>
>>>>>
>>>>>
>>>>>>Hi Tom,
>>>>>>
>>>>>>Do you know if there is a way to programmatically pause Weblogic
>>
>>Queue?
>>
>>>>>>Thanks,
>>>>>>Mikhail
>>>>>>
>>>>>>"Tom Barnes" <[email protected]> wrote in message
>>>>>>news:[email protected]...
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Hi,
>>>>>>>
>>>>>>>A "redelivered count" requires a vendor extension - JMS does
>>>>>>>not provide one. Check the MQ doc to see if there is one.
>>>>>>>
>>>>>>>Another option is programmatically pause MQ - I'm not sure
>>>>>>>if there is a way to do this. Again - check the MQ doc.
>>>>>>>
>>>>>>>Another option is to simply block the MDB in a try/sleep()
>>>>>>>retry loop until the database connection comes back up.
>>>>>>>
>>>>>>>As for programmatically undeploying the MDB, I suggest
>>>>>>>posting your needs to the "EJB" newsgroup, which has
>>>>>>>more experience in this area.
>>>>>>>
>>>>>>>Tom
>>>>>>>
>>>>>>>Venkatesan wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>Hi,
>>>>>>>>I am using Weblogic 6.1 SP4 - Integrating with MQ5.2 using IBM
>>
>>MQ
>>
>>>>>>
>>>>>>Classes.
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>I have an MDB which points to a MQ Queue. MDB takes the message
>>
>>and
>>
>>>>>>
>>>>>>delegates
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>to specific Java Classes which parse the XML (body of the message)
>>>
>>>into
>>>
>>>
>>>>>>Java Objects
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>and save them into database.
>>>>>>>>I have implemented Container Managed transactional MDBs. Before
>>>>>>
>>>>>>
>>>>>>processing the
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>message I am checking to see if the database connection is available.
>>>>>>
>>>>>>
>>>>>>If the
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>database connection is not available, I am rolling back the message
>>>>>>>>into
>>>>>>
>>>>>>
>>>>>>the Queue.
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>The problem is that this is getting into a loop, till the database
>>>>>>
>>>>>>
>>>>>>connection
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>is available. (MDB picks up the message and checks up for database
>>>>>>
>>>>>>
>>>>>>connectivity
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>and rolls back into the queue).
>>>>>>>>The solution that I have thought of doing is to check upto 5 times
>>>>>>>>(just
>>>>>>
>>>>>>
>>>>>>a count
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>I have decided), after which I will undeploy the MDBs dynamically.
>>>>>>>>Then
>>>>>>
>>>>>>
>>>>>>I will
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>start a new Thread (Thread class) which will check if the database
>>>>>>
>>>>>>
>>>>>>connection
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>is available and once the connection is available, I will redeploy
>>>
>>>the
>>>
>>>
>>>>>>MDB to
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>process the message again.
>>>>>>>>
>>>>>>>>I have following questions here:
>>>>>>>>
>>>>>>>> (1) How to dynamically undeploy & re-deploy MDB
>>>>>>>> (2) How can I check Redelivered Count. I know that I can use
>>>>>>
>>>>>>
>>>>>>Message.getJMSRedelivered
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>(), which will return me a boolean stating the message is
>>>
>>>redelivered.
>>>
>>>
>>>>>>If I
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>can't check for Redelivered count, then if getJMSRedelivered()
>>
>>is
>>
>>>>>>
>>>>>>"true", then
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>I will undeploy the MDB.
>>>>>>>> (3) Will there be any issues/problems in the solution discussed
>>>>>>
>>>>>>
>>>>>>above.
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>Thanks in advance for any help.
>>>>>>>>
>>>>>>>>Regards,
>>>>>>>>Venkatesan.
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>
>
-
Is it possible to dynamically change a MDB selector or does the MDB have
to deployed each time the selector changes? Redeploying is not an option
as we want a client to be able to state the criteria of the selector,
say for example, give me messages for stock BEA when its price exceeds
$10.
The same use then want to change this to $11. This is too dynaminc for a
redeployment per selector change.
Must I resort to non-MDB listeners for this?Is it possible to dynamically change a MDB selector or does the MDB have
to deployed each time the selector changes? Redeploying is not an option
as we want a client to be able to state the criteria of the selector,
say for example, give me messages for stock BEA when its price exceeds
$10.
The same use then want to change this to $11. This is too dynaminc for a
redeployment per selector change.
Must I resort to non-MDB listeners for this? -
WL6: HOW TO REMOVE an undeployed EJB/WAR/EAR
Is it possible to REMOVE an undeployed EJB/WAR/EAR without having to edit
the config.xml and thus rebooting the server?
MergWe feel the application deployment process, while a major improvement over
previous releases, still has some wrinkles that need to be ironed out.
These wrinkles aren't of the ServicePack variety. We hope to revamp the
whole thing in a subsequent release. In the meantime you can make your
feelings known to your friendly neighborhood sales-person and that may
expedite things.
Gary
"Charlie Crook" <[email protected]> wrote in message
news:[email protected]..
Is it a feature for an upcoming service pack? If not, how can we request
such a feature?
"Gary Keim" <[email protected]> wrote in message
news:3a9183ca$[email protected]..
I don't believe that operation is supported at this time.
Gary
"Merg" <[email protected]> wrote in message
news:3a8f920e$[email protected]..
Is it possible to REMOVE an undeployed EJB/WAR/EAR without having toedit
the config.xml and thus rebooting the server?
Merg -
How to UnDeploy EJBs deployed in XI
i have deployed some EJBs for java proxy, adapter module, etc, in SAP J2EE engine of XI 3.0 using NWDS,
is there any way to undeploy those EARs, either through NWDS or some other tools
Thanks Forum,i have no idea about using SDM, can u provide a bit detail of how to undeploy a EAR using SDM...
i thought of deleting those EARs in the server itself.....but was confused to see the same EAR files in multiple location.. -
Using Spring beans from EJB MDB
I have a situation where I need to use spring beans from an EJB 3.0 MDB. The project does not have any webapps or anything,
it will be only a MessageBean facade that needs to call spring beans. It is meant to be a service, that can be called by usign a single EJB message.
The problem is I cannot get the spring context to load properly, since the MDBean it self is initialized(constructor called) only when it receives the first message from the broker, thus It's "too late" to initialize the spring context. What I want to do is load the spring context when the EJB is deployed in the Java EE container. So, is there a way I can call a some method, class, anything when the EJB is deployed in the container. Can I do something with a deployment descriptor?
I am using glassfish V2 UR1, EJB 3.0, Spring 2.0.7 The project is deployed as a jar.Miku wrote:
I have a situation where I need to use spring beans from an EJB 3.0 MDB. The project does not have any webapps or anything,
it will be only a MessageBean facade that needs to call spring beans. It is meant to be a service, that can be called by usign a single EJB message. Why not make it a real service? Spring's contract first web services are a very nice way to go. It hides the fact that you're using a message-driven component for processing, too.
% -
Code to undeploy EJB modules only works outside of weblogic
I have three applications, which we'll call "ejbapp", "deploysa", and "deployear" for reference. The "ejbapp" is just composed of individual EJB modules, using "classloader-structure" elements to put each EJB module in its own ClassLoader (to allow each EJB module to be individually undeployed). The "deploysa" is a standalone app that just uses "DeployerRuntimeMBean" to stop and start individual EJB modules in "ejbapp". The "deployear" app is an ear containing basically the same deployment logic that "deploysa" contains.
When I run "deploysa", I can see it successfully undeploy an individual EJB module in "ejbapp".
When I run "deployear", however, when it executes the "stop()" method, I see the following exception:
NoAccessRuntimeException: Access not allowed for subject: principals=[], on ResourceType: DeployerRuntime Action: execute, Target: stop
I've tried several variations of this. There are three overloaded versions of "DeployerRuntime.getDeployerRuntime()", and I've tried all three of them, including the one taking "user, pwd, url", which is the one that "deploysa" uses (successfully).
I've googled for this error, but the only occurrences I've found are people reporting a problem like this, but without finding a solution.I've resolved this. As JPDs normally run with "anonymous" permissions, you have to set the "run-as" element on the underlying session bean to "weblogic". This can be done with the following in the javadoc comment block:
@common:security run-as="weblogic"
I believe it can also be set in the WLI console. -
Starvation in EJB/MDB thread pool ?
I am re-posting this article including the acronym EJB in the subject so that the EJB experts don't overlook this question. This question was moved from the JMS newsgroup to this newsgroup by a BEA moderator.
Our application receives 10 different types of messages on one queue each. Thus we have 10 queues (MQ as a Foreign JMS provider with MDBs in a WLS). We have MDBs processing each of these queues. The producer (mainframe) that sends messages to these queues operates in batch mode.
Option (1) Configure all MDBs in the same custom thread pool. If a blast of 500 messages arrives on one of the queues and all the threads start consuming messages, what happens to new messages that arrive on other queues ? Do they have to wait until these 500 messages are processed ? I would like someone from the BEA JMS implementation team to comment on this.
Option (2) Configure smaller custom thread pools - one for each queue. Solves the problem above. Let us say we allocate 2 threads per MDB in custom thread pools. This ensures that none of the queues starve, however, if there is a practical limit on the maximum number of threads that can be configured, then this option introduces an inefficiency. What if there are 200 messages in one queue and zero messages in all others ? We are allowing only two threads to process those 200 messages while the other threads just sit and watch.I am re-posting this article including the acronym EJB in the subject so that the EJB experts don't overlook this question. This question was moved from the JMS newsgroup to this newsgroup by a BEA moderator.
Our application receives 10 different types of messages on one queue each. Thus we have 10 queues (MQ as a Foreign JMS provider with MDBs in a WLS). We have MDBs processing each of these queues. The producer (mainframe) that sends messages to these queues operates in batch mode.
Option (1) Configure all MDBs in the same custom thread pool. If a blast of 500 messages arrives on one of the queues and all the threads start consuming messages, what happens to new messages that arrive on other queues ? Do they have to wait until these 500 messages are processed ? I would like someone from the BEA JMS implementation team to comment on this.
Option (2) Configure smaller custom thread pools - one for each queue. Solves the problem above. Let us say we allocate 2 threads per MDB in custom thread pools. This ensures that none of the queues starve, however, if there is a practical limit on the maximum number of threads that can be configured, then this option introduces an inefficiency. What if there are 200 messages in one queue and zero messages in all others ? We are allowing only two threads to process those 200 messages while the other threads just sit and watch. -
EJB - MDB and Session and Entity - Seem to always run under same Thread
I am working on an application that implemets a connection from an MDB to a Session EJB which inturn connects to a Entity EJB. All connections are impemented as Local Home. I use log4j for tracing and notice that the thread ID reported for all activity is the same "Thread ID: MessageListenerThreadPool : 0" .
This confuses me because I thought that all EJB's would execute under different threads. Have I done something wrong? Have I missinterpreted the EJB implementation? Any opinions would be greatly appreciated!!Hi Kelly,
This is a slight misinterpretation of the EJB threading requirements. There are a couple different issues as play here. First, the main threading guarantee made by the spec is that a particular instance of an EJB will not be invoked by the container on more than one thread at a time. This is one of the guarantees that simplifies the EJB programming model so that developers don't have to do anything special (e.g. the use of synchronized blocks) to handle concurrent access. Second, the EJB Local programming model requires that invocations have pass-by-reference semantics. Of course, the easiest way for the container to provide that behavior is to literally make the local invocation on the same thread.
The call-flow you're describing touches a single instance from three different beans, so the threading guarantee is not violated. Hope that clears things up a bit.
--ken -
Hello,
I'm reasonably new to working with EJBs so perhaps this isnt possible... Can you dynamically call an EJB at runtime ie like reflection.
I know once the bean has been created I can use reflection to call the method but how can I create the bean from the beans remote home interface?
Many thanks
MichaelGot it
EJBMetaData md = theHome.getEJBMetaData();
Class homeClass = md.getHomeInterfaceClass();
EJBObject theRemote = (EJBObject)invoke(homeClass,theHome,"create");
static Object invoke(Class c,Object obj,String mname){
Method[] methods = c.getMethods();
String name=null;
Object r= null;
try {
for(int i = 0; i<methods.length ;i++) {
name = methods.getName();
if(name.startsWith(mname)) {
r = methods[i].invoke(obj,null);
} catch(Exception e){
e.printStackTrace();
return r; -
Hi,
I am trying to configure a transaction to span between one Stateless EJB and MANY
JMS Messages sent to a topic consumed via a MDB.
I have a Stateless EJB Services called copyOffers(List offerIds). For each offerId
in OfferIds it sends a JMS Message to the CopyOffer Topic. I have one MDB subscribed
to the Topic that does the work of copying the ONE offer it was provided. I also,
have configured the JMSReplyTo with a temp. Topic so that all the CopyOfferMDBs
can notify the Stateless EJB when they are done.
I want all the EJB and MDB calls to act within ONE transaction. The Stateless
Session Bean is marked as REQUIRED and the MDB is marked as CONTAINER and also
REQUIRED.
Here is what I have done...
If I mark my JMS Connection Factory as User Transaction Enabled = true... ALL
the MDB messages are only delivered once the Stateless EJB is commited. Then each
MDB is in its own transaction.
I can not get all the MDBs and the EJB to be in ONE transaction whereby if ONE
MDB failed ALL failed.
Any ideas?
Thanks,
Mike Porter
Cool!
There is no standard J2EE API or WebLogic J2EE extension
for handling multiple asynchronous workers
in the same transaction, but there is a supported non-J2EE
"back-door". Use the (free) Tuxedo java client's "tpacall()"
methods, and program your EJBs to be Tuxedo aware. (Tuxedo
is BEA's "C" based app server, but no Tuxedo server is needed.)
http://edocs.bea.com/wls/docs81/wtc.html
I do not know of any customers without a Tuxedo background that
are doing this. But, if you are interested, the "wtc" newsgroup
should be able to get you started.
Tom
P.S. The alternative is to use multiple transactions, which
inform some stateful central location when they are done. This
stateful thing could be an entity bean. This requires extra
code for failure cases - as it requires code for detecting the
failures in the first place, code for fixing up the failed
transaction(s), and for undoing the committed transactions(s).
This kind of code is generally referred to as
"compensating transactions", and, as you can imagine, sometimes
gets pretty hairy pretty fast...
Mike Porter wrote:
> I was afraid of that.
>
> Any ideas how I can asynchronously handle multiple workers(IE:my offer copiers)
> in one transaction. I thought JMS would help but I guess not.
>
> Thanks,
>
> Mike
>
> Tom Barnes <[email protected]> wrote:
>
>>Hi Mike,
>>
>>As with any messaging system, the production of a message can
>>not participate in the same transaction as the consumption of
>>a message. The producer's commit call is what makes
>>the message available for consumption.
>>
>>You may want to read the "transactions" chapter of the
>>JMS Programmer's guide.
>>
>>Tom
>>
>>
>>Mike Porter wrote:
>>
>>>Hi,
>>>
>>>I am trying to configure a transaction to span between one Stateless
>>
>>EJB and MANY
>>
>>>JMS Messages sent to a topic consumed via a MDB.
>>>
>>>I have a Stateless EJB Services called copyOffers(List offerIds). For
>>
>>each offerId
>>
>>>in OfferIds it sends a JMS Message to the CopyOffer Topic. I have one
>>
>>MDB subscribed
>>
>>>to the Topic that does the work of copying the ONE offer it was provided.
>>
>>I also,
>>
>>>have configured the JMSReplyTo with a temp. Topic so that all the CopyOfferMDBs
>>>can notify the Stateless EJB when they are done.
>>>
>>>
>>>I want all the EJB and MDB calls to act within ONE transaction. The
>>
>>Stateless
>>
>>>Session Bean is marked as REQUIRED and the MDB is marked as CONTAINER
>>
>>and also
>>
>>>REQUIRED.
>>>
>>>Here is what I have done...
>>>If I mark my JMS Connection Factory as User Transaction Enabled = true...
>>
>>ALL
>>
>>>the MDB messages are only delivered once the Stateless EJB is commited.
>>
>>Then each
>>
>>>MDB is in its own transaction.
>>>
>>>I can not get all the MDBs and the EJB to be in ONE transaction whereby
>>
>>if ONE
>>
>>>MDB failed ALL failed.
>>>
>>>Any ideas?
>>>
>>>Thanks,
>>>
>>>Mike Porter
>>>
>>
>
-
JMS, EJB, MDB etc.
Hi all,
I've got a client that accesses an EJB which in turn starts an MDB via a queue. The MDB has some processing which can take a while.
The problem I have is I need the client to be able to poll the EJB and see if the MDB has finished its processing yet. I'm stumped to try and think of a way the MDB can report its processing status back to the EJB.
Thanks for any input.The only way I can think of to do this is to have the MDB send some messages to a Queue, when you poll the EJB it looks on the Queue. If all you want is notification that the MDB has finished just send a message at the end.
-
Ejb MDB Pool Settings ignored?
Hi.
I have a series of MDBs, and have tried to increase performance by setting the InitialSize and MaxSize values of the bean in the ejb-j2ee-engine.xml (not version 3!).
However, it doesnt seem to make any difference and messages seem to be getting processed sequentially, as if there was only one instance of the bean.
Here is the layout of my xml.
<ejb-j2ee-engine
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ejb-j2ee-engine.xsd">
<description/>
<enterprise-beans>
<enterprise-bean>
<ejb-name>mySimpleMDB</ejb-name>
<jndi-name>jms/myTestQueue</jndi-name>
<message-props>
<destination-name>jms/myTestQueue</destination-name>
<connection-factory-name>jms/queueConnectionFactory</connection-factory-name>
<property>
<property-name>InitialSize</property-name>
<property-value>1</property-value>
</property>
<property>
<property-name>MaxSize</property-name>
<property-value>1</property-value>
</property>
<property>
<property-name>ResizeStep</property-name>
<property-value>1</property-value>
</property>
</message-props>
</enterprise-bean>
</enterprise-beans>
</ejb-j2ee-engine>
Is this the correct location - i am pretty sure it is by looking at the documentation.
regards,
AndrewHi Vladimir - here are the relevant XML files:
ejb-jar.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!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>
<display-name>TestApp</display-name>
<message-driven>
<description>Validates</description>
<display-name>Validation</display-name>
<ejb-name>FileValidationMDB</ejb-name>
<ejb-class>com.test.dts.ejb.FileValidationMDBBean</ejb-class>
<transaction-type>Container</transaction-type>
<acknowledge-mode>Auto-acknowledge</acknowledge-mode>
<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
</message-driven-destination>
<env-entry>
<description/>
<env-entry-name>ejb/beanRefContext</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>classpath:beanRefContext.xml</env-entry-value>
</env-entry>
</message-driven>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>FileValidationMDB</ejb-name>
<method-name>onMessage</method-name>
<method-params>
<method-param>javax.jms.Message</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
ejb-j2ee-engine.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ejb-j2ee-engine
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ejb-j2ee-engine.xsd">
<description/>
<enterprise-beans>
<enterprise-bean>
<ejb-name>FileValidationMDB</ejb-name>
<jndi-name>jms/dts/registeredFiles</jndi-name>
<message-props>
<destination-name>jms/dts/registeredFiles</destination-name>
<connection-factory-name>jms/dts/queueConnectionFactory</connection-factory-name>
<property>
<property-name>parallel-consumers</property-name>
<property-value>10</property-value>
</property>
<property>
<property-name>InitialSize</property-name>
<property-value>10</property-value>
</property>
<property>
<property-name>MaxSize</property-name>
<property-value>10</property-value>
</property>
<property>
<property-name>ResizeStep</property-name>
<property-value>1</property-value>
</property>
</message-props>
</enterprise-bean>
</enterprise-beans>
</ejb-j2ee-engine>
jms-resources.xml
<?xml version="1.0" encoding="UTF-8"?>
<jms-resources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="jms-resources.xsd">
<connection-factory>
<name>jms/dts/XAConnectionFactory</name>
<sap-local-factory-type>
<type>javax.jms.XAConnectionFactory</type>
<virtual-provider>default</virtual-provider>
</sap-local-factory-type>
</connection-factory>
<connection-factory>
<name>jms/dts/queueConnectionFactory</name>
<sap-local-factory-type>
<type>javax.jms.XAQueueConnectionFactory</type>
<virtual-provider>default</virtual-provider>
</sap-local-factory-type>
</connection-factory>
<connection-factory>
<name>jms/dts/topicConnectionFactory</name>
<sap-local-factory-type>
<type>javax.jms.XATopicConnectionFactory</type>
<virtual-provider>default</virtual-provider>
</sap-local-factory-type>
</connection-factory>
<destination>
<name>jms/dts/registeredFiles</name>
<type>javax.jms.Queue</type>
<sap-local-destination-type>
<virtual-provider>default</virtual-provider>
<!-- Properties for Message delivery -->
<property>
<description>
Message Delivery Attempts Limited - We dont limit...
</description>
<config-property-name>
deliveryAttemptsLimited
</config-property-name>
<config-property-value>false</config-property-value>
</property>
<property>
<description>Delay in Milliseconds</description>
<config-property-name>
deliveryDelayInterval
</config-property-name>
<config-property-value>60000</config-property-value>
</property>
</sap-local-destination-type>
</destination>
</jms-resources>
Hope this sheds some light on the subject...
Andrew -
Problem with Dynamically accessing EJB Class objects in WL 7.0 SP1
I am trying to build a component which has the ability to instantiate and execute
an known EJB method on the fly.
I have managed to build the component but when I try and execute it I get a ClassNotFoundException.
I know that the EJB I am trying to invoke is deployed and available on the server,
as I can see it in the console, I also seen to have been able to get the remote
interface of the object, my problem occurs when I try and access the class object
so I can perform a create on the object and then execute my method
The code I have written is below:
private Object getRemoteObject(Context pCtx, String pJNDIName, String pHomeBean)
throws Exception {
String homeCreate = "create";
Class []homeCreateParam = { };
Object []homeCreateParamValues = {};
try {
//This call seems to work and doesn't throw an exception
Object home = pCtx.lookup(pJNDIName);
//However this call throws a java.lang.ClassNotFoundException
Class homeBean = Class.forName(pHomeBean);
Method homeCreateMethod = homeBean.getMethod(homeCreate,homeCreateParam);
return homeCreateMethod.invoke(home, homeCreateParamValues);
} catch (NamingException ne) {
logStandardErrorMessage("The client was unable to lookup the EJBHome.
Please make sure ");
logStandardErrorMessage("that you have deployed the ejb with the JNDI
name "+pJNDIName+" on the WebLogic server ");
throw ne;
} catch (Exception e) {
logStandardErrorMessage(e.toString());
throw e;
Any advice would be really appreciated, I'm fast running out of ideas, I suspect
it has something to do with the class loader but I'm not sure how to resolve it
Regards
Jo CorlessHello Joanne,
Congratulations! I'm very happy that you've managed to fix your problem. It's
always essential to understand how to package applications when deploying on BEA
WebLogic. Usually, by throwing everything into an EAR file solves just about all
the class loader problems. :-) Let us know if you have any further problems that
we can assist you with.
Best regards,
Ryan LeCompte
[email protected]
http://www.louisiana.edu/~rml7669
"Joanne Corless" <[email protected]> wrote:
>
>
I've fixed it!!!!!!!!
Thanks to everyone who gave me help!!!!
The class loader was the culprit which is what I suspected all along.
As soon
as I put the 2 jar files I was using into an EAR file the problem went
away!!!!!
Thanks again
Jo Corless
"Ryan LeCompte" <[email protected]> wrote:
Hello Joanne,
As Mr. Woollen mentioned, I also believe it's a problem with the class
loader.
You need to be careful how you arrange your EJBs, because WebLogic has
a specific
method in which it loads classes in an EAR, JAR, and WAR file(s). Please
refer
to http://dev2dev.bea.com/articles/musser.jsp for more information about
BEA WebLogic
class loading mechanisms and caveats. Also, try printing out the various
methods
that are available on the object that was returned to you via reflection.
For
example, use the getMethods() method, which returns an array of Method
objects
that you can subsequently cycle through and print out the various method
names.
This way you can discover if the class found/returned to you is indeed
the one
you intend to locate.
Hope this helps,
Ryan LeCompte
[email protected]
http://www.louisiana.edu/~rml7669
Rob Woollen <[email protected]> wrote:
I believe the issue is the home interface class for this EJB is not
available in the class loader which is doing the reflection.
If you do:
getClass().getClassLoader().loadClass(homeInterfaceClassName)
I suspect it will fail. Reflection still requires that the class be
loadable.
-- Rob
Joanne Corless wrote:
Hi Slava,
If I make my code look like you describe below I get a compliationerror telling
me that
home.getMethod() is not recognised (no such method)
If I change it slightly and use
Method homeCreateMethod =
home.getClass().getMethod(homeCreate,homeCreateParam);
The code will compile OK but when executed it still throws a NoSuchMethodException
Any ideas ?
Thanks for your help so far
Regards
Jo Corless
Your code should look like
Object home = pCtx.lookup(pJNDIName);
Method homeCreateMethod =
home.getMethod(homeCreate,homeCreateParam);
return homeCreateMethod.invoke(home, homeCreateParamValues);
Regards,
Slava Imeshev
"Joanne Corless" <[email protected]> wrote in message
news:[email protected]...
Hi Ryan,
I also wanted to mention that if you do a "header search" in this
particular
newsgroup
with the search query as "reflection", you will see many previousmessages
regarding
reflection and EJBs. I believe you could learn a lot from thedifficulties
that
others have faced and solved.I tried that and although there was a number of similar cases noneof them
actually
seem to fix my issue. Thanks for the suggestion though
Are the EJBs that you are trying to access accessible via your
system
classpath?
Try to avoid having them accessible via the main system classpath,and
only bundle
them in your appropriate EJB jar files (contained in an EAR file,for
example).Maybe I should have laid the problem out a little clearer.
I have a number of EJB's bundled up in a JAR file which is hot deployedto
the
server. Within this first JAR file is an EJB (SSB) component that
needs
to
be
able to invoke a known method on another EJB. This second EJB may
or
may
not be
within the first JAR file but it also will be hot deployed.
The component trying to invoke the method on the 2nd EJB has to
be
able to
create
an instance of the 2nd EJB without actually knowing anything bar
a
JNDI
Name which
is passed in at runtime.
I can get as far as doing the
Object home = pCtx.lookup(pJNDIName);
This returned a class with the name
"com.csc.edc.projects.allders.httppostoffice.postman.PostmanBean_mp8qy2_Home
Impl_WLStub"
My problem seems to occur when I try and invoke the create method
Method homeCreate = home.getClass().getMethod("create", new Class[0]);
My code throws a java.lang.NoSuchMethodException at this point so
I
am
unable
to progress to the next step of :
Object bean = homeCreate.invoke(home, null);
So I can return the instantiated bean back to the calling client.
Why am I getting the NoSuchMethodException, is is because I am gettinga
stub
back rather than the home interface and if so how do I get the truehome
interface
from the bean
Thanks in advance
Jo Corless -
Hello,
I want to achieve the following using JMS,
Receiving messages from producers with specific criteria, ex. give me only messages that have date less than now.
if I used MDB then I have the choice of setting the selctor only one time, is there a way to set it from time to time.
If not then how do I achieve that using a combination of session beans and MDBs.
Becasue I want to do some processing on the messages received of that criteria then resend them to other receivers.Generally you cannot do this. The selector syntax does not allow comparisons against System.currentTimeMills(), and consumers don't allow changes to the selector. Within the specification, the best one can do is recreate the consumer over and over again. This is of course made even worse in that selectors for MDBs are buried inside a deployment descriptor. Nasty stuff.
WebLogic JMS allows you to specify a delivery time on a message. However it is considered an extension. Other vendors may have a similar feature, but there is no common API for it.
Maybe you are looking for
-
Cisco Jabber MSI Install Command lines/ Orca MST file
Greetings.... We are trying to deploy cisco jabber 9.7.4 either by using msi command line or configuring a custom installer using Orca. Both options have worked partially. 2 places we are getting stuck. The EULA is prompting to accept (which if we r
-
M4V video files not downloading or viewing, just showing characters in browser tab
Website I'm trying to download videos. http://www.eevblog.com/episodes/ I click on a video, it takes me to that videos page, somewhere down the page is a download link. I click the download and the browser tab starts filling up with all these strange
-
Third party dropshipment process and system setup
Hi gentlemen, I have a few question to check with you. 1 - What is the difference between Third Party Shipment, and Third Party Drop Shipment in term of process? 2 - What is the system setup requirement for Third Party Drop shipment (I know TAS is re
-
Missing packages in Software Update
Hello, I wanted to report a problem with software update. We have multiple different T540p models here at work, some are i7s and some are i5s. We do a fresh clean install of Windows to remove all of the bloatware, then run system update to fetch all
-
Can i listen to more of a preview song?
Is there any way to listen to a different section of a preview song or listen to more than the 30 second preview? There is a song I'm interested in, but the preview doesn't include any of the vocal portion of the song. It just plays the instrumental