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
Similar Messages
-
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
-
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 -
Problems in startup class (MDB on Weblogic 7.0 / IBM MQ)
Hello friends,
I am trying to communicate with IBM MQ through Weblogic 7.0 SP2 and
using MDB.
This is a bit strange but I had to reinstall Weblogic and I tried to
deploy the Startup class . However I am getting this error:
The WebLogic Server did not start up properly.
Exception raised:
java.lang.NoSuchMethodError
at com.ibm.mq.jms.services.ConfigEnvironment.<clinit>(ConfigEnvironment.java:173)
at java.lang.Class.forName0(Native Method)
I am totally at loss to understand this as it was working before I
reinstalled the Weblogic. (Maybe I am skipping something which I had
earlier done :-().
All help appreciated.
Thanks in advance,
Milan Doshi
Since your simply running an MQ client in a startup class, you should
be able to reproduce the issue without WebLogic in the mix. Once
that is done, contact IBM for support. I continue to suspect
a command-line problem - IBM is expecting something on
the java JVM command-line that is missing.
Tom
Milan Doshi wrote:
> Hello Tom,
>
> Thanks for the reply. I did ensure that all the relevant IBM jars are
> in the classpath but I still get that error.Infact the claspath was
> allready in place.
>
> Please give me your suggestions as I am totally at sea.
>
>
> <May 23, 2003 5:31:17 PM EDT> <Emergency> <WebLogicServer> <000342>
> <Unable to initialize the server: Fatal initialization excepti
> on
> Throwable: java.lang.NoSuchMethodError
> java.lang.NoSuchMethodError
> at com.ibm.mq.jms.services.ConfigEnvironment.<clinit>(ConfigEnvironment.java:173)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:115)
> at com.ibm.mq.jms.MQConnection.<clinit>(MQConnection.java:149)
> at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:142)
> at com.jpmc.ivr.middle.util.MQJMSStartup.startup(MQJMSStartup.java:112)
> at weblogic.t3.srvr.StartupClassService.invokeStartup(StartupClassService.java:158)
> at weblogic.t3.srvr.StartupClassService.invokeClass(StartupClassService.java:139)
> at weblogic.t3.srvr.StartupClassService.access$0(StartupClassService.java:130)
> at weblogic.t3.srvr.StartupClassService$1.run(StartupClassService.java:102)
> at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:780)
> at weblogic.t3.srvr.StartupClassService.invokeStartupClass(StartupClassService.java:97)
> at weblogic.t3.srvr.StartupClassService.initialize(StartupClassService.java:60)
> at weblogic.t3.srvr.ServerLifeCycleList.initialize(ServerLifeCycleList.java:54)
> at weblogic.t3.srvr.T3Srvr.initialize1(T3Srvr.java:782)
> at weblogic.t3.srvr.T3Srvr.initialize(T3Srvr.java:594)
> at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:282)
> at weblogic.Server.main(Server.java:32)
>
> ***************************************************************************
> The WebLogic Server did not start up properly.
>
> Thanks and regards,
>
> Milan Doshi
>
> Tom Barnes <[email protected]> wrote in message news:<[email protected]>...
>
>>Make sure that your MQ client classes are in
>>the classpath used to boot the WL JVM. If you
>>re-installed WL, and are using the installation's
>>WL boot scripts rather than your own, the JVM
>>will have a vanilla classpath - which, of course,
>>won't include IBM classes.
>>
>>Tom
>>
>>Milan Doshi wrote:
>>
>>>Hello friends,
>>>
>>>I am trying to communicate with IBM MQ through Weblogic 7.0 SP2 and
>>>using MDB.
>>>
>>>This is a bit strange but I had to reinstall Weblogic and I tried to
>>>deploy the Startup class . However I am getting this error:
>>>
>>>
>>>The WebLogic Server did not start up properly.
>>>Exception raised:
>>>java.lang.NoSuchMethodError
>>> at com.ibm.mq.jms.services.ConfigEnvironment.<clinit>(ConfigEnvironment.java:173)
>>> at java.lang.Class.forName0(Native Method)
>>>
>>>I am totally at loss to understand this as it was working before I
>>>reinstalled the Weblogic. (Maybe I am skipping something which I had
>>>earlier done :-().
>>>
>>>All help appreciated.
>>>
>>>Thanks in advance,
>>>
>>>Milan Doshi
>>
-
Problems with Deployment, Startup classes and MBeanHome
Hello,
we have the following problem: How to initialize our application
correctly???
We are using MDBs as message consumers but have to guarantee the order of
incoming
messages. Due to a shortcoming in the JMS implementation (Order of
redelivered messages
is not guaranteed before WLS 8.1!!!) we are using a singleton class to keep
the health state
of the different message queues within the application (controlling whether
the MDBs are
supposed to proceed with processing or to discard any incoming messages).
Thus the MDBs
have to access this singleton, what implies latter has to be initialized
prior to the application
deployment. That's what we are using a startup class for, which is marked to
be loaded before
appplication deployment...
Fortunately the according bug is fixed with WLS 7.0.2.0, so the class is
loaded, but we are
not able to access the MBeanHome interface (We like to register MBean to
provide
adminstrative access to the health state)!!!
javax.naming.NameNotFoundException: Unable to resolve
'weblogic.management.home.localhome' Resolved: 'weblogic.management'
Unresolved:'home' ; remaining name 'home.localhome'
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:174)
So when is the MBeanServer started???
Before application deployment??? After??? Is there any way to tell WLS not
to load the startup
class before the MBeanServer is available respectively the MBeanHome is
accessible via JNDI
but before application deployment???
Any hints are welcome!!!
Regards,
CKthis seems like a bug. the mbeanhome should be available for lookup in
startup classes. also posting to system management newsgroup.
"Carsten Kaiser" <[email protected]> wrote in message
news:[email protected]..
Hello,
we have the following problem: How to initialize our application
correctly???
We are using MDBs as message consumers but have to guarantee the order of
incoming
messages. Due to a shortcoming in the JMS implementation (Order of
redelivered messages
is not guaranteed before WLS 8.1!!!) we are using a singleton class tokeep
the health state
of the different message queues within the application (controllingwhether
the MDBs are
supposed to proceed with processing or to discard any incoming messages).
Thus the MDBs
have to access this singleton, what implies latter has to be initialized
prior to the application
deployment. That's what we are using a startup class for, which is markedto
be loaded before
appplication deployment...
Fortunately the according bug is fixed with WLS 7.0.2.0, so the class is
loaded, but we are
not able to access the MBeanHome interface (We like to register MBean to
provide
adminstrative access to the health state)!!!
javax.naming.NameNotFoundException: Unable to resolve
'weblogic.management.home.localhome' Resolved: 'weblogic.management'
Unresolved:'home' ; remaining name 'home.localhome'
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:174)
So when is the MBeanServer started???
Before application deployment??? After??? Is there any way to tell WLS not
to load the startup
class before the MBeanServer is available respectively the MBeanHome is
accessible via JNDI
but before application deployment???
Any hints are welcome!!!
Regards,
CK -
Error when starting opmn with custom startup class
I'm trying to use jaxb 2.0 classes in my custom oc4j startup class, but when I try to start the container the following error is produced in the logs.
Exception in thread "OC4J Launcher" java.lang.IllegalAccessError: tried to access class javax.xml.bind.ContextFinder from class javax.xml.bind.JAXBContext
Can anyone provide some guidance?
Regards,It seems I trying to use jaxb 2.x classes but oas 10.1.3.5 uses jaxb 1.0. Is there anyway to get this to work with jaxb 2.x? The error message I'm receiving now is
Exception in thread "OC4J Launcher" java.lang.NoSuchMethodError: javax.xml.bind.JAXBContext.newInstance([Ljava/lang/Class;)Ljavax/xml/bind/JAXBContext;
and if I use the JAXBContext.newInstance("package", this.getClass().getClassLoader());
I get this:
javax.xml.bind.JAXBException: Unable to locate jaxb.properties for package mil.usmc.mol.mbeans
10/02/23 13:03:08 at javax.xml.bind.ContextFinder.searchcontextPath(ContextFinder.java:205)
10/02/23 13:03:08 at javax.xml.bind.ContextFinder.find(ContextFinder.java:149)
10/02/23 13:03:08 at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:281)
Brett -
Hi,
I am using a custom connection pool to make database connection.I have a
start up class in which i am initialising the connection pool.This part
works fine at the time of start up of the server.
But, when i run my application which is trying to access the database , i am
unable to get handle to the above created pool.
Is this because of two different classloaders being used for start up
classes and web application?
If so, what could be the possible solution?If anybody knows please let me
know.1. use jndi to register and locate your resource.(connection pool). this
could be one solution
2. Instead load thru' your startup class a file prop file wherein you tell
weblogic the name and property of the coonection pool. Use these properties
to create a connection pool.
3. There is a connection API within weblogic to write java code to create
your connection pool.
Hope these things helps.
Chandra
"makkineni" <[email protected]> wrote in message
news:3a8afc20$[email protected]..
Hi,
I am using a custom connection pool to make database connection.I have a
start up class in which i am initialising the connection pool.This part
works fine at the time of start up of the server.
But, when i run my application which is trying to access the database , iam
unable to get handle to the above created pool.
Is this because of two different classloaders being used for start up
classes and web application?
If so, what could be the possible solution?If anybody knows please let me
know. -
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 -
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 -
Re: AQ/Referenceable Objects work with MDB on WebLogic
Great work! So you don't have to touch any of Oracle's classes, correct?
Do you have time to document the whole thing and post it here, including the source
code of all your custom classes?
Eric Ma
"Diptanshu Parui" <[email protected]> wrote:
>
>Forgot to add an important point.
>The extended classes have to in the oracle.jms package (not necessarily
>in the
>same jar) to extend the Oracle classes. And I have used aqapi13.jar.
>
>Dips
>
>"Diptanshu Parui" <[email protected]> wrote:
>>
>>Hi,
>>
>>After days of work on getting to integrate Oracle's AQ with WebLogic
>>I have managed
>>to get to a solution without making changes to the Oracle's AQ API.
>>
>>Eric Ma had managed to provide a solution about an year back changing
>>Oracle's
>>API and making the AQjmsConnection, AQjmsSession, AQjmsQueueConnectionFactory
>>& AQjmsDestination NOT implement Referenceable. This solution worked
>>with WebLogic
>>but meant that this cannot be deployed on Production environment.
>>
>>There was a myth that WebLogic's JNDI didn't provide support to Referenceable
>>objects like Oracle's AQjmsQueueConnectionFactory etc.
>>
>>This myth has been broken. Referenceable object CAN be bound and looked
>>up from
>>WebLogic's JNDI provided right Factory classes are written and the correct
>>constructor
>>for Reference is used in the getReference method of the Referenceable
>>implementation.
>>
>>In case of Oracle's objects, I wrote classes extending AQjmsQueueConnectionFactory
>>& AQjmsDestination. In the extended classes, I wrote toString method
>>and set private
>>String variable.
>>This string variable is just special character separated concat of all
>>parameters
>>used to call the constructor of the extended class.
>>Then, in the getReference method of the extended class, I used the following
>>constructor
>>of Reference.
>>
>>return new Reference( DipsAQQueueConnectionFactory.class.getName(),
>new
>>StringRefAddr("value",
>>value), DipsAQConnectionFactory.class.getName(), null);
>>
>>DipsAQQueueConnectionFactory is my class extending AQjmsQueueConnectionFactory
>>and DipsAQConnectionFactory is the factory class for DipsAQQueueConnectionFactory.
>>The object value passed in the StringRefAddr above is nothing but the
>>toString
>>of the extended class which was stored in the private String variable.
>>In the
>>factory class, the string is taken out the StringRefAddr and stripped
>>to get individual
>>parameters which were separated by special characters. Once, the individual
>>parameters
>>are got back, the Factory class instantiates the Referenceable object
>>and returns
>>it back.
>>
>>Another important point is in the extended class DipsAQQueueConnectionFactory
>>I wrote this method
>> public QueueConnection createQueueConnection() throws JMSException
>>
>> {
>> return createQueueConnection("user","user");
>> }
>>
>>And then using a startup class I bound the DipsAQQueueConnectionFactory
>>& DipsAQDestination
>>Referenceable objects to WLS. The MDB deployed on WLS was made lookup
>>for the
>>bound QF & Q and it started reading AQ messages.
>>
>>Few other points to note.
>>I have kept the user & pwd of WLS same as DB.
>>I have used OCI driver.
>>
>>Please feel free to raise further queries/suggestions.
>>
>>Dips
>
Eric,
This is the relevant part of the config.xml you were looking for.
<JMSDistributedQueue JNDIName="DQueue1" Name="DQueue1" Targets="ClusterTwo" Template="DQueue1">
<JMSDistributedQueueMember JMSQueue="Queue1" Name="DQM1"/>
<JMSDistributedQueueMember JMSQueue="Queue2" Name="DQM2"/>
</JMSDistributedQueue>
<JMSBridgeDestination
ConnectionFactoryJNDIName="AQJMSConnectionFactory" ConnectionURL="t3://ip:port"
DestinationJNDIName="AQJMSQueue" Name="AQJMSDest"/>
<JMSConnectionFactory JNDIName="ConnectionFactory" Name="ConnectionFactory"
ServerAffinityEnabled="false" Targets="IAServer,ClusterTwo" XAConnectionFactoryEnabled="true"/>
<JMSBridgeDestination ConnectionFactoryJNDIName="ConnectionFactory" ConnectionURL="t3://ip:port"
DestinationJNDIName="DQueue1" Name="Dest"/>
<MessagingBridge Name="MB1" QualityOfService="Duplicate-okay"
SourceDestination="AQJMSDest" TargetDestination="Dest"
Targets="IAServer,MS1 (migratable),MS2 (migratable),ClusterTwo"/>
No, I haven't used Oracle's OC4J 10g's AQJMS XA TX support classes.
cheers!
Dips
"Eric Ma" <[email protected]> wrote:
>
>Dips:
>
>Can you post your config.xml here to show how you set up WLS messaging
>bridges?
>
>Also, have you played with OC4J 10g's AQJMS XA TX support classes?
>
>Eric
>
>"Diptanshu Parui" <[email protected]> wrote:
>>
>>The sample code is now available at
>>http://dev2dev.bea.com/codelibrary/code/startupclass.jsp
>>
>>cheers,
>>Dips
>>
>>
>>"Diptanshu Parui" <[email protected]> wrote:
>>>
>>>Yes, no need to touch Oracle's code at all.
>>>
>>>I will post the whitepaper/code soon.
>>>
>>>
>>>"Eric Ma" <[email protected]> wrote:
>>>>
>>>>Great work! So you don't have to touch any of Oracle's classes, correct?
>>>>
>>>>Do you have time to document the whole thing and post it here, including
>>>>the source
>>>>code of all your custom classes?
>>>>
>>>>Eric Ma
>>>>
>>>>
>>>>"Diptanshu Parui" <[email protected]> wrote:
>>>>>
>>>>>Forgot to add an important point.
>>>>>The extended classes have to in the oracle.jms package (not necessarily
>>>>>in the
>>>>>same jar) to extend the Oracle classes. And I have used aqapi13.jar.
>>>>>
>>>>>Dips
>>>>>
>>>>>"Diptanshu Parui" <[email protected]> wrote:
>>>>>>
>>>>>>Hi,
>>>>>>
>>>>>>After days of work on getting to integrate Oracle's AQ with WebLogic
>>>>>>I have managed
>>>>>>to get to a solution without making changes to the Oracle's AQ API.
>>>>>>
>>>>>>Eric Ma had managed to provide a solution about an year back changing
>>>>>>Oracle's
>>>>>>API and making the AQjmsConnection, AQjmsSession, AQjmsQueueConnectionFactory
>>>>>>& AQjmsDestination NOT implement Referenceable. This solution worked
>>>>>>with WebLogic
>>>>>>but meant that this cannot be deployed on Production environment.
>>>>>>
>>>>>>There was a myth that WebLogic's JNDI didn't provide support to
>Referenceable
>>>>>>objects like Oracle's AQjmsQueueConnectionFactory etc.
>>>>>>
>>>>>>This myth has been broken. Referenceable object CAN be bound and
>>looked
>>>>>>up from
>>>>>>WebLogic's JNDI provided right Factory classes are written and the
>>>>correct
>>>>>>constructor
>>>>>>for Reference is used in the getReference method of the Referenceable
>>>>>>implementation.
>>>>>>
>>>>>>In case of Oracle's objects, I wrote classes extending AQjmsQueueConnectionFactory
>>>>>>& AQjmsDestination. In the extended classes, I wrote toString method
>>>>>>and set private
>>>>>>String variable.
>>>>>>This string variable is just special character separated concat
>of
>>>>all
>>>>>>parameters
>>>>>>used to call the constructor of the extended class.
>>>>>>Then, in the getReference method of the extended class, I used the
>>>>following
>>>>>>constructor
>>>>>>of Reference.
>>>>>>
>>>>>>return new Reference( DipsAQQueueConnectionFactory.class.getName(),
>>>>>new
>>>>>>StringRefAddr("value",
>>>>>>value), DipsAQConnectionFactory.class.getName(), null);
>>>>>>
>>>>>>DipsAQQueueConnectionFactory is my class extending AQjmsQueueConnectionFactory
>>>>>>and DipsAQConnectionFactory is the factory class for DipsAQQueueConnectionFactory.
>>>>>>The object value passed in the StringRefAddr above is nothing but
>>>the
>>>>>>toString
>>>>>>of the extended class which was stored in the private String variable.
>>>>>>In the
>>>>>>factory class, the string is taken out the StringRefAddr and stripped
>>>>>>to get individual
>>>>>>parameters which were separated by special characters. Once, the
>>individual
>>>>>>parameters
>>>>>>are got back, the Factory class instantiates the Referenceable object
>>>>>>and returns
>>>>>>it back.
>>>>>>
>>>>>>Another important point is in the extended class DipsAQQueueConnectionFactory
>>>>>>I wrote this method
>>>>>> public QueueConnection createQueueConnection() throws JMSException
>>>>>>
>>>>>> {
>>>>>> return createQueueConnection("user","user");
>>>>>> }
>>>>>>
>>>>>>And then using a startup class I bound the DipsAQQueueConnectionFactory
>>>>>>& DipsAQDestination
>>>>>>Referenceable objects to WLS. The MDB deployed on WLS was made lookup
>>>>>>for the
>>>>>>bound QF & Q and it started reading AQ messages.
>>>>>>
>>>>>>Few other points to note.
>>>>>>I have kept the user & pwd of WLS same as DB.
>>>>>>I have used OCI driver.
>>>>>>
>>>>>>Please feel free to raise further queries/suggestions.
>>>>>>
>>>>>>Dips
>>>>>
>>>>
>>>
>>
>
-
Custom button with action listener - will not invoke action listener
Hi
For whatever reason, I cannot find a concise example of a simple custom component that can invoke an action listener. The tutorials I've read so far either ignore this fundamental topic or only make the slightest make reference to it.
The best I have come up with - in terms of a simple prototype is below... but, the action listener is never invoked.... Can someone tell me what I am missing (full code below). Hopefully, what is missing or incorrect will be obvious to you JSF experts out there.
Thanks for any help!!
-f
tld
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>0.01</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>jsfcustomcomponent</short-name>
<uri>http://jsfcustomcomponent/</uri>
<description><![CDATA[jsf custom component tags]]> </description>
<tag>
<name>specialBtnTag</name>
<tag-class>jsfcustomcomponent.SpecialBtnTag</tag-class>
<attribute>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[button value]]></description>
</attribute>
<attribute>
<name>actionListener</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[action listener]]> </description>
</attribute>
</tag>
</taglib>
SpecialBtnComponent
package jsfcustomcomponent;
import javax.faces.component.*;
import javax.faces.context.*;
import javax.faces.el.*;
import javax.faces.event.*;
public class SpecialBtnComponent
extends UIComponentBase implements ActionSource
public static final String COMPONENT_TYPE = "SpecialBtnComponent";
public static final String RENDERER_TYPE = "SpecialBtnRenderer";
public String getFamily()
return COMPONENT_TYPE;
public SpecialBtnComponent()
super();
setRendererType(SpecialBtnComponent.RENDERER_TYPE);
private String value;
public void setValue(String value, FacesContext facesContext)
this.value = value;
public String getValue()
if (null != value)
return value;
ValueBinding _vb = getValueBinding("value");
if (_vb != null)
return (String) _vb.getValue(getFacesContext());
else
return null;
private MethodBinding action = null;
public MethodBinding getAction()
return action;
public void setAction(MethodBinding methodBinding)
this.action = action;
private MethodBinding actionListener = null;
public MethodBinding getActionListener()
return (this.actionListener);
public void setActionListener(MethodBinding methodBinding)
this.actionListener = actionListener;
public boolean isImmediate()
return false;
public void setImmediate(boolean _boolean)
//this.immediate = immediate;
public void addActionListener(ActionListener actionListener)
addFacesListener(actionListener);
public ActionListener[] getActionListeners()
return (ActionListener[]) getFacesListeners(ActionListener.class);
public void removeActionListener(ActionListener actionListener)
removeFacesListener(actionListener);
public Object saveState(FacesContext context)
Object values[] = new Object[5];
values[0] = super.saveState(context);
values[1] = value;
values[2] = saveAttachedState(context, action);
values[3] = saveAttachedState(context, actionListener);
return ( (Object) (values));
public void restoreState(FacesContext context, Object state)
Object values[] = (Object[]) state;
super.restoreState(context, values[0]);
value = (String) values[1];
action = (MethodBinding) restoreAttachedState(context, values[2]);
actionListener = (MethodBinding) restoreAttachedState(context, values[3]);
public void broadcast(FacesEvent event) throws AbortProcessingException
super.broadcast(event);
if (event instanceof ActionEvent)
FacesContext context = getFacesContext();
MethodBinding mb = getActionListener();
if (mb != null)
mb.invoke(context, new Object[]
{event});
ActionListener listener = context.getApplication().getActionListener();
if (listener != null)
listener.processAction( (ActionEvent) event);
public void queueEvent(FacesEvent e)
if (e instanceof ActionEvent)
if (isImmediate())
e.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
else
e.setPhaseId(PhaseId.INVOKE_APPLICATION);
super.queueEvent(e);
SpecialBtnRenderer
package jsfcustomcomponent;
import java.util.*;
import javax.faces.component.*;
import javax.faces.context.*;
import javax.faces.event.*;
import javax.faces.render.*;
public class SpecialBtnRenderer
extends Renderer
String value;
public SpecialBtnRenderer()
public void decode(FacesContext context, UIComponent component)
Map requestMap = context.getExternalContext().getRequestParameterMap();
String clientId = component.getClientId(context);
SpecialBtnComponent specialBtnComponent = (SpecialBtnComponent) component;
String value = (String) requestMap.get(clientId);
if (null != value)
specialBtnComponent.setValue(value, context);
ActionEvent actionEvent = new ActionEvent(specialBtnComponent);
specialBtnComponent.queueEvent(actionEvent);
public void encodeEnd(FacesContext context, UIComponent component) throws java.io.IOException
SpecialBtnComponent specialBtnComponent = (SpecialBtnComponent) component;
ResponseWriter writer = context.getResponseWriter();
String clientId = component.getClientId(context);
value = (String) component.getAttributes().get("value");
if (value == null)
value = "defaultValue";
buildSpecialBtn(writer, value, clientId, specialBtnComponent);
private void buildSpecialBtn(ResponseWriter writer, String value, String clientId, SpecialBtnComponent component) throws java.io.IOException
writer.startElement("table", component);
writer.startElement("tbody", component);
writer.startElement("tr", component);
writer.startElement("td", component);
value = String.valueOf(value);
writer.startElement("input", component);
writer.writeAttribute("type", "submit", null);
writer.writeAttribute("name", clientId, "clientId");
writer.writeAttribute("value", value, null);
writer.endElement("input");
writer.endElement("td");
writer.endElement("tr");
writer.endElement("tbody");
writer.endElement("table");
SpecialBtnTag
package jsfcustomcomponent;
import javax.faces.component.*;
import javax.faces.el.*;
import javax.faces.webapp.*;
import com.sun.faces.util.*;
public class SpecialBtnTag
extends UIComponentTag
public String value = null;
public String actionListener = null;
public String getComponentType()
return SpecialBtnComponent.COMPONENT_TYPE;
public String getRendererType()
return SpecialBtnComponent.RENDERER_TYPE;
protected void setProperties(UIComponent component)
super.setProperties(component);
if (! (component instanceof SpecialBtnComponent))
throw new IllegalStateException("Component " + component.toString() +
" not expected type. Expected: jsfcustomcomponent.SpecialBtnComponent. Perhaps you�re missing a tag?");
SpecialBtnComponent specialBtnComponent = (SpecialBtnComponent) component;
if (value != null)
if (isValueReference(value))
ValueBinding vb = Util.getValueBinding(value);
specialBtnComponent.setValueBinding("value", vb);
else
throw new IllegalStateException("The value for �value� must be a ValueBinding.");
if (actionListener != null)
if (isValueReference(actionListener))
ValueBinding vb = Util.getValueBinding(actionListener);
specialBtnComponent.setValueBinding("actionListener", vb);
else
throw new IllegalStateException("The value for �actionListener� must be a ValueBinding.");
public void release()
super.release();
value = null;
actionListener = null;
public void setValue(String value)
this.value = value;
public String getValue()
return this.value;
public void setActionListener(String actionListener)
this.actionListener = actionListener;
public String getActionListener()
return this.actionListener;
jsp1.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://jsfcustomcomponent/" prefix="j"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<link rel="stylesheet" type="text/css" href="./stylesheet.css" title="Style">
</head>
<body>
<f:view>
<h:form id="form01">
<h:outputText value="test special button with action listener"/>
<j:specialBtnTag value="#{specialBtnBacking.specialBtnValue}" actionListener="#{specialBtnBacking.specialBtnActionListener}"/>
<h:messages/>
<h:outputText value="#{specialBtnBacking.outcome}"/>
</h:form>
</f:view>
</body>
</html>
SpecialBtnBacking
package specialbtn;
import javax.faces.context.*;
import javax.faces.event.*;
public class SpecialBtnBacking
private FacesContext context;
public SpecialBtnBacking()
this.setSpecialBtnValue("Special Button with action listener");
private String specialBtnValue;
public String getSpecialBtnValue()
return this.specialBtnValue;
public void setSpecialBtnValue(String specialBtnValue)
this.specialBtnValue = specialBtnValue;
private String outcome="actionlistener NOT invoked: click specialBtn above to test";
public String getOutcome()
return outcome;
public void setOutcome(String outcome)
this.outcome = outcome;
public void specialBtnActionListener(ActionEvent evt)
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Jsp1Backing/specialBtnActionListener()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
this.outcome="***action listener invoked!!!***";
faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<managed-bean>
<managed-bean-name>specialBtnBacking</managed-bean-name>
<managed-bean-class>specialbtn.SpecialBtnBacking</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<component>
<component-type>SpecialBtnComponent</component-type>
<component-class>jsfcustomcomponent.SpecialBtnComponent</component-class>
<component-extension>
<renderer-type>SpecialBtnRenderer</renderer-type>
</component-extension>
</component>
<render-kit>
<renderer>
<component-family>SpecialBtnComponent</component-family>
<renderer-type>SpecialBtnRenderer</renderer-type>
<renderer-class>jsfcustomcomponent.SpecialBtnRenderer</renderer-class>
</renderer>
</render-kit>
</faces-config>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<display-name>pagerWEB</display-name>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<jsp-config>
<taglib>
<taglib-uri>http://jsfcustomcomponent/</taglib-uri>
<taglib-location>/WEB-INF/jsfcustomcomponent.tld</taglib-location>
</taglib>
</jsp-config>
<servlet>
<description>Added by JBuilder to compile JSPs with debug info</description>
<servlet-name>debugjsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>classdebuginfo</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>debugjsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
</web-app>got it working....
The changes were:
in "SpecialBtnRenderer"...
--new--
mb.invoke(context, new Object[1]);
--old--
mb.invoke(context, new Object[0]);
in "SpecialBtnTag"...
--new--
import javax.faces.event.ActionEvent;
--new--
MethodBinding mb = FacesContext.getCurrentInstance().getApplication().createMethodBinding(specialBtnListener, new Class[]{ActionEvent.class});
--old--
MethodBinding mb = FacesContext.getCurrentInstance().getApplication().createMethodBinding(specialBtnListener, null);
-Below is the entire application, again -- for those (like myself) who need concrete examples...
I hope this helps someone else! --f
jsp1.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://jsfcustomcomponent/" prefix="j"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<link rel="stylesheet" type="text/css" href="./stylesheet.css" title="Style">
</head>
<body>
<f:view>
<h:messages/>
<h:form id="form01">
<h:outputText value="test special button with action listener"/>
<j:specialBtnTag value="#{specialBtnBacking.specialBtnValue}" specialBtnListener="#{specialBtnBacking.specialBtnActionListener}"/>
<h:outputText value="#{specialBtnBacking.outcome}"/>
</h:form>
</f:view>
</body>
</html>
SpecialBtnBacking
package specialbtn;
import javax.faces.context.*;
import javax.faces.event.*;
public class SpecialBtnBacking
private FacesContext context;
public SpecialBtnBacking()
this.setSpecialBtnValue("Special Button with action listener");
private String specialBtnValue;
public String getSpecialBtnValue()
return this.specialBtnValue;
public void setSpecialBtnValue(String specialBtnValue)
this.specialBtnValue = specialBtnValue;
private String outcome = "actionlistener NOT invoked: click specialBtn above to test";
public String getOutcome()
return outcome;
public void setOutcome(String outcome)
this.outcome = outcome;
public void specialBtnActionListener(ActionEvent evt)
System.out.println("\n\n");
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Jsp1Backing/specialBtnActionListener()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Jsp1Backing/specialBtnActionListener()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Jsp1Backing/specialBtnActionListener()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Jsp1Backing/specialBtnActionListener()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Jsp1Backing/specialBtnActionListener()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n");
this.outcome = "***action listener invoked!!!***";
jsfcustomcomponent.tld
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>0.01</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>jsfcustomcomponent</short-name>
<uri>http://jsfcustomcomponent/</uri>
<description><![CDATA[jsf custom component tags]]> </description>
<tag>
<name>specialBtnTag</name>
<tag-class>jsfcustomcomponent.SpecialBtnTag</tag-class>
<attribute>
<name>value</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[button value]]></description>
</attribute>
<attribute>
<name>specialBtnListener</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[action listener]]> </description>
</attribute>
</tag>
</taglib>
faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<managed-bean>
<managed-bean-name>specialBtnBacking</managed-bean-name>
<managed-bean-class>specialbtn.SpecialBtnBacking</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<component>
<component-type>SpecialBtnComponent</component-type>
<component-class>jsfcustomcomponent.SpecialBtnComponent</component-class>
<component-extension>
<renderer-type>SpecialBtnRenderer</renderer-type>
</component-extension>
</component>
<render-kit>
<renderer>
<component-family>SpecialBtnComponent</component-family>
<renderer-type>SpecialBtnRenderer</renderer-type>
<renderer-class>jsfcustomcomponent.SpecialBtnRenderer</renderer-class>
</renderer>
</render-kit>
</faces-config>
SpecialBtnComponent.java
package jsfcustomcomponent;
import javax.faces.component.*;
import javax.faces.context.*;
import javax.faces.el.*;
import javax.faces.event.*;
public class SpecialBtnComponent
extends UIComponentBase implements ActionSource
public static final String COMPONENT_TYPE = "SpecialBtnComponent";
public static final String RENDERER_TYPE = "SpecialBtnRenderer";
public String getFamily()
return COMPONENT_TYPE;
public SpecialBtnComponent()
super();
setRendererType(SpecialBtnComponent.RENDERER_TYPE);
private String value;
public void setValue(String value, FacesContext facesContext)
this.value = value;
public String getValue()
if (null != this.value)
return this.value;
ValueBinding _vb = getValueBinding("value");
if (_vb != null)
return (String) _vb.getValue(getFacesContext());
else
return null;
private MethodBinding specialBtnListener = null;
public MethodBinding getActionListener()
return (this.specialBtnListener);
public void setActionListener(MethodBinding actionListener)
this.specialBtnListener = actionListener;
public Object saveState(FacesContext context)
Object values[] = new Object[3];
values[0] = super.saveState(context);
values[1] = saveAttachedState(context, this.specialBtnListener);
values[2] = this.value;
return (values);
public void restoreState(FacesContext context, Object state)
Object values[] = (Object[]) state;
super.restoreState(context, values[0]);
this.specialBtnListener = (MethodBinding) restoreAttachedState(context, values[1]);
this.value = (String) restoreAttachedState(context, values[2]);
public void broadcast(FacesEvent event) throws AbortProcessingException
super.broadcast(event);
if (event instanceof ActionEvent)
FacesContext context = getFacesContext();
MethodBinding mb = this.getActionListener();
if (mb != null)
try
mb.invoke(context, new Object[]
{event});
catch (EvaluationException ex)
System.out.println("SpecialBtnComponent/broadcast(FacesEvent event)...EvaluationException encountered - ex.getMessage()=" + ex.getMessage());
ex.printStackTrace();
ActionListener actionListener = context.getApplication().getActionListener();
if (actionListener != null)
actionListener.processAction( (ActionEvent) event);
public void queueEvent(FacesEvent e)
if (e instanceof ActionEvent)
e.setPhaseId(PhaseId.INVOKE_APPLICATION);
super.queueEvent(e);
public MethodBinding getAction()
return null;
public void setAction(MethodBinding methodBinding)
public boolean isImmediate()
return false;
public void setImmediate(boolean _boolean)
public void addActionListener(ActionListener actionListener)
addFacesListener(actionListener);
public ActionListener[] getActionListeners()
return (ActionListener[]) getFacesListeners(ActionListener.class);
public void removeActionListener(ActionListener actionListener)
removeFacesListener(actionListener);
SpecialBtnTag.java
package jsfcustomcomponent;
import javax.faces.component.*;
import javax.faces.el.*;
import javax.faces.webapp.*;
import com.sun.faces.util.*;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
public class SpecialBtnTag
extends UIComponentTag
public String value = null;
public String specialBtnListener = null;
private SpecialBtnComponent specialBtnComponent;
public SpecialBtnTag()
super();
public String getComponentType()
return SpecialBtnComponent.COMPONENT_TYPE;
public String getRendererType()
return SpecialBtnComponent.RENDERER_TYPE;
protected void setProperties(UIComponent component)
super.setProperties(component);
if (! (component instanceof SpecialBtnComponent))
throw new IllegalStateException("Component " + component.toString() +
" not expected type. Expected: jsfcustomcomponent.SpecialBtnComponent. Perhaps you�re missing a tag?");
specialBtnComponent = (SpecialBtnComponent) component;
if (value != null)
if (isValueReference(value))
ValueBinding vb = Util.getValueBinding(value);
specialBtnComponent.setValueBinding("value", vb);
else
throw new IllegalStateException("The value for �value� must be a ValueBinding.");
if (specialBtnListener != null)
if (isValueReference(specialBtnListener))
MethodBinding mb = FacesContext.getCurrentInstance().getApplication().createMethodBinding(specialBtnListener, new Class[]{ActionEvent.class});
( (SpecialBtnComponent) component).setActionListener(mb);
else
MethodBinding mb = Util.createConstantMethodBinding(specialBtnListener);
( (SpecialBtnComponent) component).setActionListener(mb);
public void release()
super.release();
value = null;
specialBtnListener = null;
public void setValue(String value)
this.value = value;
public String getValue()
return this.value;
public void setSpecialBtnListener(String specialBtnListener)
this.specialBtnListener = specialBtnListener;
public String getSpecialBtnListener()
return this.specialBtnListener;
SpecialBtnRenderer
package jsfcustomcomponent;
import java.util.*;
import javax.faces.component.*;
import javax.faces.context.*;
import javax.faces.event.*;
import javax.faces.render.*;
import javax.faces.el.MethodBinding;
import javax.faces.el.*;
public class SpecialBtnRenderer
extends Renderer
String value;
public SpecialBtnRenderer()
super();
public void decode(FacesContext context, UIComponent component)
try
Map requestMap = context.getExternalContext().getRequestParameterMap();
String clientId = component.getClientId(context);
SpecialBtnComponent specialBtnComponent = (SpecialBtnComponent) component;
String value = (String) requestMap.get(clientId);
if (null != value)
specialBtnComponent.setValue(value, context);
MethodBinding mb = specialBtnComponent.getActionListener();
if (mb != null)
System.out.println("SpecialBtnRenderer/decode...mb.getExpressionString()=" + mb.getExpressionString());
//mb.invoke(context, new Object[0]);
mb.invoke(context, new Object[1]);
ActionEvent actionEvent = new ActionEvent(specialBtnComponent);
specialBtnComponent.queueEvent(actionEvent);
catch (EvaluationException ex)
ex.printStackTrace();
public void encodeEnd(FacesContext context, UIComponent component) throws java.io.IOException
SpecialBtnComponent specialBtnComponent = (SpecialBtnComponent) component;
ResponseWriter writer = context.getResponseWriter();
String clientId = component.getClientId(context);
value = (String) component.getAttributes().get("value");
if (value == null)
value = "defaultValue";
buildSpecialBtn(writer, value, clientId, specialBtnComponent);
private void buildSpecialBtn(ResponseWriter writer, String value, String clientId, SpecialBtnComponent component) throws java.io.IOException
writer.startElement("table", component);
writer.startElement("tbody", component);
writer.startElement("tr", component);
writer.startElement("td", component);
value = String.valueOf(value);
writer.startElement("input", component);
writer.writeAttribute("type", "submit", null);
writer.writeAttribute("name", clientId, "clientId");
writer.writeAttribute("value", value, null);
writer.endElement("input");
writer.endElement("td");
writer.endElement("tr");
writer.endElement("tbody");
writer.endElement("table");
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<display-name>pagerWEB</display-name>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<jsp-config>
<taglib>
<taglib-uri>http://jsfcustomcomponent/</taglib-uri>
<taglib-location>/WEB-INF/jsfcustomcomponent.tld</taglib-location>
</taglib>
</jsp-config>
</web-app> -
MDB listening to a Oracle AQ, holding ADT messages...
Hi !
I'm trying to set a MDB to listen for incoming messages on an Oracle AQ. When I created the queue, I specified that the queue should contain payload of type ADT. I'm using Bea Weblogic server 8.1 sp4 and Oracle 10.2.0. The creation of the connection to the queue is implemented as a start up class and bound to the context during server start up.
However it fails to start up, I get the following exception:
<20.mar.2007 kl 11.03 CET> <Warning> <EJB> <BEA-010061> <The Message-Driven EJB:
MyWebLogicMDB is unable to connect to the JMS destination: AQJMSQueue. The Erro
r was:
oracle.jms.AQjmsException: JMS-137: Innholdsfabrikk mÕ angis for mÕl med ADT-inn
hold
oracle.jms.AQjmsException: JMS-137: Innholdsfabrikk mÕ angis for mÕl med ADT-inn
hold
at oracle.jms.AQjmsError.throwEx(I)V(AQjmsError.java:288)
at oracle.jms.AQjmsConsumer.<init>(Loracle.jms.AQjmsSession;Ljavax.jms.D
estination;IILjava.lang.String;Ljava.lang.Object;Loracle.jms.AQjmsSelector;Ljava
.lang.String;Z)V(AQjmsConsumer.java:385)
at oracle.jms.AQjmsConsumer.<init>(Loracle.jms.AQjmsSession;Ljavax.jms.D
estination;IILjava.lang.String;Ljava.lang.Object;Loracle.jms.AQjmsSelector;Ljava
.lang.String;)V(AQjmsConsumer.java:254)
at oracle.jms.AQjmsSession.createReceiver(Ljavax.jms.Queue;Ljava.lang.St
ring;Ljava.lang.Object;)Ljavax.jms.QueueReceiver;(AQjmsSession.java:1631)
at oracle.jms.AQjmsSession.createReceiver(Ljavax.jms.Queue;Ljava.lang.St
ring;)Ljavax.jms.QueueReceiver;(AQjmsSession.java:1553)
at weblogic.ejb20.internal.JMSConnectionPoller.setUpQueueSessions(Ljavax
.jms.Destination;Ljava.lang.String;III)V(JMSConnectionPoller.java:1720)
at weblogic.ejb20.internal.JMSConnectionPoller.createJMSConnection()V(JM
SConnectionPoller.java:2019)
at weblogic.ejb20.internal.JMSConnectionPoller.connectToJMS()V(JMSConnec
tionPoller.java:1180)
at weblogic.ejb20.internal.JMSConnectionPoller.startJMSConnectionPolling
()V(JMSConnectionPoller.java:846)
at weblogic.ejb20.deployer.MessageDrivenBeanPoolInfoImpl.start()V(Messag
eDrivenBeanPoolInfoImpl.java:234)
at weblogic.ejb20.deployer.EJBDeployer.deployMessageDrivenBeans()V(EJBDe
ployer.java:1660)
at weblogic.ejb20.deployer.EJBDeployer.start(Z)V(EJBDeployer.java:1488)
at weblogic.ejb20.deployer.EJBModule.start()V(EJBModule.java:689)
at weblogic.j2ee.J2EEApplicationContainer.start([Lweblogic.j2ee.J2EEAppl
icationContainer$Component;)V(J2EEApplicationContainer.java:2127)
at weblogic.j2ee.J2EEApplicationContainer.activate([Lweblogic.management
.configuration.ComponentMBean;)V(J2EEApplicationContainer.java:2168)
at weblogic.j2ee.J2EEApplicationContainer.activate()V(J2EEApplicationCon
tainer.java:2115)
at weblogic.management.deploy.slave.SlaveDeployer$Application.setActivat
ion(Z)V(SlaveDeployer.java:3082)
at weblogic.management.deploy.slave.SlaveDeployer.setActivationStateForA
llApplications(ZZ)V(SlaveDeployer.java:1751)
at weblogic.management.deploy.slave.SlaveDeployer.resume()V(SlaveDeploye
r.java:359)
at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.resum
e()V(DeploymentManagerServerLifeCycleImpl.java:229)
at weblogic.t3.srvr.SubsystemManager.resume()V(SubsystemManager.java:131
at weblogic.t3.srvr.T3Srvr.resume()V(T3Srvr.java:966)
at weblogic.t3.srvr.T3Srvr.run([Ljava.lang.String;)I(T3Srvr.java:361)
at weblogic.Server.main([Ljava.lang.String;)V(Server.java:32)
>
The problem is that the MDB cannot be set up to dequeue the message because the payload factory has to be set for the consumer in order to receive messages from queues which have messages with ADT payload.
So my questions are:
1) Is there a way to set the payload factory to use in the MDB? (deployment desc.)
2) Do MDB support AdtMessages?
3) Are there any other ways to listen to an Oracle queue which has ADT type?
mvh
jbHi,
I'm also having the same identical problem with an EJB 3.0 MDB listening to an AQ queue (via OJMS) with a payload type of ADT. I can successfully dequeue messages from a queue with a JMS payload type, but as soon as I point it to and ADT type queue I get:
oracle.jms.AQjmsException: JMS-137: Payload factory must be specified for destinations with ADT payloads
I can't however seem to find anything in the Oracle documentation that shows how to do this, and which class corresponds to this "payload factory".
The following link seems to suggest that OJMS supports ADT types in addition to the standard JMS message types:
http://www.oracle.com/technology/tech/java/oc4j/904/collateral/OC4J-FAQ-JMS-904.html
although I'm not sure if this is true for Message Driven Beans.
Could you please confirm whether MDB's support ADT message types?
Many thanks
Phil -
Startup tasks won't work in startup class
Hi,
I need to do some work at system startup and shutdown that
doesn't quite fit the WLS startup/shutdown model. In both cases,
I need to talk to the WLS web server but it's not listening until
after the startup classes are run and stops listening before the
shutdown classes are run.
I'm thinking about using a servlet init() for my one-shot startup
but don't know how robust a solution that is. And I don't know
what to do about shutdown. Is there a startup/shutdown hook
associated with container loading/unloading? Some other solution?
I'm using WLS 6.1 SP2.
Thanks, GarryGarry <[email protected]> wrote:
Hi,
I need to do some work at system startup and shutdown that
doesn't quite fit the WLS startup/shutdown model. In both cases,
I need to talk to the WLS web server but it's not listening until
after the startup classes are run and stops listening before the
shutdown classes are run.
I'm thinking about using a servlet init() for my one-shot startup
but don't know how robust a solution that is. And I don't know
what to do about shutdown. Is there a startup/shutdown hook
associated with container loading/unloading? Some other solution?If you do not like the fact that you are using servlet to perform
startup/shutdown tasks, you can use ServletContextListener instead.
Using one of those is definitely better than startup classes.
I'm using WLS 6.1 SP2.
Thanks, Garry--
Dimitri -
Clustering of startup classes in WebLogic
Hi
WE have an application running as startup class in WLS 6.1 . I want to know
how this class can be deployed in clustered environment. Iam pretty ne to clustering
. Can some body help me out ?.
Thanks in advance,
S Gopikrishna
I don't know what you mean.
If you want each instance of your app to be running something, you should
use a load-on-startup Servlet with its init() method instead of a startup
class.
If you want each instance of a server (not each instance of your app, since
an app can be loaded multiple times on a server) to be running something,
you should use a startup class.
If you want exactly one instance in a cluster to be running something ...
well, good luck. There's no guarantees in this regard, but the easiest way
is to pin it to one server and make sure that that server never goes down
because it is a single point of failure.
Peace,
Cameron Purdy
Tangosol, Inc.
Clustering Weblogic? You're either using Coherence, or you should be!
Download a Tangosol Coherence eval today at http://www.tangosol.com/
"S Gopikrishna" <[email protected]> wrote in message
news:[email protected]...
>
> Hi
>
> Thanks a lot for the reply. My startup class listens continously on a
queue.
> I need to know whether my startup class will also be clustered just like
EJB.
> If not what is the altrnative.
>
> Regards,
> S Gopikrishna
>
>
>
>
> "Cameron Purdy" <[email protected]> wrote:
> >When you have a startup class in a cluster, each server will run that
> >startup class one time. In other words, it always runs once per server.
> >
> >Peace,
> >
> >--
> >Cameron Purdy
> >Tangosol, Inc.
> >Clustering Weblogic? You're either using Coherence, or you should be!
> >Download a Tangosol Coherence eval today at http://www.tangosol.com/
> >
> >
> >
> >"S Gopikrishna" <[email protected]> wrote in message
> >news:[email protected]...
> >>
> >> Hi
> >> WE have an application running as startup class in WLS 6.1 . I
> >want
> >to know
> >> how this class can be deployed in clustered environment. Iam pretty
> >ne to
> >clustering
> >> Can some body help me out ?.
> >>
> >> Thanks in advance,
> >> S Gopikrishna
> >
> >
>
-
Startup class not found if included in a jar inside the ear
I have written a startup class, i have packed it in a jar file(along with some
other classes). This jar is then packed in side an ear file.(This way i get one
single distribution file). I have added the startup class in the config.xml using
weblogic console.But at start up weblogic is unable to find the class. How to
tell weblogic about the location of the class(classpath) which is inside the ear
file. Error i get is as follows
<Aug 21, 2003 8:07:23 PM IST> <Emergency> <WebLogicServer> <BEA-000342> <Unable
to initialize the server: weblogic.t3. srvr.FatalStartupException: Can't start
server due to startup class failure WISORCODES_SERVER - with nested exception:
[java.lang.ClassNotFoundException: com.wisor.common.wisorcodes.rmi.WisorCodesServer]>
*************************************************************************** The
WebLogic Server did not start up properly. Exception raised: 'weblogic.t3.srvr.FatalStartupException:
Can't start server due to startup class failure WISORCODES_ SERVER - with nested
exception: [java.lang.ClassNotFoundException: com.wisor.common.wisorcodes.rmi.WisorCodesServer]'
Reason: weblogic.t3.srvr.FatalStartupException: Can't start server due to startup
class failure WISORCODES_SERVER - wi th nested exception: [java.lang.ClassNotFoundException:
com.wisor.common.wisorcodes.rmi.WisorCodesServer] ***************************************************************************Shirish:
Classes that are scoped in the application are only visible within the
application, not to the system classloader.
If you want to have startup classses scoped inside an EAR then you need to
use Application lifecycle listeners to actually activate these startup
classes. Application lifecycle listeners are a replacement for startup
classes.
You can check out an example of this in 8.1:
$BEA_HOME/weblogic81/samples/server/examples/src/examples/splitdir/helloWorl
dEar
Docs for it are:
$BEA_HOME\weblogic81\samples\server\examples\src\examples\splitdir\helloWorl
dEar\javadoc\index.html
Check out:
$BEA_HOME\weblogic81\samples\server\examples\src\examples\splitdir\helloWorl
dEar\META-INF\weblogic-applcation.xml
<weblogic-application>
<listener>
<listener-class>examples.splitdir.hello.startup.ApplicationStartup</listener
-class>
</listener>
</weblogic-application>
and
$BEA_HOME\weblogic81\samples\server\examples\src\examples\splitdir\helloWorl
dEar
/appStartup/examples/splitdir/hello/startup/ApplicationStartup.java
Now if you have a "startup class" that needs to be accessible for the entire
Server for a set of applications, I suggest just writing a single EAR with a
dummy web-app (I think you may need a dummy module) and an applicaiton
lifecycle listener, and have this EAR deploy before any other apps.
Cheers
mbg
"Shirish" <[email protected]> wrote in message
news:[email protected]...
>
I have written a startup class, i have packed it in a jar file(along withsome
other classes). This jar is then packed in side an ear file.(This way iget one
single distribution file). I have added the startup class in theconfig.xml using
weblogic console.But at start up weblogic is unable to find the class. Howto
tell weblogic about the location of the class(classpath) which is insidethe ear
file. Error i get is as follows
<Aug 21, 2003 8:07:23 PM IST> <Emergency> <WebLogicServer> <BEA-000342><Unable
to initialize the server: weblogic.t3. srvr.FatalStartupException: Can'tstart
server due to startup class failure WISORCODES_SERVER - with nestedexception:
>
>
[java.lang.ClassNotFoundException:com.wisor.common.wisorcodes.rmi.WisorCodesServer]>
>
The
WebLogic Server did not start up properly. Exception raised:'weblogic.t3.srvr.FatalStartupException:
Can't start server due to startup class failure WISORCODES_ SERVER - withnested
exception: [java.lang.ClassNotFoundException:com.wisor.common.wisorcodes.rmi.WisorCodesServer]'
Reason: weblogic.t3.srvr.FatalStartupException: Can't start server due tostartup
class failure WISORCODES_SERVER - wi th nested exception:[java.lang.ClassNotFoundException:
com.wisor.common.wisorcodes.rmi.WisorCodesServer]***************************************************************************
>
>
>
>
>
>
>
>
>
>
>
Maybe you are looking for
-
Senior Developer, Maryland
Senior Integration/Software Engineer Position We have an immediate need for innovative, results-oriented people that desire a challenging, fast-paced environment in which to apply their skills. The ideal candidate is highly motivated and possesses a
-
Sent mail mailbox not created with IMAP account
Hello, I have an old PBG4 running Tiger that i use as a shop/travel/etc. 2nd mac. I have 4 mail accounts. I set them up ( successfully) all the time on various macs and windows machines. But now something's changed... 3 of my accounts are fine. The
-
CAN YOU PURCHASE ITUNES MATCH USING AN ITUNES VOUCHER CREDIT?
can you purchase/subscribe to itunes match using itunes voucher credit?
-
500 Internal Server Error (OAF) : The base exception is:Exception creating
I'm facing below issue while setup of Jdev. Downloaded version from metalink : p7523554_R12_GENERIC / Application Version : 12.0.6 Pls suggest. 500 Internal Server Error oracle.apps.fnd.cache.CacheException at oracle.apps.fnd.cache.AppsCache.get(Apps
-
Transport Groups: One Technical System targets two technical systems
Hi guys, One question relating to transport groups. Is it possible to define for one technical system which belongs to one group, let's say DEV, two target Business Systems which belong to another group, let's say PRD? Meaning, Technical System XPTO