ejb-local-ref where to put this tag in ejb-jar.xml ??
I have an ejb-jar.xml that looks like this. I have had no problem with remote interfaces. Now I want the bean to have a local interface too.
Just let me know where the tag I have mentioned for the <ejb-local-ref> has to be put into.
When I compile this file it throws me an error which i have shown below the output of the ejb-jar.xml file
<ejb-jar>
<enterprise-beans>
<entity>
<ejb-name>IDMaster</ejb-name>
<home>maxateev.mondial.brg.idmaster.IDMasterHome</home>
<remote>maxateev.mondial.brg.idmaster.IDMaster</remote>
<local-home>maxateev.mondial.brg.idmaster.IDMasterLocalHome</local-home>
<local>maxateev.mondial.brg.idmaster.IDMasterLocal</local>
<ejb-class>maxateev.mondial.brg.idmaster.IDMasterEJB</ejb-class>
<persistence-type>Container</persistence-type>
<ejb-local-ref>
<ejb-ref-name>ejb/IDMasterLocalHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>maxateev.mondial.brg.idmaster.IDMasterLocalHome</local-home>
<local>maxateev.mondial.brg.idmaster.IDMasterLocal</local>
</ejb-local-ref>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>IDMaster</abstract-schema-name>
<cmp-field>
<field-name>idPrefix</field-name>
</cmp-field>
<cmp-field>
<field-name>idValue</field-name>
</cmp-field>
<primkey-field>idPrefix</primkey-field>
<query>
<query-method>
<method-name>findAllIDMasters</method-name>
<method-params/>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT (f) FROM IDMaster as f]]></ejb-ql>
</query>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>IDMaster</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
I have also added the following tag in the weblogic-jar.xml
<local-jndi-name>IDMasterEJB.IDMasterLocalHome</local-jndi-name>
Just let me know whether I am correct
On compilation (using ant utility) the error thrown is like this :
ejbc:
[java] ERROR: Error parsing 'ejb-jar.xml' line 47: The content of element type "entity" must ma
tch "(description?,display-name?,small-icon?,large-icon?,ejb-name,home?,remote?,local-home?,local?,e
jb-class,persistence-type,prim-key-class,reentrant,cmp-version?,abstract-schema-name?,cmp-field*,pri
mkey-field?,env-entry*,ejb-ref*,ejb-local-ref*,security-role-ref*,security-identity?,resource-ref*,r
esource-env-ref*,query*)".
[java] ERROR: ejbc found errors
[java] Java Result: 1
Kindly Help !!!
Thanks n regards
Sajiv
This should take care of it
<ejb-jar>
<enterprise-beans>
<entity>
<ejb-name>IDMaster</ejb-name>
<home>maxateev.mondial.brg.idmaster.IDMasterHome</home>
<remote>maxateev.mondial.brg.idmaster.IDMaster</remote>
<local-home>maxateev.mondial.brg.idmaster.IDMasterLocalHome</local-home>
<local>maxateev.mondial.brg.idmaster.IDMasterLocal</local>
<ejb-class>maxateev.mondial.brg.idmaster.IDMasterEJB</ejb-class>
<persistence-type>Container</persistence-type>
<ejb-local-ref>
<ejb-ref-name>ejb/IDMasterLocalHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>maxateev.mondial.brg.idmaster.IDMasterLocalHome</local-home>
<local>maxateev.mondial.brg.idmaster.IDMasterLocal</local>
</ejb-local-ref>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>IDMaster</abstract-schema-name>
<cmp-field>
<field-name>idPrefix</field-name>
</cmp-field>
<cmp-field>
<field-name>idValue</field-name>
</cmp-field>
<primkey-field>idPrefix</primkey-field>
<ejb-local-ref>
<ejb-ref-name>ejb/IDMasterLocalHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>maxateev.mondial.brg.idmaster.IDMasterLocalHome</local-home>
<local>maxateev.mondial.brg.idmaster.IDMasterLocal</local>
</ejb-local-ref>
<query>
<query-method>
<method-name>findAllIDMasters</method-name>
<method-params/>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT (f) FROM IDMaster as f]]></ejb-ql>
</query>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>IDMaster</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
Similar Messages
-
Urgent where i put this code for delete
hi master
sir this code is right for my requirment but when i put on_delete event system not respons or not delete record
where i put this code for conditional deletion
this is my code
declare
recno number;
begin
if :system.cursor_block='accbal' then
delete accbal where accid=:chartofacc.accid;
go_block('chartofacc');
next_record;
elsif :system.cursor_block='chartofacc' then
select count(*) into recno from accbal where accid=:chartofacc.accid;
if recno=0 then
delete_record;
go_block('chartofacc');
previous_record;
else
message ('system found matching record then no delete master record');
message ('system found matching record then no delete master record');
end if;
end if;
end;
please gide me which event i use
thanking you
aamirHello,
The ON-DELETE triger fires only after a COMMIT statment and only for those records that have been deleted in the block.
Francois -
Sample weblogic-ejb-jar.xml for Resource-ref EJB 3.0
I am trying to create an MDB that can be re-used under different names.
@MessageDriven(description = "An MDB that transfers messages from one Queue to another", activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") })
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class TransferMdb implements MessageListener {
private static final Logger LOG = Logger.getLogger(TransferMdb.class);
@Resource(name = "jms/connfactory")
private ConnectionFactory connectionFactory;
@Resource(name = "jms/targetDestination")
private Queue targetDestination;
<ejb-jar version="3.0" 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/ejb-jar_3_0.xsd">
<enterprise-beans>
<message-driven>
<ejb-name>TransferMdb</ejb-name>
<ejb-class>TransferMdb</ejb-class>
</message-driven>
</enterprise-beans>
</ejb-jar>
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>TransferMdb</ejb-name>
<message-driven-descriptor>
<pool>
<max-beans-in-free-pool>200</max-beans-in-free-pool>
<initial-beans-in-free-pool>5</initial-beans-in-free-pool>
</pool>
<destination-jndi-name>test_queue</destination-jndi-name>
<transaction-descriptor>
<trans-timeout-seconds>20</trans-timeout-seconds>
</transaction-descriptor>
</message-driven-descriptor>
<reference-descriptor>
<resource-description>
<res-ref-name>jms/connectionfactory</res-ref-name>
<jndi-name>connectionfactory</jndi-name>
</resource-description>
<resource-description>
<res-ref-name>jms/targetDestination</res-ref-name>
<jndi-name>reply_queue</jndi-name>
</resource-description>
</reference-descriptor>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
However when I deploy the above, I get exceptions such as:
problem: cvc-complex-type.2.4a: Expected elements 'initial-context-factory@http://www.bea.com/ns/weblogic/weblogic-ejb-jar provider-url@http://www.bea.com/ns/weblogic/weblogic-ejb-jar connection-factory-jndi-name@http://www.bea.com/ns/weblogic/weblogic-ejb-jar jms-polling-interval-seconds@http://www.bea.com/ns/weblogic/weblogic-ejb-jar jms-client-id@http://www.bea.com/ns/weblogic/weblogic-ejb-jar generate-unique-jms-client-id@http://www.bea.com/ns/weblogic/weblogic-ejb-jar durable-subscription-deletion@http://www.bea.com/ns/weblogic/weblogic-ejb-jar max-messages-in-transaction@http://www.bea.com/ns/weblogic/weblogic-ejb-jar distributed-destination-connection@http://www.bea.com/ns/weblogic/weblogic-ejb-jar use81-style-polling@http://www.bea.com/ns/weblogic/weblogic-ejb-jar init-suspend-seconds@http://www.bea.com/ns/weblogic/weblogic-ejb-jar max-suspend-seconds@http://www.bea.com/ns/weblogic/weblogic-ejb-jar security-plugin@http://www.bea.com/ns/weblogic/weblogic-ejb-jar' instead of 'transaction-descriptor@http://www.bea.com/ns/weblogic/weblogic-ejb-jar' here in element message-driven-descriptor@http://www.bea.com/ns/weblogic/weblogic-ejb-jar:<null>
problem: cvc-complex-type.2.4a: Expected elements 'transaction-descriptor@http://www.bea.com/ns/weblogic/weblogic-ejb-jar iiop-security-descriptor@http://www.bea.com/ns/weblogic/weblogic-ejb-jar resource-description@http://www.bea.com/ns/weblogic/weblogic-ejb-jar resource-env-description@http://www.bea.com/ns/weblogic/weblogic-ejb-jar ejb-reference-description@http://www.bea.com/ns/weblogic/weblogic-ejb-jar service-reference-description@http://www.bea.com/ns/weblogic/weblogic-ejb-jar enable-call-by-reference@http://www.bea.com/ns/weblogic/weblogic-ejb-jar network-access-point@http://www.bea.com/ns/weblogic/weblogic-ejb-jar clients-on-same-server@http://www.bea.com/ns/weblogic/weblogic-ejb-jar run-as-principal-name@http://www.bea.com/ns/weblogic/weblogic-ejb-jar create-as-principal-name@http://www.bea.com/ns/weblogic/weblogic-ejb-jar remove-as-principal-name@http://www.bea.com/ns/weblogic/weblogic-ejb-jar passivate-as-principal-name@http://www.bea.com/ns/weblogic/weblogic-ejb-jar jndi-name@http://www.bea.com/ns/weblogic/weblogic-ejb-jar local-jndi-name@http://www.bea.com/ns/weblogic/weblogic-ejb-jar dispatch-policy@http://www.bea.com/ns/weblogic/weblogic-ejb-jar remote-client-timeout@http://www.bea.com/ns/weblogic/weblogic-ejb-jar stick-to-first-server@http://www.bea.com/ns/weblogic/weblogic-ejb-jar' instead of 'reference-descriptor@http://www.bea.com/ns/weblogic/weblogic-ejb-jar' here in element weblogic-enterprise-bean@http://www.bea.com/ns/weblogic/weblogic-ejb-jar:<null>
at weblogic.descriptor.internal.MarshallerFactory$1.evaluateResults(MarshallerFactory.java:234)
at weblogic.descriptor.internal.MarshallerFactory$1.evaluateResults(MarshallerFactory.java:221)
at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:146)
at weblogic.descriptor.BasicDescriptorManager.createDescriptor(BasicDescriptorManager.java:306)
at weblogic.application.descriptor.AbstractDescriptorLoader2.getDescriptorBeanFromReader(AbstractDescriptorLoader2.java:788)
Truncated. see log file for complete stacktrace
I am clearly missing items in the weblogic-ejb-jar.xml. If anyone has a sample or tips, that would be awesome as a starting point.Those tags just declare that you are using our CMP provider and that
your descriptor is in META-INF/weblogic-cmp-rdbms-jar.xml.
FWIW, you might also want to check out EJBGen. It tends to keep more up
to date with WLS than xdoclet.
-- Rob
Gen wrote:
I am using xdoclets to generate descriptor file weblogic-ejb-jar.xml
for a BMP entity bean. Xdoclet is generating the descriptor file
alright, but is putting the following extra tags. This happens even
for samples which come with the download, so my tags in java file are
not wrong.
My question is, are the extra tags below harmless, or should I
manually go to each desciptor file and remove them?
Thanks.
----------- EXTRA TAGS GENERATED START ---------
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>
----------- EXTRA TAGS GENERATED END ---------
----------- TAGS I PUT IN JAVA CLASS START --------
* @ejb:bean name="com.ejb.entity.Customer"
* jndi-name="com.ejb.entity.CustomerHome"
* view-type="remote"
* type="BMP"
* primkey-field="com.ejb.entity.CustomerPK"
* reentrant="false"
* @weblogic:cache
* max-beans-in-cache="1000"
* read-timeout-seconds="900"
* concurrency-strategy="ReadOnly"
----------- TAGS I PUT IN JAVA CLASS END -------- -
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> -
More information about the ejb-ref element of ejb-jar.xml
Hello,
I am currently studying ejbs and I came across the ejb-ref element of the ejb-jar.xml file. I am in reference to O'Reilly Entreprise JavaBeans book. The book says that, thanks to the ejb-ref element it is possible to access one ejb from another ejb with the following client code:
InitialContext jndiContext = new InitialContext();
Object ref = jndiContext.lookup("java:comp/env/ejb/ProcessPaymentHomeRemote");
ProcessPaymentHomeRemote home = (ProcessPaymentHomeRemote) PortableRemoteObject.narrow(ref, ProcessPaymentHomeRemote.class);I thought one could invoke the above client code without the ejb-ref element being present in the ejb-jar.xml... I am right or wrong?
Then why the need for the ejb-ref element? Can anyone give me a concrete example of usage of the ejb-ref element where the ejb-ref element really is useful? What are the advantages of using the ejb-ref element?
Thanks in advance,
Julien Martin.Hi Julien,
The main reason is portability. It's true that in many J2EE implementations it is possible to access an EJB's Home object without going through the component context (java:comp/env), but all such approaches are NOT portable. In the J2EE programming model, all resource access is made via the private component namespace. Using this level of indirection allows the bean developer to code the application without having to know which physical resource will be used at runtime. Each J2EE implementation can use a different scheme to identity physical resources, so by sticking to logical references in your code, you guarantee portability. Finally, you have the advantage that you can change which physical resource is mapped at deployment time without having to change your code.
So, the bottom line is, whenever you have any J2EE component (ejb, servlet, jsp, Application Client) that looks up an ejb, data source, queue, connection factory, etc., always use the environment reference type that J2EE defines for it and look it up via java:comp/env.
--ken
Kenneth Saks
J2EE SDK Team
SUN Microsystems -
Weblogic-ejb-jar.xml : Are following extra tags harmless?
I am using xdoclets to generate descriptor file weblogic-ejb-jar.xml
for a BMP entity bean. Xdoclet is generating the descriptor file
alright, but is putting the following extra tags. This happens even
for samples which come with the download, so my tags in java file are
not wrong.
My question is, are the extra tags below harmless, or should I
manually go to each desciptor file and remove them?
Thanks.
----------- EXTRA TAGS GENERATED START ---------
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>
----------- EXTRA TAGS GENERATED END ---------
----------- TAGS I PUT IN JAVA CLASS START --------
* @ejb:bean name="com.ejb.entity.Customer"
* jndi-name="com.ejb.entity.CustomerHome"
* view-type="remote"
* type="BMP"
* primkey-field="com.ejb.entity.CustomerPK"
* reentrant="false"
* @weblogic:cache
* max-beans-in-cache="1000"
* read-timeout-seconds="900"
* concurrency-strategy="ReadOnly"
----------- TAGS I PUT IN JAVA CLASS END --------Those tags just declare that you are using our CMP provider and that
your descriptor is in META-INF/weblogic-cmp-rdbms-jar.xml.
FWIW, you might also want to check out EJBGen. It tends to keep more up
to date with WLS than xdoclet.
-- Rob
Gen wrote:
I am using xdoclets to generate descriptor file weblogic-ejb-jar.xml
for a BMP entity bean. Xdoclet is generating the descriptor file
alright, but is putting the following extra tags. This happens even
for samples which come with the download, so my tags in java file are
not wrong.
My question is, are the extra tags below harmless, or should I
manually go to each desciptor file and remove them?
Thanks.
----------- EXTRA TAGS GENERATED START ---------
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>
----------- EXTRA TAGS GENERATED END ---------
----------- TAGS I PUT IN JAVA CLASS START --------
* @ejb:bean name="com.ejb.entity.Customer"
* jndi-name="com.ejb.entity.CustomerHome"
* view-type="remote"
* type="BMP"
* primkey-field="com.ejb.entity.CustomerPK"
* reentrant="false"
* @weblogic:cache
* max-beans-in-cache="1000"
* read-timeout-seconds="900"
* concurrency-strategy="ReadOnly"
----------- TAGS I PUT IN JAVA CLASS END -------- -
Weblogic-ejb-jar.xml tags
can anybody tell me if the jndi name tag can come before the ejbtype-descriptor tag
like instead of the usual
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>MyTestSessionBean</ejb-name>
<stateless-session-descriptor>
<pool>
</pool>
<stateless-clustering>
</stateless-clustering>
</stateless-session-descriptor>
<transaction-descriptor>
</transaction-descriptor>
<jndi-name>MyTestSessionBean</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
can it be like
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>MyTestSessionBean</ejb-name>
<jndi-name>MyTestSessionBean</jndi-name>
<stateless-session-descriptor>
<pool>
</pool>
<stateless-clustering>
</stateless-clustering>
</stateless-session-descriptor>
<transaction-descriptor>
</transaction-descriptor>
<jndi-name>MyTestSessionBean</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
i think it should not be a problem as long as its within the <weblogic-enterprise-bean>: i am generating DDs for weblogic and ejbs and its a big applictaion i dont know if it will work or not. thanks in advance
Message was edited by sarmahdi at Sep 3, 2004 7:45 AMit seems that unfortunately i cannot but i really appreciate your answer:
ejbname should follow descriptor then jndi name i gues as i am having errors
<!ELEMENT weblogic-enterprise-bean (
ejb-name,
(entity-descriptor|
stateless-session-descriptor|
stateful-session-descriptor|
message-driven-descriptor
transaction-descriptor?,
iiop-security-descriptor?,
reference-descriptor?,
enable-call-by-reference?,
clients-on-same-server?,
(run-as-identity-principal|
run-as-principal-name
create-as-principal-name?,
remove-as-principal-name?,
passivate-as-principal-name?,
jndi-name?,
local-jndi-name?,
dispatch-policy?)
>
i am having this error: Module: core_ejb_sb.jar Error: [EJB:011024]The XML parser encountered an error in your deployment descriptor.
Please ensure that your deployment descriptor corresponds to the format in the DTD. The error was:
Error parsing file 'META-INF/weblogic-ejb-jar.xml' at line: 9 column: 29. The content of element
type "weblogic-enterprise-bean" must match "
(ejb-name,
(entity-descriptor|stateless-session-descriptor|stateful-session-descriptor|message-driven-descriptor)?,
transaction-descriptor?,iiop-security-descriptor?,reference-descriptor?,enable-call-by-reference?,clients-on-same-server?,(run-as-identity-principal|
run-as-principal-name)?,create-as-principal-name?,remove-as-principal-name?,passivate-as-principal-name?,jndi-name?,local-jndi-name?,dispatch-policy?)"
i guess i have to change the format now. -
Where do I find toplink-ejb-jar.xml?
I've been trying to run the examples I downloaded with TopLink 10g as I'm trying to migrate to TopLink 10 for Weblogic 8.1 from TopLink 3.6 for Weblogic 6.1 and I can't find the toplink-ejb-jar.xml file that is referenced in the weblogic-ejb-jar.xml file in the <type-storage> tag. I have looked for it in all samples dir (weblogic 6.1, 7.0 and 8.1) with no luck.
Are they missing from the samples? I have looked at the Ant's build.xml file and it seems the file should be with all the rest of the .xml files conforming the "config" of the EJBs
I'm sorry if I'm missing something obvious but I'm stucked on this.
Thanks in advance.
Ignacio.Founded it. In case someone face the same problem here is the "solution":
It is "copied and renamed" from the resources/WLS81CMP20SingleBeanTopLink.xml file
Regards
Ignacio -
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. -
How will be the weblogic-ejb-jar and ejb-jar xml for EJB Local Interface?
Hi,
I have one ear application which is using Stateless Session Beans. I don't have any Bean to Bean communication . At present, the client is invoking remote methods thro Home/Remote interfaces. My doubt is , shall I implement EJBLocal home/ local interface to obtain this same functionality cos, in this app, both client and EJb bean have been deployed in same JVM. Can Local interfaces only be applicable to Bean - Bean relation ship?If LocalHome/Local interfaces can be implemented in my scenario, then may I know how will be the ejb-jar.xml and weblogic-ejb-jar.xml?
thanks and regards,
Venkat.Local interfaces are for communication between ejbs and their clients when both are in the same JVM. The clients can be normal clients, jsps, servlets, and other ejbs. If the client is not in the same JVM you cannot use local interfaces even though your client is another ejb.
Advantage of using local interface is it reduces the network overhead.
For more information you can download Mastering Enterprise Java Beans Third Edition by Ed Roman. You can go through 45
You can download pdf version from.
http://www.theserverside.com/books/wiley/masteringEJB/index.tss.
Let me know the URL of the ejb doc that you referred.
Thanks.. -
Disable-warning statement in weblogic-ejb-jar.xml
I'm having problems with the <disable-warning> statement in the weblogic-ejb-jar.xml file. I havn't been able to find documentation on exactly where the statment is supposed to be placed, as all sites just say to include the statement in your weblogic-ejb-jar.xml file. I found a working solution where I placed the statement after declaring all the weblogic-enterprise-bean and right before the closing </weblogic-ejb-jar> statment.
Now the problem is that I have included a <transaction-isolation> block and weblogic complains about my disable warning statment.
Does anyone know the proper location for the <disable-warning> statement?
here is the format that was working before:
</weblogic-enterprise-bean>
<disable-warning>BEA-010054</disable-warning>
</weblogic-ejb-jar> now I have:
</weblogic-enterprise-bean>
<transaction-isolation>
<isolation-level>TRANSACTION_READ_COMMITTED</isolation-level>
<method>
</method>
</transaction-isolation>
<disable-warning>BEA-010054</disable-warning>
</weblogic-ejb-jar>I have tried putting the disable warning before the transaction-isolation and after and weblogic complains about both.
Any Ideas?
Thanks for your time.I have tried putting the disable warning beforethe
transaction-isolation and after and weblogic
complains about both.
Any Ideas?It would be a good idea to post the message weblogic
is displaying. There are a couple of things you could
check:
* As per the documentation, the <disable-warning> tag
was added in 8.1. Check if you are using the correct
DTD for Weblogic 8.1 (and the version of Weblogic
is 8.1 or higher
* As per the DTD, the <disable-warning> comes after
the <transaction-isolation>
<!ELEMENT weblogic-ejb-jar (description?,
weblogic-enterprise-bean*,
security-role-assignment*,
run-as-role-assignment*,
security-permission?,
transaction-isolation*,
idempotent-methods?,
enable-bean-class-redeploy?,
disable-warning*)
ke sure you maintain this order of elements within
<weblogic-ejb-jar>
Refer to
http://e-docs.bea.com/wls/docs81/ejb/DDreference-ejb-j
ar.htmlYep, it was pointing to an older dtd. Thank you! -
JDeveloper / OC4J rewriting my orion-ejb-jar.xml
Hi All.
Im having a play around with OC4J and CMP entity beans and struts at the moment learning some stuff for a new job, so ive started to write a little test app to get used to things.
Ive created a CMP entity - CustomerEntityEJB, manually defined the tables etc wrote and built it using JDeveloper 10.
Ive created all the necessary classes and descriptors in JDeveloper and the bean compiles and deploys fine, however no matter what i do, the table attribute of the <entity-deployment> elemnt is ALWAYS removed from the orion-ejb-jar.xml file before its deployed and i have no idea why.
Here are some snippets form the xml config files im using....
ejb-jar.xml :
<entity>
<description>Entity Bean ( CMP )</description>
<display-name>CustomerEntityEJB</display-name>
<ejb-name>CustomerEntityEJB</ejb-name>
<local-home>com.gb.ejb.entity.customer.CustomerEntityEJBLocalHome</local-home>
<local>com.gb.ejb.entity.customer.CustomerEntityEJBLocal</local>
<ejb-class>com.gb.ejb.entity.customer.CustomerEntityEJBBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Long</prim-key-class>
<reentrant>false</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>CustomerEntityEJB</abstract-schema-name>
<cmp-field>
<field-name>id</field-name>
</cmp-field>
<cmp-field>
<field-name>title</field-name>
</cmp-field>
<cmp-field>
<field-name>forename</field-name>
</cmp-field>
<cmp-field>
<field-name>surname</field-name>
</cmp-field>
<cmp-field>
<field-name>email</field-name>
</cmp-field>
<cmp-field>
<field-name>password</field-name>
</cmp-field>
<cmp-field>
<field-name>active</field-name>
</cmp-field>
<primkey-field>id</primkey-field>
<query>
<query-method>
<method-name>findAll</method-name>
<method-params/>
</query-method>
<ejb-ql>SELECT OBJECT(c) FROM CustomerEntityEJB c</ejb-ql>
</query>
</entity>
orion-ejb-jar.xml as in JDeveloper:
<?xml version = '1.0' encoding = 'windows-1252'?>
<orion-ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-ejb-jar-10_0.xsd" schema-major-version="10" schema-minor-version="0">
<enterprise-beans>
<persistence-manager name="toplink"/>
<session-deployment name="CustomerSessionEJB" local-location="CustomerSessionEJB" />
<entity-deployment name="CustomerEntityEJB" data-source="jdbc/PostgresDS" table="Customer" local-location="CustomerEntityEJB">
<primkey-mapping>
<cmp-field-mapping name="id"/>
</primkey-mapping>
<cmp-field-mapping name="active"/>
<cmp-field-mapping name="email"/>
<cmp-field-mapping name="forename"/>
<cmp-field-mapping name="id"/>
<cmp-field-mapping name="password"/>
<cmp-field-mapping name="surname"/>
<cmp-field-mapping name="title"/>
</entity-deployment>
</enterprise-beans>
</orion-ejb-jar>
orion-ejb-jar.xml as viewed in the OC4J enterprise manager.
<?xml version="1.0" encoding="utf-8"?>
<orion-ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-ejb-jar-10_0.xsd" deployment-version="10.1.3.3.0" deployment-time="1151415a0e3" schema-major-version="10" schema-minor-version="0" >
<enterprise-beans>
<persistence-manager name="toplink" class="oracle.toplink.internal.ejb.cmp.oc4j.Oc4jPersistenceManager" descriptor="toplink-ejb-jar.xml">
</persistence-manager>
<session-deployment name="CustomerSessionEJB" location="CustomerSessionEJB" local-location="CustomerSessionEJB" persistence-filename="CustomerSessionEJB">
<ejb-ref-mapping name="ejb/local/CustomerEntityEJB" location="TWA-EJB_CustomerEntityEJBLocal" />
</session-deployment>
<entity-deployment name="CustomerEntityEJB" location="CustomerEntityEJB" local-location="CustomerEntityEJB" concrete-bean-class="CustomerEntityEJB_ConcreteSubClass3" data-source="jdbc/PostgresDS" local-wrapper="CustomerEntityEJBLocalHome_LocalEntityHomeWrapper5">
</entity-deployment>
</enterprise-beans>
<assembly-descriptor>
<default-method-access>
<security-role-mapping name="<default-ejb-caller-role>" impliesAll="true" />
</default-method-access>
</assembly-descriptor>
</orion-ejb-jar>
As you can see, the orion-ejb-jar.xml that been deployed on the server has had extra attributes defined in it (like concrete-bean-class) which makessense - its adding in the bits i didnt to get th bean to deploy - however the table attribue is just removed, meaning my bean cant find the table - hence my app not working.
i just dont know how to stop this and would be extremely grateful if someone could give me a clue how to get my bean up and working properly as this is driving me insane.
Thanks in advance..
Gareth.sorted - the <persistence-manager name="toplink"/> element was automatically generated by JDeveloper and put in my orion-ejb-jar.xml appears to be un necessary and seemed to be breaking eveything - as soon as i removed it, the bean seemed to deploy ok and pick up the table name =]
as a bit of an aside does anyone know why it was automatically put there in the first place if it breaks things? -
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 -
O/R tool generates invalid ejb-jar.xml for 1-n cmp bean-to-bean relations
TopLink generates:
<ejb-relation>
<ejb-relation-name>Parent-Child</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>Parent-has-childs</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source>
<ejb-name>Parent</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>childs</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>child-owned-by-Parent</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<cascade-delete></cascade-delete>
<relationship-role-source>
<ejb-name>Child</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
what's wrong?
it's missing the following tag:
'<cmr-field-type>java.util.Collection</cmr-field-type>'
which should be in the <cmr-field> element after the <cmr-field-name>.
I cannot get the UI tool to add this tag, whenever I manually add it to the ejb-jar.xml it gets removed the next time I generate the ejb-jar.xml. Additionally, if I try to update the project from the ejb-jar.xml, the O/R tool loses ALL my mappings for entity beans.
Expected questions:
TopLink 9.0.3
WebLogic 7.0.1
CMP 2.0
JDK 1.3.1_03
Yes the getter/setter are defined (on the local interface and bean)
FYI,
AndrewThis should take care of it
<ejb-jar>
<enterprise-beans>
<entity>
<ejb-name>IDMaster</ejb-name>
<home>maxateev.mondial.brg.idmaster.IDMasterHome</home>
<remote>maxateev.mondial.brg.idmaster.IDMaster</remote>
<local-home>maxateev.mondial.brg.idmaster.IDMasterLocalHome</local-home>
<local>maxateev.mondial.brg.idmaster.IDMasterLocal</local>
<ejb-class>maxateev.mondial.brg.idmaster.IDMasterEJB</ejb-class>
<persistence-type>Container</persistence-type>
<ejb-local-ref>
<ejb-ref-name>ejb/IDMasterLocalHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>maxateev.mondial.brg.idmaster.IDMasterLocalHome</local-home>
<local>maxateev.mondial.brg.idmaster.IDMasterLocal</local>
</ejb-local-ref>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>IDMaster</abstract-schema-name>
<cmp-field>
<field-name>idPrefix</field-name>
</cmp-field>
<cmp-field>
<field-name>idValue</field-name>
</cmp-field>
<primkey-field>idPrefix</primkey-field>
<ejb-local-ref>
<ejb-ref-name>ejb/IDMasterLocalHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>maxateev.mondial.brg.idmaster.IDMasterLocalHome</local-home>
<local>maxateev.mondial.brg.idmaster.IDMasterLocal</local>
</ejb-local-ref>
<query>
<query-method>
<method-name>findAllIDMasters</method-name>
<method-params/>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT (f) FROM IDMaster as f]]></ejb-ql>
</query>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>IDMaster</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar> -
Can't create a JAXB binding for ejb-jar.xml using xjc
Hi all,
I have been trying to build a JAXB binding for EJB deployment descriptors, mainly because I have to update a hand-cranked ejb-jar.xml file on the fly with some additions that have come from a code generator.
I have tried to use
xjc ejb-jar_2_1.xsd j2ee_1_4.xsd ejb-jar_2_1.xsd
xjc on the schema definitions I found at http://java.sun.com/xml/ns/j2ee/ but I can't get it to work. It produces reams of errors, see below for a short extract.
Of course, someone could put me out of my misery and tell me where to find a binding that someone else has done. I can't be the first chimp on the planet that has wanted to do this!
Any help much appreciated.
errors:
[WARNING] warning: "blockDefault" attribute of <schema> is not supported
line 3 of xml.xsd
[WARNING] warning: "finalDefault" attribute of <schema> is not supported
line 3 of xml.xsd
[WARNING] warning: <key> identity constraint will be ignored by JAXB validation
line 117 of j2ee_web_services_client_1_1.xsd
[WARNING] warning: <key> identity constraint will be ignored by JAXB validation
line 115 of ejb-jar_2_1.xsd
[WARNING] warning: <keyref> identity constraint will be ignored by JAXB validation
line 129 of ejb-jar_2_1.xsd
[WARNING] warning: <key> identity constraint will be ignored by JAXB validation
line 145 of ejb-jar_2_1.xsd
[WARNING] warning: <keyref> identity constraint will be ignored by JAXB validation
line 159 of ejb-jar_2_1.xsdException initializing 'oracle.dbtools.raptor.MonitorJDBCAddin' in extension 'Oracle SQL Developer': oracle.classloader.
util.AnnotatedNoClassDefFoundError:
Missing class: oracle.jdbc.OracleDriverThe Oracle driver is not on the classpath.
Maybe you are looking for
-
Display settings on DVD player
I'm authoring a DVD for a live show. The disk has 30 or so tracks with 30 menus. ie. track one finishes and jumps to menu two untill operator presses enter etc etc.. He needs to be able to see what menu is loaded on the dvd player display. Can anyon
-
Main Window display when line items are less in next page.
Hi all, In the smartform,if the line items extend to second page, then to print complete main window in second page and if there are only few line items in second page, how to remove the empty spaces in the nmain window and to print other wind
-
In which context is data stored in web dynpro component
in which context is data stored in webdynpro component
-
How to get project guid to task
Hello all, I am looking for a method which delivers me the project guid or object for a certain task I selected. Table names would do the trick as well. Thanks in advance. Jochen
-
Chromium 8.0.552 pdf issue
Hi all, After install chromium 8.0.522, the embedded pdf plugins is missing. Do you know why? PS: I mean the pdf plugins from google, not adobe. I could use it under windows.