sairn dain

Greenhorn
+ Follow
since Apr 29, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by sairn dain

Hi All

I am creating a EJB 2.x MDB on a "Websphere Application Server 6.1 (aka, WAS61) using a Websphere MQ messaging provider (i.e., Websphere MQ 6.0)

I have created the connection factory, queue, and listener port.

However, I cannot seem to find an example of what the deployment descriptor should look like for such an MDB.
(Although, there are many many examples of what the deployment descriptor should look like for the "default messaging provider" using activation specifications, etc.)

From what I understand from reading the IBM RedBook "Websphere Application Server 6.1 Management and Configuration", I need no further configuration to the WAS61 server beyond the connection factory, queue, and listener port. -- Is my understanding correct???

Also, I understand that I must implement the MDB using the listener port artifact instead of the activation specification.
-- What does the ejb-jar.xml deployment descriptor entry for the MDB look like in this situation (clearly there is no activation-specification stuff)?

If someone possibly provide an example of a ejb-jar.xml deployment descriptor that is using MDB's that us a WebSphere MQ messaging provider (i.e., rather than the "default messaging provider"), it might be helpful.

Thanks for any help on this.

s
16 years ago
Hi
I'm trying to create a "CMP" example containing jsp, sessionbean (facade), and entity bean. (I'm using the Oracle example table "Emp")
The error message (shown below) appears to occur when the session bean trys to call the "findByPrimaryKey" method.
NOTE: "Unknown Source" provides me now clue very little information on what to look at/for in order to solve this issue. Can anyone give me an idea of what is causing the error message, below, and/or what kinds of issues could represented by the "Unknown Source" phrase? (what source is being referred to?)
Thanks for any hints/help?
sd
----(error message)----
C:\>httpd
Resin 2.1.11 (built Mon Sep 8 09:36:19 PDT 2003)
Copyright(c) 1998-2003 Caucho Technology. All rights reserved.
Starting Resin on Thu, 29 Apr 2004 15:05:20 -0400 (EDT)
[2004-04-29 15:05:21.937] initializing application http://localhost:8081/yyy
[2004-04-29 15:05:22.000] initializing application http://localhost:8081/zzz
[2004-04-29 15:05:22.015] initializing application http://localhost:8081/
[2004-04-29 15:05:22.015] initializing application http://localhost:8081/java_tut
http listening to *:8081
srun listening to 127.0.0.1:6802
java.lang.NullPointerException
at yyy.EmpFacadeBean.getEmpData(Unknown Source)
at _ejb.yyy.EmpFacadeBean__EJB$Remote.getEmpData(EmpFacadeBean__EJB.java:165)
at _ejb.yyy.EmpFacade__BurlapSkel._execute(EmpFacade__BurlapSkel.java:24)
at com.caucho.burlap.BurlapSkeleton._service(BurlapSkeleton.java:106)
at com.caucho.ejb.EJBServlet.service(EJBServlet.java:276)
at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:96)
at com.caucho.server.http.Invocation.service(Invocation.java:315)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246)
at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:164)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:534)
***(session/entity bean code, ejb-jar.ejb, and web-xml - below)***
----EmpFacadeBean----
package yyy;
import javax.ejb.*;
import java.util.*;
import java.math.*;
import javax.naming.*;
public class EmpFacadeBean implements SessionBean
{
SessionContext sessionContext;
public void ejbCreate() throws CreateException {
/**@todo Complete this method*/
}
public void ejbRemove()
{
/**@todo Complete this method*/
}
public void ejbActivate()
{
/**@todo Complete this method*/
}
public void ejbPassivate()
{
/**@todo Complete this method*/
}
public void setSessionContext(SessionContext sessionContext)
{
this.sessionContext = sessionContext;
}
public java.util.Collection getEmpData(String x)
{
ArrayList list = new ArrayList();
try
{
Context ic = new InitialContext();
EmpHome empHome = ( EmpHome ) ic.lookup( "Emp" );
BigDecimal b = new BigDecimal(x);
EmpPK empNo = new EmpPK(b);
//ERROR OCCURS HERE!!!
Emp emp = empHome.findByPrimaryKey( empNo );
list = new ArrayList();
list.add(emp.getComm());
list.add(emp.getDeptno());
list.add(emp.getEmpno());
list.add(emp.getEname());
list.add(emp.getJob());
list.add(emp.getMgr());
list.add(emp.getSal());
}
catch ( FinderException fex )
{
fex.printStackTrace();
}
catch ( Exception ex )
{
ex.printStackTrace();
}
return (Collection) list;
}
}
----EmpBean----
package yyy;
import javax.ejb.*;
abstract public class EmpBean implements EntityBean
{
EntityContext entityContext;
public EmpPK ejbCreate(java.math.BigDecimal empno) throws CreateException {
setEmpno(empno);
return null;
}
public void ejbPostCreate(java.math.BigDecimal empno) throws CreateException {
/**@todo Complete this method*/
}
public void ejbRemove() throws RemoveException {
/**@todo Complete this method*/
}
public abstract void setEmpno(java.math.BigDecimal empno);
public abstract void setEname(java.lang.String ename);
public abstract void setJob(java.lang.String job);
public abstract void setMgr(java.math.BigDecimal mgr);
public abstract void setHiredate(java.sql.Date hiredate);
public abstract void setSal(java.math.BigDecimal sal);
public abstract void setComm(java.math.BigDecimal comm);
public abstract void setDeptno(java.math.BigDecimal deptno);
public abstract java.math.BigDecimal getEmpno();
public abstract java.lang.String getEname();
public abstract java.lang.String getJob();
public abstract java.math.BigDecimal getMgr();
public abstract java.sql.Date getHiredate();
public abstract java.math.BigDecimal getSal();
public abstract java.math.BigDecimal getComm();
public abstract java.math.BigDecimal getDeptno();
public void ejbLoad()
{
/**@todo Complete this method*/
}
public void ejbStore()
{
/**@todo Complete this method*/
}
public void ejbActivate()
{
/**@todo Complete this method*/
}
public void ejbPassivate()
{
/**@todo Complete this method*/
}
public void unsetEntityContext()
{
this.entityContext = null;
}
public void setEntityContext(EntityContext entityContext)
{
this.entityContext = entityContext;
}
}
---- web.xml ----
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<jndi-link>
<jndi-name>java:comp/env/ejb</jndi-name>
<jndi-factory>com.caucho.burlap.BurlapContextFactory</jndi-factory>
<init-param java.naming.provider.url="http://localhost:8081/yyy/burlap"/>
</jndi-link>

