clement valentine

Greenhorn
+ Follow
since Apr 04, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by clement valentine

Hi guys,
Iam not using the Sun's FSContext but the Sonic's jndi. I have added the following sonic jars to the wls classpath:
------------------------------------------------------=--------
@rem Add the Sonic JMS Provider
set SONICMQ_LIB=<SONIC_HOME>\lib
set SONICMQ_CLASSPATH=%SONICMQ_LIB%\mfcontext.jar;%SONICMQ_LIB%\sonic_Client.jar;%SONICMQ_LIB%\sonic_ASPI.jar;%SONICMQ_LIB%\sonic_XA.jar;%SONICMQ_LIB%\sonic_Selector.jar;%SONICMQ_LIB%\sonic_Crypto.jar;%SONICMQ_LIB%\jndi.jar
set WEBLOGIC_CLASSPATH=%WEBLOGIC_CLASSPATH%;%SONICMQ_CLASSPATH%
-----------------------------------------------------------------

This is my foreign JMS server configuration in WLS console
------------------------------------------------------------
Name: WLSSONIC
JNDI Initial Context Factory: com.sonicsw.jndi.mfcontext.MFContextFactory
JNDI Provider URL: tcp://localhost:2506
JNDI Properties:
com.sonicsw.jndi.mfcontext.idleTimeout=6000
com.sonicsw.jndi.mfcontext.domain=Domain1
java.naming.security.principal=Administrator
java.naming.security.credentials=Administrator
--------------------------------------------------

This is the snippet from WLS config.xml
------------------------------------------
<code>
<ForeignJMSServer ConnectionURL="tcp://localhost:2506"
InitialContextFactory="com.sonicsw.jndi.mfcontext.MFContextFactory"
JNDIProperties="java.naming.provider.url=tcp://localhost:2506;java.naming.factory.initial=com.sonicsw.jndi.mfcontext.MFContextFactory;com.sonicsw.jndi.mfcontext.idleTimeout=6000;com.sonicsw.jndi.mfcontext.domain=Domain1 java.naming.security.principal=Administrator java.naming.security.credentials=Administrator" Name="WLSSONIC">
<ForeignJMSConnectionFactory LocalJNDIName="jms/QCF"
Name="SonicMQQueueConnectionFactory"
PasswordEncrypted="{3DES}O26K63V7o0pOryfotUFNpA=="
RemoteJNDIName="SonicMQQueueConnectionFactory" Username="Administrator"/>
<ForeignJMSDestination LocalJNDIName="jms/SampleQ1"
Name="SonicMQSampleQ1" RemoteJNDIName="SonicMQSampleQ1"/>
</ForeignJMSServer>
</code>

---------------------------------------------------------------------


Thanks guys
Hello all,
Iam trying to get an MDB on WLS to listen to a Sonic MQ installation. Iam using Sonic's built in JNDI and have made the necessary setting under Foreign JMS server under Weblogic console (I followed the code share available on Sonic's site!). But the MDB always starts with the following warning and does not listen to the Q.

<Jan 9, 2006 11:47:07 PM CST> <Warning> <EJB> <BEA-010061> <The Message-Driven EJB: SonicMDB is unable to connect to the JMS destination: jms/SampleQ1. The Error was:
[EJB:011010]The JMS destination with the JNDI name: jms/SampleQ1 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.>

This is my weblogic-ejb-jar.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN" "http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd">
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>SonicMDB</ejb-name>
<message-driven-descriptor>
<pool>
<max-beans-in-free-pool>2</max-beans-in-free-pool>
<initial-beans-in-free-pool>1</initial-beans-in-free-pool>
</pool>
<destination-jndi-name>jms/SampleQ1</destination-jndi-name>
<initial-context-factory>weblogic.jndi.WLInitialContextFactory</initial-context-factory>
<provider-url>t3://localhost:7001</provider-url>;
<connection-factory-jndi-name>jms/QCF</connection-factory-jndi-name>
</message-driven-descriptor>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>


I have configured the jndi name for the destination and connection factory correctly under the console.. Is there a bug with WLS 8.1 SP4?

