Reg. Field names in ejb-jar.xml (EJB CMP)
Hi,
I am using WAS 5.1 and EJB CMP 2.0.
I got a error while dealing with the database i.e ORACLE 8.The Scenario in detail,
I had a table X with filed names 'help' and 'sequence'. When i am generating Jar file using 'ejbdeploy', the name of the field names in Table.ddl changing automatically to 'help1' and 'sequence1'. Due to this i am not able to access data from database.
Why field names are changing? Are they keywords ? con't we have field names with the above names? If they are keywords tell me the document which contains these details?
Thanks in Advance.
According to the ejb-jar.xml dtd ejb-name, ejb-class, persistence-type, prim-key-class, reentrant are the required elements for an entity bean.
<!ELEMENT entity (description?, display-name?, small-icon?,
large-icon?, ejb-name, home?, remote?, local-home?,
local?, ejb-class, persistence-type, prim-key-class,
reentrant, cmp-version?, abstract-schema-name?,
cmp-field*, primkey-field?, env-entry*, ejb-ref*,
ejb-local-ref*, security-role-ref*, security-identity?,
resource-ref*, resource-env-ref*, query*)>
Similar Messages
-
What are the necessary elements in ejb-jar.xml with CMP entity bean
What are the necessary elements in ejb-jar.xml with CMP entity bean
Actually i am using webligic 8.1 and while deployment getting the error that
some elements r missing
Thanks
Anand PritamAccording to the ejb-jar.xml dtd ejb-name, ejb-class, persistence-type, prim-key-class, reentrant are the required elements for an entity bean.
<!ELEMENT entity (description?, display-name?, small-icon?,
large-icon?, ejb-name, home?, remote?, local-home?,
local?, ejb-class, persistence-type, prim-key-class,
reentrant, cmp-version?, abstract-schema-name?,
cmp-field*, primkey-field?, env-entry*, ejb-ref*,
ejb-local-ref*, security-role-ref*, security-identity?,
resource-ref*, resource-env-ref*, query*)> -
Ejb-jar.xml中的EJB QL和weblogic-cmp-rdbms-jar.xml中的WLQL
我想问一下,在ejb-jar.xml文件中用EJB QL查询语言定义了相应的EJB QL查询语句后,在weblogic-cmp-rdbms-jar.xml文件中还需不需要用wlql语言来定义相应的查询语句呀?
在Weblogic6.0中,如果你需要利用EJB2.0的EJBQL语言所不提供的
ORDERBY排序功能,那么这时候可以在weblogic-cmp-rdbms-jar.xml中用WLQL覆盖它,一般情况下,在ejb-jar.xml中声明一个EJBQL方法就可以了,WLQL可有可无。 -
i am getting a classcast exception.My Stateless and stateful session bean works
fine .. problem only with Entity bean. Please check these xml files and let me
know if i have missed anything.
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>
<entity>
<ejb-name>stores</ejb-name>
<home>Ejb.Stores.storesHome</home>
<remote>Ejb.Stores.storesRemote</remote>
<ejb-class>Ejb.Stores.storesBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>storesBean</abstract-schema-name>
<cmp-field>
<field-name>productId</field-name>
</cmp-field>
<cmp-field>
<field-name>descrip</field-name>
</cmp-field>
<cmp-field>
<field-name>price</field-name>
</cmp-field>
<primkey-field>productId</primkey-field>
<query>
<query-method>
<method-name>findPriceGreaterThan</method-name>
<method-params>
<method-param>double</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(a) FROM storesBean AS a WHERE a.price > ?1]]>
</ejb-ql>
</query>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>stores</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
------------- end of ejb-ar.xml---------------------
weblogic-jar.xml
<?xml version="1.0"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB//EN"
"http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd" >
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>stores</ejb-name>
<entity-descriptor>
<persistence>
<persistence-type>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
</persistence-type>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
</persistence-use>
</persistence>
</entity-descriptor>
<jndi-name>storesEntity</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
------------- end of weblogic-jar.xml----------
weblogic-cmp-rdbms-jar.xml
<!DOCTYPE weblogic-rdbms-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 6.0.0
EJB RDBMS Persistence//EN' 'http://www.bea.com/servers/wls600/dtd/weblogic-rdbms20-persistence-600.dtd'>
<weblogic-rdbms-jar>
<weblogic-rdbms-bean>
<ejb-name>stores</ejb-name>
<data-source-name>sqlTX</data-source-name>
<table-name>ProductEJBTable</table-name>
<field-map>
<cmp-field>productId</cmp-field>
<dbms-column>productId</dbms-column>
</field-map>
<field-map>
<cmp-field>descrip</cmp-field>
<dbms-column>descrip</dbms-column>
</field-map>
<field-map>
<cmp-field>price</cmp-field>
<dbms-column>price</dbms-column>
</field-map>
</weblogic-rdbms-bean>
<create-default-dbms-tables>false</create-default-dbms-tables>
</weblogic-rdbms-jar>
---------------- end of weblogic-cmp-rdbms-jar.xml----------
Do i have to mention the connection Pool name anywhere .. My connection Pool name
is sql7Pool and my datasource name which i have mentioned is sqlTx. I am using
Sql server 7. I am deploying a jar file(not a war file) and accessng the EJB through
a Servlet. Please any help would definitely be appreciated.
Cheers
Ashish.I thought you were getting a class cast exception but the stack trace shows
a NullPointerException on line 38 of your servlet code. I am not sure if the
code that you have attached is the complete code or just snippets of your
complete code. Anyways, counting 38 lines in the code you attached points to
the line "mr =
mh.create(request.getParameter("login"),request.getParameter("name"));"
which could be because "mh" is null. Can you verify "mh" is not null and
also "objRef" is not null.
Attaching the stack trace for ClassCastException would be useful.
-- Anand
"Ashish Suvarna" <[email protected]> wrote in message
news:[email protected]...
>
Hey Anand,
Thanks for your reply. I have attached the StackTrace,Servlet code andmy
location and settings of my servlet .
This is the StackTrace which i get :
pl.java:265)
atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:200)
atweblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2495)
atweblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
before create
java.lang.NullPointerException
at trialweblogic.webServlet.doGet(webServlet.java:38)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:265)
atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:200)
atweblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2495)
atweblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
-------------- end of StackTrace---------------------
My Servlet Code is
package trialweblogic;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.sql.*;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.ejb.ObjectNotFoundException;
import javax.ejb.DuplicateKeyException;
import javax.ejb.EJBException;
import java.rmi.RemoteException;
import java.rmi.Remote;
import trialweblogic.*;
public class webServlet extends HttpServlet {
masterHome mh;
masterRemote mr;
OutputStream out;
private static final String CONTENT_TYPE = "text/html";
public void init(ServletConfig config) throws ServletException {
super.init(config);
public void doGet(HttpServletRequest request, HttpServletResponseresponse)
throws ServletException, IOException {
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
// out = response.getOutputStream();
try{
InitialContext ic = new InitialContext();
Object objRef = ic.lookup("masterBeanJNDI");
mh =(masterHome)PortableRemoteObject.narrow(objRef,masterHome.class);
>
mr =mh.create(request.getParameter("login"),request.getParameter("name"));
out.println("after create");
}catch(Exception ex){
ex.printStackTrace();
public void destroy() {
--------- end of servlet--------------
I am using Weblogic 6.1. I have included the following in my web.xml filewhich
is located atC:\bea\wlserver6.1\config\examples\applications\examplesWebApp\WEB-INF
>
>
<servlet>
<servlet-name>webServlet</servlet-name>
<servlet-class>trialweblogic.webServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>webServlet</servlet-name>
<url-pattern>/webServlet/*</url-pattern>
</servlet-mapping>
My Servlet is located atC:\bea\wlserver6.1\config\examples\applications\examplesWebApp\WEB-INF\class
es\trialweblogic\
folder. In this folder i also have the supporting files (home,remote &bean tooo).
>
>
I call this servlet when te user submits the info from a JSP page.
Hope this info helps in solving my problem. Do i have to mention theconnection
Pool name anywhere in the xml descriptor or am i missing anything here. iguess
Connection Pool name is not required since we are mentioning the JNDI namein
the xml descriptor. Bye for now.Awaiting your reply.
Cheers
Ashish.
"Anand Byrappagari" <[email protected]> wrote:
It is unlikely that your xml descriptors can cause class cast exceptions.
How did you install the servlet? Can you attach the servlet code that
might
help. Also complete stack trace of the exceptions would be helpful.
-- Anand
"Ashish Suvarna" <[email protected]> wrote in message
news:[email protected]...
Hi Anand,
Thanks for quic reply.Hey i am using weblogic6.1. I am Not usinga WAR
and
ear file.I have created a jar file and deployed it.now i have createda
servlet
to access entity bean.Is a war file neccessary for accesing an entitybean
through
Servlet or JSP ???I am using sql server 7. The error that it givesis -----
java.lang.ClassCastException: Cannot narrow remote object<br>
"inside lookup method aaaaaaa" java.lang.NullPointerException. <br>
Hope to get ur reply soon. in another entity bean i am getting thiserror ---
java.lang.ClassCastException:
weblogic.jdbc.common.internal.RmiDataSource
.. I
can't understand wots this error. I feel i am missing something inmy xml
descriptor.
Bye for now.
Cheers
Ashish.
"Anand Byrappagari" <[email protected]> wrote:
Can you attach the stack trace for the exception? Also please describe
you
environment - are the war and jar files installed separately? Are
they
composed into a ear? Also when are you getting a classcast exception?
-- Anand
"Ashish Suvarna" <[email protected]> wrote in message
news:[email protected]...
i am getting a classcast exception.My Stateless and stateful sessionbean
works
fine .. problem only with Entity bean. Please check these xml filesand
let me
know if i have missed anything.
ejb-jar.xml
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD EnterpriseJavaBeans
2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<entity>
<ejb-name>stores</ejb-name>
<home>Ejb.Stores.storesHome</home>
<remote>Ejb.Stores.storesRemote</remote>
<ejb-class>Ejb.Stores.storesBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>storesBean</abstract-schema-name>
<cmp-field>
<field-name>productId</field-name>
</cmp-field>
<cmp-field>
<field-name>descrip</field-name>
</cmp-field>
<cmp-field>
<field-name>price</field-name>
</cmp-field>
<primkey-field>productId</primkey-field>
<query>
<query-method>
<method-name>findPriceGreaterThan</method-name>
<method-params>
<method-param>double</method-param>
</method-params>
</query-method>
<ejb-ql>
<![CDATA[SELECT OBJECT(a) FROM storesBean AS a WHERE
a.price> >> >>> >> >?1]>
</ejb-ql>
</query>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>stores</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
------------- end of ejb-ar.xml---------------------
weblogic-jar.xml
<?xml version="1.0"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD
WebLogic
6.0.0 EJB//EN"
"http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd" >
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>stores</ejb-name>
<entity-descriptor>
<persistence>
<persistence-type>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
</persistence-type>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
</persistence-use>
</persistence>
</entity-descriptor>
<jndi-name>storesEntity</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
------------- end of weblogic-jar.xml----------
weblogic-cmp-rdbms-jar.xml
<!DOCTYPE weblogic-rdbms-jar PUBLIC '-//BEA Systems, Inc.//DTD
WebLogic
6.0.0
EJB RDBMS Persistence//EN'
'http://www.bea.com/servers/wls600/dtd/weblogic-rdbms20-persistence-600.dt
d
<weblogic-rdbms-jar>
<weblogic-rdbms-bean>
<ejb-name>stores</ejb-name>
<data-source-name>sqlTX</data-source-name>
<table-name>ProductEJBTable</table-name>
<field-map>
<cmp-field>productId</cmp-field>
<dbms-column>productId</dbms-column>
</field-map>
<field-map>
<cmp-field>descrip</cmp-field>
<dbms-column>descrip</dbms-column>
</field-map>
<field-map>
<cmp-field>price</cmp-field>
<dbms-column>price</dbms-column>
</field-map>
</weblogic-rdbms-bean>
<create-default-dbms-tables>false</create-default-dbms-tables>
</weblogic-rdbms-jar>
---------------- end of weblogic-cmp-rdbms-jar.xml----------
Do i have to mention the connection Pool name anywhere .. My
connection
Pool name
is sql7Pool and my datasource name which i have mentioned is sqlTx.I am
using
Sql server 7. I am deploying a jar file(not a war file) and accessngthe
EJB through
a Servlet. Please any help would definitely be appreciated.
Cheers
Ashish. -
Exception came when change stateful to stateless in ejb-jar.xml [Ejb 2.0]
Hi,
I am getting exception when i change the below entry from Stateful to Stateless for Transaction Type "Container"..
----------------------------------------------------------------Working Fine for single and multi users----------------------------------------------------
<session>
<description>Entity Bean Employee Example</description>
<ejb-name>Stlg</ejb-name>
<local-home>com..ejb.session.ejbeans.StlgHome</local-home>
<local>com.ejb.session.ejbeans.Stlg</local>
<ejb-class>com.ejb.session.ejbeans.StlgBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
</session>
----------------------------------------------------------------Working Fine for single and multi users----------------------------------------------------
----------------------------------------------------------------Working Fine for single user and exception for multi users----------------------------------------------------
<session>
<description>Entity Bean Employee Example</description>
<ejb-name>Stlg</ejb-name>
<local-home>com..ejb.session.ejbeans.StlgHome</local-home>
<local>com.ejb.session.ejbeans.Stlg</local>
<ejb-class>com.ejb.session.ejbeans.StlgBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
----------------------------------------------------------------Working Fine for single and exception for multi users------------------------------------------------------------
2012-06-27 12:27:15,531 DEBUG com.ds.ApplSessListener 16 - vattributeAdded : errorencountered,java.lang.ClassCastException: java.lang.String cannot be cast to com.packg.class
Strange that its working for single user and cracking for multiuser when tested via jmeter12/06/28 12:21:42 java.lang.IndexOutOfBoundsException: Index: 2300, Size: 2300
12/06/28 12:21:42 at java.util.ArrayList.RangeCheck(Unknown Source)
12/06/28 12:21:42 at java.util.ArrayList.get(Unknown Source)
12/06/28 12:21:42 at com.ejbeans.StlEntryBean.getEntryList(StlEntryBean.java:1587)
12/06/28 12:21:42 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
12/06/28 12:21:42 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
12/06/28 12:21:42 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
12/06/28 12:21:42 at java.lang.reflect.Method.invoke(Unknown Source)
12/06/28 12:21:42 at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
12/06/28 12:21:42 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
12/06/28 12:21:42 at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
12/06/28 12:21:42 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
12/06/28 12:21:42 at com.evermind.server.ejb.interceptor.system.TxBeanManagedInterceptor.invoke(TxBeanManagedInterceptor.java:53)
12/06/28 12:21:42 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
12/06/28 12:21:42 at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
12/06/28 12:21:42 at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
12/06/28 12:21:42 at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
12/06/28 12:21:42 at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:87)
12/06/28 12:21:42 at Entry_LocalProxy_1dc72ge.getEntryList(Unknown Source)
12/06/28 12:21:42 at com.ejb.client.EntryClient.getEntryList(EntryClient.java:145)
12/06/28 12:21:42 at EntryServ.find(EntryServ.java:8613)
12/06/28 12:21:42 at EntryServ.doGet(EntryServ.java:439)
12/06/28 12:21:42 at EntryServ.doPost(EntryServ.java:280)
12/06/28 12:21:42 at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
12/06/28 12:21:42 at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
12/06/28 12:21:42 at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
12/06/28 12:21:42 at LogFilter.doFilter(LogFilter.java:57)
12/06/28 12:21:42 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:644)
12/06/28 12:21:42 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:391)
12/06/28 12:21:42 at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:908)
12/06/28 12:21:42 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458)
12/06/28 12:21:42 at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:226)
12/06/28 12:21:42 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:127)
12/06/28 12:21:42 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:116)
12/06/28 12:21:42 at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
12/06/28 12:21:42 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
12/06/28 12:21:42 at java.lang.Thread.run(Unknown Source)
Single user means a single user logged-In,Multi user means 10-20 users logged in via apache jmeter for testing performance..
Let me know if anthing else required
Edited by: user9052593 on Jun 28, 2012 12:12 AM -
Webllogic8to10migration-SAXValidationExc Couldnot locate bean ejb-jar.xml
Please help me out here..
Failed to parse descriptor at 'META-INF/weblogic-ejb-jar.xml' for module 'PAMaintenanceBean.jar': javax.xml.stream.XMLStreamException: weblogic.xml.process.SAXValidationException: Could not locate bean with ejb-name "PAMaintenance" in ejb-jar.xml
ejb-jar.xml
==========
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>PAMaintenance</ejb-name>
<home>com.bear.coreapps.pa.ejb.maintenance.PAMaintenanceHome</home>
<remote>com.bear.coreapps.pa.ejb.maintenance.PAMaintenance</remote>
<ejb-class>com.bear.coreapps.pa.ejb.maintenance.PAMaintenanceBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>PAMaintenance</ejb-name>
<method-intf>Remote</method-intf>
<method-name>*</method-name>
</method>
<trans-attribute>Supports</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>PAFeatures</ejb-name>
<home>com.bear.coreapps.pa.ejb.features.PAFeaturesHome</home>
<remote>com.bear.coreapps.pa.ejb.features.PAFeatures</remote>
<ejb-class>com.bear.coreapps.pa.ejb.features.PAFeaturesBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<env-entry>
<env-entry-name>myString</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>anything at all</env-entry-value>
</env-entry>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>PAFeatures</ejb-name>
<method-intf>Remote</method-intf>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
weblogic-ejb-jar.xml
===============
<?xml version="1.0"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB//EN' 'http://www.bea.com/servers/wls510/dtd/weblogic-ejb-jar.dtd'>
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>PAMaintenance</ejb-name>
<caching-descriptor>
<max-beans-in-free-pool>100</max-beans-in-free-pool>
</caching-descriptor>
<enable-call-by-reference>false</enable-call-by-reference>
<jndi-name>com.bear.coreapps.pa.ejb.maintenance.PAMaintenance</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
<?xml version="1.0"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB//EN' 'http://www.bea.com/servers/wls510/dtd/weblogic-ejb-jar.dtd'>
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>PAFeatures</ejb-name>
<caching-descriptor>
<max-beans-in-free-pool>100</max-beans-in-free-pool>
</caching-descriptor>
<jndi-name>statelessSession.PAFeaturesHome</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
my web.xml
========
<ejb-ref>
<ejb-ref-name>PAFeatures</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.bear.coreapps.pa.ejb.features.PAFeaturesHome</home>
<remote>com.bear.coreapps.pa.ejb.features.PAFeatures</remote>
<ejb-link>../PAFeaturesBean.jar#PAFeatures</ejb-link>
</ejb-ref>
<ejb-ref>
<ejb-ref-name>PAMaintenance</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.bear.coreapps.pa.ejb.maintenance.PAMaintenanceHome</home>
<remote>com.bear.coreapps.pa.ejb.maintenance.PAMaintenance</remote>
<ejb-link>../PAMaintenanceBean.jar#PAMaintenance</ejb-link>
</ejb-ref>
Application.xml
===========
<module>
<ejb>PAFeaturesBean.jar</ejb>
</module>
<module>
<ejb>PAMaintenanceBean.jar</ejb>
</module>
config.xml
===========
<app-deployment>
<name>emsApp</name>
<target>mngCTK_dbctkapp01</target>
<module-type>ear</module-type>
<source-path>applications/emsApp</source-path>
<sub-deployment>
<name>/</name>
<target>mngCTK_dbctkapp01</target>
</sub-deployment>
<sub-deployment>
<name>PAMaintenanceBean.jar</name>
<target>mngCTK_dbctkapp01</target>
</sub-deployment>
<sub-deployment>
<name>PAFeaturesBean.jar</name>
<target>mngCTK_dbctkapp01</target>
</sub-deployment>
<security-dd-model>DDOnly</security-dd-model>
<staging-mode>nostage</staging-mode>
</app-deployment>Hi,
Nothing stands out as being configured incorrectly. I copy and pasted the descriptors below, put them in a jar file and ran weblogic.appc on it. The descriptors loaded properly and appc only complained that the EJB classes couldn't be found (as expected). Are you sure the weblogic-ejb-jar.xml containing the 'PAMaintenance' reference is in the same ejb-jar file as the ejb-jar.xml containing the 'PAMaintenance' definition? That's the only thing I can think of.
- Matt -
Ejb-jar.xml and orion-ejb-jar.xml configuration issue
Chris,
We have an application that uses the Oracle 10g Application Server and WebSphere MQ v5.3 w/ fixpack 9.
Our application is a J2EE messaging system which essentially consists of Message Driven Beans, the EJB
realization of the J2EE Java Message Service (JMS) API. Our application has Message Driven Beans which
listen to queues and send messages to queues -- a simple messaging system. Currently we can listen to queues, but
cannot send messages to queues in the Oracle 10g Application Server environment.
Any J2EE application server has its own implementation of Java Naming Directory Interface (JNDI) API that
deployed J2EE applications utilize to lookup resources such as Data Sources, JMS Destinations (i.e. MQ Queue),
JMS QueueConnectionFactories (i.e. MQ QManagers).
Our application uses the 3rd party JMS Provider, WebSphere MQ.
MQ ships with a JMSAdmin tool which allows one to create JMS administered objects (i.e. objects a java
application searches for in some JNDI directory) that reside in some JNDI context. We create a JNDI context for
MQ resources, queues and QManagers. We configure the MQ provided
JMSAdmin tool with two property name/value pairs:
PROVIDER_URL=file:/opt/mqm/JNDI-Directory
INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
A resultant .bindings file is created in /opt/mqm/JNDI-Directory which represents our JDNI context
containing our JMS administered objects. A standalone java application that needs to directly access this
JNDI context can simply conduct a JNDI lookup on the following context: "java:comp/resource/MQSeries/". An
example of how a standalone application would lookup a JMS administered object named "qNumber1" would be to
lookup "java:comp/resource/MQSeries/qNumber1". This lookup would result in the standalone java application
having a JMS reference to an MQ Queue.
There is a major difference in how an enterprise EJB application deployed into a J2EE Container (Oracle 10g App Server)
conducts a JNDI lookup on a 3rd party resource such as MQ as a JMS Provider. A typical EJB application deployed
into a J2EE container as an .ear (enterprise archive) file has implicit access to the application server's own
JNDI context. This JNDI context is usually "java:comp/env/". Looking up the Application Server's own Data Source or
it's own JMS Resources is easy. An application that needs references to these Application Server provided resources
simply conducts a lookup for "java:comp/env/jms/someQ" or "java:comp/env/jdbc/myDataSource".
The problem we face is mapping our MQ JNDI context to the Oracle App Server's own JNDI context. We believe this is
accomplished through mappings defined in both the ejb-jar.xml (EJB Descriptor) and the application server specific
counterpart, orion-ejb-jar.xml. Note that Oracle 10g Application Server uses the popular orion J2EE container for
hosting J2EE enterpise applications.
Our Message Driven Beans (MDBs)currently listen to the Queue at the JNDI location "prodQ". Our problem is that we cannot
get our MDB to send messages to any queues. Note that the MQ implementation of the queues and Queue Managers work
flawlessly with standalone java applications. It's safe to say that the MQ objects are working.
We are looking for a solid example of how the ejb-jar.xml and the orion-ejb-jar.xml map 3rd party JMS provider
JNDI locations to the App Server's JNDI context.
Below is how we have attempted to configure our own ejb-jar.xml and orion-ejb-jar.xml:
ejb-jar.xml begin >>>>>>>>>>>>>>><?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>
<display-name>Production Message Driven Bean</display-name>
<enterprise-beans>
<message-driven>
<display-name>prodMdb</display-name>
<ejb-name>prodMdb</ejb-name>
<ejb-class>message.handler.AIDMSMessageConsumerBean</ejb-class>
<transaction-type>Bean</transaction-type>
<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
</message-driven-destination>
<resource-ref>
<res-ref-name>prodQCF</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref>
<res-ref-name>prodQ</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref>
<res-ref-name>prodR</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</message-driven>
</enterprise-beans>
</ejb-jar>
<<<<<<<< ejb-jar.xml end <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
begin orion-ejb-jar.xml >>>>>>>>>>>>>>>>>>>>>>>>>>><orion-ejb-jar>
<enterprise-beans>
<message-driven-deployment name="prodMdb" connection-factory-location="java:comp/resource/MQSeries/prodQCF" destination-location="java:comp/resource/MQSeries/prodR">
<resource-ref-mapping location="prodQ" name="prodQ">
<lookup-context location="java:comp/resource/MQSeries/" >
<!-- <context-attribute name="java.naming.factory.initial"
value="com.sun.jndi.fscontext.RefFSContextFactory" /> -->
</lookup-context>
</resource-ref-mapping>
<resource-ref-mapping location="prodR" name="prodR">
<lookup-context location="java:comp/resource/MQSeries/" >
<!-- <context-attribute name="java.naming.factory.initial"
value="com.sun.jndi.fscontext.RefFSContextFactory" /> -->
</lookup-context>
</resource-ref-mapping>
</message-driven-deployment>
</enterprise-beans>
</orion-ejb-jar>
<<<<<<<<< end orion-ejb-jar.xml <<<<<<<<<<<<<<<<<<<<<<<<If you look at the contents of a deployment plan (Plan.xml) when you have it generated
<deployment-plan ...>
<module-override>
<module-name>ejb.jar</module-name>
<module-type>ejb</module-type>
<module-descriptor external="true">
<root-element>weblogic-ejb-jar</root-element>
<uri>META-INF/weblogic-ejb-jar.xml</uri>
</module-descriptor>
<module-descriptor external="false">
<root-element>ejb-jar</root-element>
<uri>META-INF/ejb-jar.xml</uri>
</module-descriptor>
<module-descriptor external="true">
<root-element>persistence-configuration</root-element>
<uri>META-INF/persistence-configuration.xml</uri>
</module-descriptor>
<module-descriptor external="false">
<root-element>persistence</root-element>
<uri>META-INF/persistence.xml</uri>
</module-descriptor>
</module-override>
</deployment-plan>You can see which files can be external and which can be not. The weblogic-ejb-jar.xml can be external
but in this case you need a deployment plan to point weblogic to the file. The ejb-jar.xml cannot be
external (see external=false)
The benefit of storing the weblogic-ejb-jar.xml is that your administrator can fine tune certain
configurations by using a deployment plan, instead of having to extract the contents from the jar file
and then repackage it again.
No need to worry about a clustered environment, you can place the jar and the deployment plan
on the server where the admin server is located, when you deploy an application you deploy it to
the cluster and everything is taken care off.
More information on deployment plans can be found here: http://download.oracle.com/docs/cd/E11035_01/wls100/deployment/config.html -
[Fwd: ACL for ejb-jar.xml?]
[email.eml]
The documentation of EJB security suffers because EJB relies half on Sun and
half on the container vendor (BEA, in this case). Sun's EJB documentation
(http://java.sun.com/products/ejb/index.html) is vague because it is a
standards specification, not a coding guide or implementation tutorial.
BEA's docs expect the reader to be adept at figuring out the details:
http://www.weblogic.com/docs51/classdocs/API_ejb/EJB_reference.html#1031011
Here is my (quick) stab at what the deployment descriptors need to look
like, starting with ejb-jar.xml:
<ejb-jar>
<enterprise-beans>
<!-- Other stuff here... -->
</enterprise-beans>
<assembly-descriptor>
<!-- Other stuff here... -->
<security-role>
<description>
This role is allowed to access the read-only methods in the
system.
</description>
<role-name>
ReadOnly
</role-name>
</security-role>
<method-permission>
<role-name>
ReadOnly
</role-name>
<method>
<ejb-name>
MyEJB
</ejb-name>
<method-name>
getName
</name-name>
</method>
<method>
<ejb-name>
MyOtherEJB
</ejb-name>
<method-name>
getOtherName
</name-name>
</method>
</method-permission>
</assembly-descriptor>
</ejb-jar>
It basically defines a security role named "ReadOnly" and maps that role to
the methods MyEJB.getName() and MyOtherEJB.getOtherName().
Here is an example weblogic-ejb-jar.xml:
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<!-- Other stuff here... -->
</weblogic-enterprise-bean>
<security-role-assignment>
<role-name>
Users
</role-name>
<principal-name>
everyone
</principal-name>
</security-role-assignment>
</weblogic-ejb-jar>
"ReadOnly" the security role defined in ejb-jar.xml.
"everyone" is the principal (user or group) defined by your Weblogic realm.
Weblogic realms and ACLs are documented:
http://www.weblogic.com/docs51/classdocs/API_acl.html
ltr, Shy
"minjiang" <[email protected]> wrote in message
news:[email protected]...
>
Hi:
I try to use ACL for my beans. It needs me to write the applicaiton
role in ejb-jar.xml file. But what is the correct format for this? I
cannot find any document on this. Seems to be a problem of Sun.
Can anyone give me an example on how to write these two xml files on
this?
Thanks.
minjiang--
S H Y E L A A B E R M A N
Architect, Development
HotelTools, Inc. - http://www.hoteltools.com
100 Galleria Parkway, Suite 1020
Atlanta, Georgia 30339
v: 770.956.4080 x5359
f: 770.956.4077
c: 678.458.3458
[email protected]
A dreamer is one who can only find hisway by moonlight, and his punishment
is that he sees the dawn before the restof the world. -- Oscar Wilde
Lose as if you like it; win as if youwere used to it. -- Tommy Hitchcock -
XDoclet and ejb-jar.xml - No Entity tags?
build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="XDoclet" default="ejbdoclet">
<property file="build.properties"/>
<target name="init">
<property name="dir" value="G:\JAVA Tools"/>
<property name="lib.dir" value="lib"/>
<!-- library/jar path -->
<property name="xdoclet.jar.path" value="${dir}\XDoclet\lib\xdoclet.jar"/>
<property name="log4j.jar.path" value="${dir}\XDoclet\samples\lib\log4j.jar"/>
<property name="ant.jar.path" value="${dir}\ANT\lib\ant.jar"/>
<property name="src.dir" value="src"/>
<property name="generated.src.dir" value="XDoclet/gen-src-code"/>
<property name="web.dir" value="${src.dir}/web"/>
<property name="generated.java.dir" value="${generated.src.dir}/java"/>
<property name="config.dir" value="config"/>
<property name="build.dir" value="XDoclet/build"/>
<property name="dist.dir" value="XDoclet/dist"/>
<property name="build.compiler" value="modern"/>
<path id="project.class.path">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
<!-- append the external classpath lastly -->
<pathelement path="${java.class.path};${log4j.jar.path}"/>
</path>
</target>
<!-- Prepare -->
<target name="prepare" depends="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dir}/ejb"/>
<mkdir dir="${build.dir}/ejb/META-INF"/>
<mkdir dir="${build.dir}/web"/>
<mkdir dir="${build.dir}/web/WEB-INF"/>
<mkdir dir="${build.dir}/web/WEB-INF/tlds"/>
<mkdir dir="${build.dir}/web/WEB-INF/classes"/>
<mkdir dir="${build.dir}/j2ee"/>
<mkdir dir="${build.dir}/j2ee/META-INF"/>
<mkdir dir="${build.dir}/jmx"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${generated.src.dir}"/>
<mkdir dir="${generated.java.dir}"/>
<echo message="XDoclet Path = ${xdoclet.jar.path}"/>
<echo message="Log4J Path = ${log4j.jar.path}"/>
<echo message="Ant Path = ${ant.jar.path}"/>
<echo message="ClassPath = ${java.class.path}"/>
<property name="cp" refid="project.class.path"/>
<echo message="CLASSPATH/REF ID:${cp}"/>
<echo message="base dir = ${basedir}/${src.dir}"/>
</target>
<target name="delete" >
<echo message = "Deleting directories"/>
<delete dir="${build.dir}"/>
<delete dir="${build.dir}/ejb"/>
<delete dir="${build.dir}/ejb/META-INF"/>
<delete dir="${build.dir}/web"/>
<delete dir="${build.dir}/web/WEB-INF"/>
<delete dir="${build.dir}/web/WEB-INF/tlds"/>
<delete dir="${build.dir}/web/WEB-INF/classes"/>
<delete dir="${build.dir}/j2ee"/>
<delete dir="${build.dir}/j2ee/META-INF"/>
<delete dir="${build.dir}/jmx"/>
<delete dir="${dist.dir}"/>
<delete dir="${generated.src.dir}"/>
<delete dir="${generated.java.dir}"/>
</target>
<!-- Run EJBDoclet -->
<target name="ejbdoclet" depends="prepare">
<taskdef name="ejbdoclet"
classname="xdoclet.ejb.EjbDocletTask"
classpath="${java.class.path};${log4j.jar.path};${ant.jar.path};${xdoclet.jar.path} "/>
<ejbdoclet sourcepath="${src.dir}"
destdir="${generated.java.dir}"
classpathref="project.class.path"
excludedtags="@version,@author"
ejbspec="2.0"
>
<fileset dir="${src.dir}">
<include name="**/*EJB.java"/>
</fileset>
<dataobject/>
<!-- <localinterface/>
<localhomeinterface/> -->
<remoteinterface/>
<homeinterface/>
<entitypk/>
<!-- <entitycmp/> -->
<deploymentdescriptor destdir="${build.dir}/ejb/META-INF" validatexml="true"/>
<jboss version="2.4" xmlencoding="UTF-8" validatexml="true" typemapping="Hypersonic
SQL" datasource="java:/DefaultDS" destdir="${build.dir}/ejb/META-INF"/>
<!--
<weblogic xmlencoding="UTF-8" destdir="${build.dir}/ejb/META-INF" validatexml="true"/>
<webSphere destdir="${build.dir}/ejb/META-INF" />
<orion/>
<apachesoap destdir="${build.dir}/web"/>
-->
<!--
Have struts form objects generated based on entity beans'
data objects. Will require struts.jar to compile.
<strutsform />
-->
</ejbdoclet>
</target>
</project>
My Session Bean:
package com.uniserv.comn.controller.ejb.session.terminalfacade;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
import javax.ejb.*;
import java.util.*;
import com.uniserv.comn.util.*;
import com.uniserv.comn.model.*;
import com.uniserv.comn.controller.ejb.entity.tenderconfig.*;
public class TerminalSessionFacadeEJB implements SessionBean {
private SessionContext ctx = null;
private ServiceLocator serviceLocator = null;
public TerminalSessionFacadeEJB() throws ServiceLocatorException {
try {
serviceLocator = ServiceLocator.getInstance();
} catch (Exception e) {
System.out.println("TerminalSessionFacade Exception : " + e.getMessage());
* Adds an tenderConfig record
* @param tenderConfigVO TenderConfig's Value Object
* @return boolean true if successful, false if not
public boolean addTenderConfig(TenderConfigVO tenderConfigVO) {
System.out.println("TerminalSessionFacadeEJB.addTenderConfig - START");
boolean blnRet = false;
try {
LocalTenderConfigHome home = (LocalTenderConfigHome)
serviceLocator.getLocalHome(ServiceLocator.Services.TENDERCONFIG);
LocalTenderConfig local = null;
try {
TenderConfigPK pk
= new TenderConfigPK(tenderConfigVO.getTndrID(), tenderConfigVO.getTndrCfgName());
local = home.findByPrimaryKey(pk);
} catch (Exception e) {
System.out.println(e.getMessage());
} finally {
if (local == null) {
home.create(tenderConfigVO);
blnRet = true;
} else {
blnRet = false;
} catch (Exception e) {
System.out.println("Error in TerminalSessionFacadeEJB.addTenderConfig "
+ "method (Exception) : "
+ e.getMessage());
} finally {
System.out.println("Returned value : " + blnRet);
System.out.println("TerminalSessionFacadeEJB.addTenderConfig - END");
return blnRet;
public void setSessionContext(SessionContext parm1) throws javax.ejb.EJBException, java.rmi.RemoteException {
this.ctx = parm1;
public void ejbRemove() throws javax.ejb.EJBException, java.rmi.RemoteException
public void ejbActivate() throws javax.ejb.EJBException, java.rmi.RemoteException
public void ejbPassivate() throws javax.ejb.EJBException, java.rmi.RemoteException
public void ejbCreate() throws javax.ejb.EJBException
My Entity Bean:
package com.uniserv.comn.controller.ejb.entity.tenderconfig;
* @ejb.bean
* type="CMP"
* cmp-version="2.x"
* name="TenderConfigEJB"
* schema="TenderConfig"
* view-type="local"
import javax.ejb.*;
import com.uniserv.comn.model.*;
public abstract class TenderConfigEJB implements EntityBean{
private EntityContext ctx = null;
* @ejb.pk
public abstract int getTndrID();
public abstract void setTndrID(int iTndrID);
* @ejb.pk
public abstract String getTndrCfgName();
public abstract void setTndrCfgName(String strTndrCfgName);
public abstract int getTndrType();
public abstract void setTndrType(int iTndrType);
public abstract String getTndrCfgValue();
public abstract void setTndrCfgValue(String strTndrCfgValue);
public abstract String getTndrCfgDataType();
public abstract void setTndrCfgDataType(String strTndrCfgDataType);
public abstract String getTndrCfgDesc();
public abstract void setTndrCfgDesc(String strTndrCfgDesc);
public TenderConfigVO getTenderConfigVO() {
TenderConfigVO tenderConfigVO = new TenderConfigVO();
tenderConfigVO.setTndrID(this.getTndrID());
tenderConfigVO.setTndrCfgName(this.getTndrCfgName());
tenderConfigVO.setTndrType(this.getTndrType());
tenderConfigVO.setTndrCfgValue(this.getTndrCfgValue());
tenderConfigVO.setTndrCfgDataType(this.getTndrCfgDataType());
tenderConfigVO.setTndrCfgDesc(this.getTndrCfgDesc());
return tenderConfigVO;
public void setTenderConfigVO(TenderConfigVO tenderConfigVO) {
this.setTndrID(tenderConfigVO.getTndrID());
this.setTndrCfgName(tenderConfigVO.getTndrCfgName());
this.setTndrType(tenderConfigVO.getTndrType());
this.setTndrCfgValue(tenderConfigVO.getTndrCfgValue());
this.setTndrCfgDataType(tenderConfigVO.getTndrCfgDataType());
this.setTndrCfgDesc(tenderConfigVO.getTndrCfgDesc());
* Constructor
public TenderConfigEJB() {
* ejbCreate callback method
* @return int
public TenderConfigPK ejbCreate(TenderConfigVO tenderConfigVO)
throws CreateException {
this.setTenderConfigVO(tenderConfigVO);
return null;
* ejbPostCreate
* @param TerminalConfigTypeVO
public void ejbPostCreate(TenderConfigVO tenderConfigVO) {
* setEntityContext callback method
public void setEntityContext(EntityContext ctx) {
this.ctx = ctx;
* unsetEntityContext callback method
public void unsetEntityContext() {
this.ctx = null;
* ejbActivate callback method
public void ejbActivate() {
* ejbPassivate callback method
public void ejbPassivate() {
* ejbLoad callback method
public void ejbLoad() {
* ejbRemove callback method
public void ejbRemove() {
* ejbStore callback method
public void ejbStore() {
But the generated ejb-jar.xml only contains
<?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>
<description>No Description.</description>
<display-name>Generated by XDoclet</display-name>
<enterprise-beans>
<!-- Session Beans -->
<session>
<description><![CDATA[No Description.]]></description>
<ejb-name>com.uniserv.comn.controller.ejb.session.terminalfacade.TerminalSessionFacade</ejb-name>
<home>com.uniserv.comn.controller.ejb.session.terminalfacade.TerminalSessionFacadeHome</home>
<remote>com.uniserv.comn.controller.ejb.session.terminalfacade.TerminalSessionFacade</remote>
<ejb-class>com.uniserv.comn.controller.ejb.session.terminalfacade.TerminalSessionFacadeEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
<!--
To add session beans that you have deployment descriptor info for, add
a file to your merge directory called session-beans.xml that contains
the <session></session> markup for those beans.
-->
<!-- Entity Beans -->
<!--
To add entity beans that you have deployment descriptor info for, add
a file to your merge directory called entity-beans.xml that contains
the <entity></entity> markup for those beans.
-->
<!-- Message Driven Beans -->
<!--
To add message driven beans that you have deployment descriptor info for, add
a file to your merge directory called message-driven-beans.xml that contains
the <message-driven></message-driven> markup for those beans.
-->
</enterprise-beans>
<!-- Relationships -->
<!-- Assembly Descriptor -->
<assembly-descriptor>
<!-- finder permissions -->
<!-- transactions -->
<!-- finder transactions -->
</assembly-descriptor>
</ejb-jar>
this ejb-jar.xml only contains entries for session beans? where did the entries for entity beans went?Ive written XDoclet tags for the Entity Bean as what ive posted above....help!!!you comment the generation of CMP entity beans out :
build.xml:
replace
<!-- <entitycmp/> -->
with
<entitycmp/>i've already removed the comments of the tag <entitycmp> and yet the resulting ejb-jar.xml contains no <entity> tags....i'm just wondering how can i include the generation of entity tags (not only session tags) in the resulting ejb-jar.xml
<ejb-jar>
<description>No Description.</description>
<display-name>Generated by XDoclet</display-name>
<enterprise-beans>
<!-- Session Beans -->
<session>
<description><![CDATA[No Description.]]></description>
<ejb-name>com.uniserv.comn.controller.ejb.session.terminalfacade.TerminalSessionFacade</ejb-name>
<home>com.uniserv.comn.controller.ejb.session.terminalfacade.TerminalSessionFacadeHome</home>
<remote>com.uniserv.comn.controller.ejb.session.terminalfacade.TerminalSessionFacade</remote>
<ejb-class>com.uniserv.comn.controller.ejb.session.terminalfacade.TerminalSessionFacadeEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
<!--
To add session beans that you have deployment descriptor info for, add
a file to your merge directory called session-beans.xml that contains
the <session></session> markup for those beans.
-->
<!-- Entity Beans -->
<!--
To add entity beans that you have deployment descriptor info for, add
a file to your merge directory called entity-beans.xml that contains
the <entity></entity> markup for those beans.
-->
<!-- Message Driven Beans -->
<!--
To add message driven beans that you have deployment descriptor info for, add
a file to your merge directory called message-driven-beans.xml that contains
the <message-driven></message-driven> markup for those beans.
-->
</enterprise-beans>
<!-- Relationships -->
<!-- Assembly Descriptor -->
<assembly-descriptor>
<!-- finder permissions -->
<!-- transactions -->
<!-- finder transactions -->
</assembly-descriptor>
</ejb-jar> -
No table name specified in ejb-jar.xml file
Hi, I have an entity bean defined as follows:
<enterprise-beans>
<entity>
<display-name>SponsorEJB</display-name>
<ejb-name>SponsorEJB</ejb-name>
<home>com.ultradns.j2ee.components.sponsor.ejb.SponsorHome</home>
<remote>com.ultradns.j2ee.components.sponsor.ejb.Sponsor</remote>
<ejb-class>com.ultradns.j2ee.components.sponsor.ejb.SponsorEJB</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<resource-ref>
<res-ref-name>jdbc/jdbc/OracleDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>sponsor</abstract-schema-name>
<cmp-field>
<primkey-field>guid</primkey-field>
<query>
<query-method>
<method-name>findAll</method-name>
<method-params></method-params>
</query-method>
<ejb-ql>
<![CDATA[ SELECT OBJECT(a) FROM sponsor AS a]]>
</ejb-ql>
</query>
</entity>
</enterprise-beans>
In the database, I want this entity bean refers to a table named "sponsor", but I could not specify the relation in the ejb-jar.xml file. So when I deployed this bean, it auto created a table called "SponsorEJB". Where is this name come from, from display-name or ejb-name field?
Basically, how can I specify a bean "SponsorEJB" referes to a table "sponsor"?
Thanks,First thing, to stop OC4J auto-creating tables, edit the file %J2EE_HOME%/config/application.xml. Change the first orion-application tag so that one attribute says autocreate-tables="false"
The ejb-jar.xml file describes your EJB's to the container. It is not supposed to describe which table each entity bean maps too, as this is an implementation specific property, so would not be portable between databases. Therefore you have to configure the container to point an entity to a table. Sun uses the sun-j2ee-ri.xml file to do this, and this has to be included in the deployment.
OC4J however uses the file 'orion-ejb-jar.xml', and will generate this for you. Since you have already deployed your application, this will have already been generated. Go to the directory %J2EE_HOME%/application-deployments. There will be a directory corresponding to your application name. In there is a directory corresponding to your ejb module name, and in there is the 'orion-ejb-jar.xml' file. If you open this file, you will see the entity deployment tags, an example of one is below. Edit the tag so that the table attribute points to the table in your database (note that there is a data-source attribute as well, so make sure that this points to the correct schema). The example below points the EJB Emp to the table EMP:
<entity-deployment name="Emp" max-instances="10" location="Emp" wrapper="EmpHome_EntityHomeWrapper3" table="EMP" data-source="jdbc/rob9iDS" locking-mode="optimistic" update-changed-fields-only="true" min-instances-per-pk="0" max-instances-per-pk="50" disable-wrapper-cache="true">
Hope this helps,
Rob -
Dynamic jndi-name in weblogic-ejb-jar.xml
Is there a way to create dynamic (i.e. runtime) jndi-names for EJBs instead of
(or in addition to) "hard coding" them in the weblogic-ejb-jar.xml file? What
I'm trying to do is have one WebLogic instance (JVM) host multiple environments
(our Beta and Training environments) and I simply want to deploy the same .ear
file twice but have each environment (application - .ear) reference a different
database schema (jdbc connection pool). I have everything working just fine for
this scenario except when I define jndi-names for our ejbs. The problem is that
I am really deploying the same ejbs (jndi-names and actually code base) in each
applicatoin instance and I get an exception when the WebLogic is trying to deploy
the second application (.ear) because the jndi-names in it have already been deployed
by the first application instance. I recieve a jndi error stating that the name
is already deployed.
Or is there a better path to go down for what I am trying to do to have one WebLogic
instance support our beta and training environments? Usually (but not always)
our code base is the for same for both of these environments, I simply need to
have each environment use a different database schema.
ThanksA little birdie tells me that BEA does this very thing. Looking at the
descriptors for WebLogic Portal I see:
<weblogic-enterprise-bean>
<ejb-name>LoaderEJB</ejb-name>
<enable-call-by-reference>True</enable-call-by-reference>
<jndi-name>${APPNAME}.BEA_content.LoaderHome</jndi-name>
</weblogic-enterprise-bean>
Yes, the ${APPNAME} token really is expanded into the J2EE application
name at deployment time!
Sincerely,
Daniel Selman
Bryan Dixon wrote:
Rewriting our build process isn't really much of an option for me. Our current
build process is too complex and time consuming right now to convert to Ant (we
eventually will do this but not for a while). So are there any other ideas that
aren't build related?
Thanks
"Eric Ma" <[email protected]> wrote:
You don't need run-time dynamism in JDNI names and it can't be done anyways.
You
need token substitution in XML configuration files when building the
app. If
you are using Ant for building, then it is a breeze. If not, first convert
your
build process to use Ant.
Also, a single WLS instance hosting multiple environments sounds really
INTRIGUING
to me.
Eric Ma
"Bryan Dixon" <[email protected]> wrote:
Is there a way to create dynamic (i.e. runtime) jndi-names for EJBsinstead
of
(or in addition to) "hard coding" them in the weblogic-ejb-jar.xml file?
What
I'm trying to do is have one WebLogic instance (JVM) host multiple environments
(our Beta and Training environments) and I simply want to deploy the
same .ear
file twice but have each environment (application - .ear) referencea
different
database schema (jdbc connection pool). I have everything working just
fine for
this scenario except when I define jndi-names for our ejbs. The problem
is that
I am really deploying the same ejbs (jndi-names and actually code base)
in each
applicatoin instance and I get an exception when the WebLogic is trying
to deploy
the second application (.ear) because the jndi-names in it have already
been deployed
by the first application instance. I recieve a jndi error stating that
the name
is already deployed.
Or is there a better path to go down for what I am trying to do to have
one WebLogic
instance support our beta and training environments? Usually (but not
always)
our code base is the for same for both of these environments, I simply
need to
have each environment use a different database schema.
Thanks -
Reg. Provider Url set in weblogic-ejb-jar.xml
have created an MDB which listens to an IBM MQ. I currently
specify the path of the binding file by setting the provider_url in the weblogic-ejb-jar.xml
An example is as follows::
<destination-jndi-name>Sample.Q</destination-jndi-name>
<initial-context-factory>com.sun.jndi.fscontext.RefFSContextFactory</initial-context-factory>
<provider-url>file:/apps/test/</provider-url>
<connection-factory-jndi-name>Sample.QCF</connection-factory-jndi-name>
is there any way to set this parameter dynamically from MDB itselfAFAIK you can't dynamically reconfigure MDBs; whats in the XML is what you get.
One alternative is to use Spring and Message Driven POJOs which allows you to use Spring to configure the provider & activation spec, which allows you to dynamically at runtime configure properties however you wish or even hot deploy MDPs within a running application.
http://jencks.org/Message+Driven+POJOs
Depending on how complex your runtime-configuration is you could create your own Spring Factory Beans to do wacky stuff (query a database or whatever to figure out the provider URLs etc) or use a Spring post processor to inject values from some other source (JNDI, LDAP etc).
James
http://logicblaze.com/ -
Common lookup for datasource name in ejb-jar.xml for all EJB's??
I used <env-entry>...</env-entry> in ejb-jar.xml ...but that does not allow me to look the same entry in another EJB ...what is the right place to keep and look for such a information ?
EJBing recently !!
Thanks
AjayI am sorry friend, that is not what i am looking for.
I have datasource/connection pool and do not want to hardcode the name into all EJB's rather want to access it from xml file. If i use
<env-entry> that is for a perticular session or entity bean. and i have to write that for all 35 beans. I believe there shoule be a tag to access globaly.
thanks for considering me to reply.
Ajay -
Deploytool not deleting fields in ejb-jar.xml and sun-cmp-mappings.xml
Java(TM) 2 Platform, Enterprise Edition 1.4 SDK Developer Release deploytool
This situation was found on a simple, but original application using CMP EJB's. The database is MySQL using numeric id's and foreign keys.
I changed some fields in the database and went through the usual 14 attempts at getting deploytool to recognize a new schema without success. The one thing that is noticed is that when I tried to open the CMP display in the Entity selection the tool would not show any data, also it appears to lockup; however, if you select EJB in the choice box of the upper left you can get the view to close.
In desperation (mind you decoding machine generated XML is NOT my favorite activity) I looked at the descriptor viewer and notice fields existed in the descriptor that were deleted in the database. The tool had read the schema because the new fields were also present.
In sun-cmp-mappings.xml the old <cmp-field-mapping> definitions were still present. and in ejb-jar.xml the <query> and <cmp-field> were still present.
After deleting them out -- happy, happy, happy, joy, joy, joy. Deploytool accepted the new schema (keeping all the proper old stuff correctly. yea!!!) and a simple create mapping process brought the beans and database into sync.
I didn't want to report a bug, since I am actually new to EJB's so if anybody wishes to comment please do. I just wanted to provide a heads up in case this was something not noticed.
BTW I'm a recent expert at EJB's anybody got a job? :-)Have you tried to unmap your fields and relationships?
Go through all your enterprise beans in the CMP Database window and click Unmap All until the Persistent Field Mappings table is empty of mappings. Then click Create Database Mappings, select the new schema, and verify the fields and relationships were mapped. This should clear out any old field mappings.
-Ian Evans -
Ejb-jar.xml not using fully qualified class names
HI,
I am trying yo upgrade my application from weblogic 8.1 to weblogic 9.2.3. My application has both session and enitybeans. I updated weblogic related jars with 9.x version. But while running ejbgen, i am getting the following exception.
*[java] weblogic.ejb.container.deployer.DeploymentDescriptorException: Unable to set the transaction attribute for method 'updateService(abcTO)' on EJB 'AbcService'. No matching method could be found. Please verify the method signature specified in the ejb-jar.xml file matches that of your Local interface for this EJB.*
In ejb-jar.xml file, it is not creating the fully qualified class name for abcTo in <method-param>. In component interface, the method signature is not contaning fully qualified class name for the parameters and return values.
If i change the signature in the bean with the fully qualified class name of the parameter, the ejb-jar.xml file is creating fine. But there are 100's of signatures i need to change if this is the only solution.
Can you please advice what i need to change when i upgrade from weblogic 8 to 9 series from session and entity bean's point of view?
Thanks in Advance
Naveen.
Edited by: avn_venki on Mar 16, 2009 7:15 AM
Edited by: avn_venki on Mar 16, 2009 7:15 AMejb-jar.xml has always required fully-qualified class names. If some vendors have accepted unqualified class names unfortunately that
behavior is non-portable. Your best bet is to fully-qualify the names. Perhaps you can find some tools to help you given the large
number of components in your application.
Maybe you are looking for
-
Officejet 4620 prints from HP Printer Assistant but shows as offline for normal print jobs
I just purchased an Officejet 4620 to use wirelessly on our home network -- we have two Thinkpads running Windows 7 64-bit. I followed the installation instructions and successfully printed out test pages using both the Printer Properties page in W
-
Im Really going crazy! I can't install Adobe AIR Windows 7
I tried everything, I read dozens of discussions instructors solution options - nothing works! Just before I go crazy! I want to solve this problem, because I paid money for App that uses Adobe AIR!! My problem is when I try to install the software a
-
my disk drive will start up when i plug it in, and runs for about 30 seconds, but wont get recognized in my computer. It used to show up in the finder but that doesnt happen anymore
-
HT1977 How do i get my money back for an app if it doesn't work?
How do i get my money back for an app if it doesn't work?
-
Profit center substitution with internal order when generating GL doc from
Profit center substitution with internal order when generating GL doc from MM Dear expert, Please advise how to substitute successfully the profit center by which user-exit via FI substitution function. Substitutions have been set for profit centers