<servlet-mapping>
<url-pattern id='/burlap/*'/>
<servlet-name id='com.caucho.burlap.EJBServlet'/>
</servlet-mapping>
<resource-ref>
<res-ref-name id="java:comp/env/cmp"/>
<class-name id='com.caucho.ejb.EJBServer'/>
<init-param data-source='java:comp/env/jdbc/dustygdb'/>
</resource-ref>
</web-app>
----ejb-jar.ejb----
<?xml version="1.0" encoding="UTF-8"?>
<!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>
<session>
<display-name>EmpFacade</display-name>
<ejb-name>EmpFacade</ejb-name>
<home>yyy.EmpFacadeHome</home>
<remote>yyy.EmpFacade</remote>
<ejb-class>yyy.EmpFacadeBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
<entity>
<display-name>Emp</display-name>
<ejb-name>Emp</ejb-name>
<local-home>yyy.EmpHome</local-home>
<local>yyy.Emp</local>
<ejb-class>yyy.EmpBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>yyy.EmpPK</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Emp</abstract-schema-name>
<cmp-field>
<field-name>empno</field-name>
</cmp-field>
<cmp-field>
<field-name>ename</field-name>
</cmp-field>
<cmp-field>
<field-name>job</field-name>
</cmp-field>
<cmp-field>
<field-name>mgr</field-name>
</cmp-field>
<cmp-field>
<field-name>hiredate</field-name>
</cmp-field>
<cmp-field>
<field-name>sal</field-name>
</cmp-field>
<cmp-field>
<field-name>comm</field-name>
</cmp-field>
<cmp-field>
<field-name>deptno</field-name>
</cmp-field>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>Emp</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>EmpFacade</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>

**** I'm using resin-ee-2.1.11, and J2EE 1.4/J2SE 1.4.2