Thanks guys
Hi guys,
It worked when I set "transacted" to false.

Old ---> QueueSession qsession = qconnect.createQueueSession(true,0);
New ---> QueueSession qsession = qconnect.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);

Also I realised that Session.AUTO_ACKNOWLEDGE is 1 and not 0! For that matter I can't find out what the static value '0' is in the javax.jms.Session API. Does '0' mean NO_ACKNOWLEDGEMENT?

According to the WLS doc. when "transacted" the ackowledge value is ignored. But somehow this didn't seem to work. Can anyone explain that for me please?

Whats the effect of setting the "transacted" to false? Does it mean that a rollback is not possible if anything down the line fails?

Thanks guys,
Clement
[ January 19, 2005: Message edited by: clement valentine ]
Hello all,
Iam testing a simple application using MDB in Weblogic 8.1 but the onMessage() method never gets triggered when messages arrive on the queue!.
This is the gist of things : A session bean writes to the queue and an MDB should receive the message and do a database insert by calling the create method on a CMP.

These are my descriptors:

<ejb-jar>.xml
---------------------------------------------------------
.....
<message-driven>
<display-name>CustomerMDB</display-name>
<ejb-name>CustomerMDB</ejb-name>
<ejb-class>autofactory.CustomerMDBBean</ejb-class>
<transaction-type>Container</transaction-type>
<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
</message-driven-destination>
</message-driven>
.......
-------------------------------------------------------------
weblogic-ejb-jar.xml

<weblogic-enterprise-bean>
<ejb-name>CustomerMDB</ejb-name>
<message-driven-descriptor>
<pool>
<max-beans-in-free-pool>20</max-beans-in-free-pool>
<initial-beans-in-free-pool>5</initial-beans-in-free-pool>
</pool>
<destination-jndi-name>queue/Autoshop</destination-jndi-name> ;
</message-driven-descriptor>
</weblogic-enterprise-bean>

-------------------------------------------------------------------

This is a portion of my config.xml for the weblogic server showing the JMS setup.

config.xml (weblogic)

<JMSConnectionFactory JNDIName="jms/Autoshop" Name="AutoshopFactory"
Targets="myserver" XAConnectionFactoryEnabled="true"/>
<JMSServer Name="JMSClemDEV" PagingStore="" Store="Ejb20Store" Targets="myserver">
<JMSTopic CreationTime="1105766985348" JNDIName="topic/Autoshop"
JNDINameReplicated="false" Name="TopicAutoshop"/>
<JMSQueue CreationTime="1105775501794"
ErrorDestination="ErrorQueue" ExpirationPolicy="Redirect"
JNDIName="queue/Autoshop" JNDINameReplicated="false" Name="QueueAutoshop"/>
<JMSQueue CreationTime="1106043185507" JNDIName="queue/ErrorQ"
JNDINameReplicated="false" Name="ErrorQueue"/>
</JMSServer>
<JMSFileStore Directory="ejb20filestore" Name="Ejb20Store"/>
------------------------------------------------------------------------------- ------------------


The queue that Iam writing to is "queue/Autoshop". The queue uses a persistent filestore and I can see that the file contains the messages. But when I check the console it show "MESSAGE_PENDING" = 0 and "MESSAGES" = 0!
I have some 'println' in onMessage(), but they never get printed!!..The MDB just doesn't listen to the destination!!!

Here is my onMessage() method:




Here is the code from the session bean that writes to the queue:




The QueueConnectionFactory is XA enabled..

Thanks guys,
CLement
I would do it outside the application (using sql) if there is not much transformation/business rules in moving from one table to another.
eg insert into A select * from B
Hello all,
Iam running oracle8i 8.1.7 on Redhat v8. The default shell for my ORACLE user account is bash and has to be changed to korn shell. Oracle jdbc access doesn't work anymore from korn shell. I tried running a simple application from the linux box to query the database and it comes up with o3Logon security exception. When i change back to bash everything is fine! Any ideas folks??
TIA
Clement
Hello all,
Is it possible to use stored procedures in a CMP ejb? The primary keys for our database tables are encoded and timestamp generated using stored procs. It would be very handy if we could somehow use stored procs. instead of the container generated jdbc calls. Are there any resources available on this?
Thanks a lot
Cheers
Hi guys,
I changed the relationship to bidirectional and called the setDept() accessor method from within the ejbPostCreate() and it worked.
ALternatively changing the relationship to one-to-one (unidirectional) from EMP to DEPT also works. So its just a matter of getting the business relationship right.
Thanks a lot!!
Hi,
Thanks for the reply. So you are suggesting the relationship to be bidirectional. I will give it a try.
Thanks
Hello all,
Iam in the process of moving to EJB 2 from EJB 1.1 and I have a question regarding the ejbCreate() method.
Lets say I have 2 database tables DEPT and EMP:
1) DEPT (DEPTNO primary key, DNAME, LOCATION)
2) EMP (EMPNO primary key, ENAME, ADDRESS, DEPTNO foreign key NOT NULL)
I have a one-to-many unidirectional relationship from DEPT--->EMP. These are my abstract accessor methods in DeptEJB:
1) get/set deptNo
1) get/set dname
2) get/set location
3) getEmployees / setEmployees (takes and returns a collection object)

My question is how do I create an EMP?
I tried the following steps.
1) findByPrimarykey the dept.
2) call create on EmpEJB (returns local interface)
3) call a business method in DeptEJB that calls the getEmployees and then setEmployees.
This works fine if the foreign key is declared NULLABLE!..But in case of NOT NULLS, the ejbCreate in step 2 fails. So how can I insert a EMP?
TIA
Thanks guys.. It slipped my mind that findAll() returns proxy to the bean implementation. Works fine now...
Hello all,
I have a BMP ejb with a findAll method returning a collection. I have put in a test code in this EJB which displays the object type in the collection.
---------------------------------------in EJB----------------------------------------------------------------
Collection result; //this is the return value from findAll
Iterator itr = result.iterator();
Vector v;
while (itr.hasNext() ) {
Object o = itr.next();
System.out.println("class is =" + o.getClass().getName()); //prints java.util.Vector
v = (Vector) o;
}
--------------------------------------------------------------------------------------------------------------------
The object type is Vector , so everything is fine in the ejb.
The client to this ejb is a session EJB which contains the following code snippet.
----------------------------------------client session EJB------------------------------------------------
ctx = new InitialContext();
exphome = (ExpenseHome) ctx.lookup("ejb/Expense");
Collection result = exphome.findByAll(........)
Iterator itr = result.iterator();
Vector v;
Object o;
while (itr.hasNext() ) {
o = itr.next();
System.out.println("class is =" + o.getClass().getName()); //prints $Proxy87 ???
v = (Vector) o;
}
----------------------------------------------------------------------------------------------------------------------------------------------
I don't have any clue why i get this proxy problem?..Can anyone help me out please..First I thought that there was mismatch of stubs, but the problem exists even after installing the application completely.
This is the complete stacktrace.
---------------------------------------------------------------------------------------------------------------------
java.lang.ClassCastException: $Proxy87
at project.expense.servlet.SearchExpResult.doGet(SearchExpResult.java:60
)
at project.expense.servlet.SearchExpResult.doPost(SearchExpResult.java:1
04)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:200)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispat
cherImpl.java:215)
at weblogic.servlet.jsp.PageContextImpl.forward(PageContextImpl.java:112
)
at jsp_servlet.__searchexpform._jspService(__searchexpform.java:193)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2456)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2039)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
-----------------------------------------------------------------------------------------------------------------------------
TIA
Gotcha!!...I was using a field named 'COMMENT' in the table which seems to be an oracle keyword..Everything works fine after I changed it. Strange though how it allowed me to create one in the first place...Thanks a lot all you folks!!
Hi again,
Tried that one too without any luck. The "SCHEMA".Procedure_name occurs because of using some tool to create the SP logged in as another user with SYSDBA privilege. My doubt is at statement 20 (ORA-06512) of the proc. at the insertion of the 2 dates..Is there some problem with that?
I have even tried using oracle.sql.DATE and OracleCallableStatment with the same result..
Cheers