EJB 3.0 and Struts 1.0
Have a Struts/EJB question...
If I have a web-form backed by an ActionForm in Struts, where the user
types in a record that maps directly to an EJB3 entity class and a
corresponding db-table, is it advisable (or even possible) to somehow
use the same class for the ActionForm and the EJB?
Im thinking the 2 beans, they have basically the same setter/getter
methods,
but the form-bean extends ActionForm, while the Entity class
implements serializable...
Is it possible to use one and the same class for both purposes... or
maybe one extends the other...
Or should they just be two different classes, and have to copy data
back and forth between them?
What is "best practice" here?
Edited by: vb.bajpai on Feb 13, 2009 4:13 AM
Well, the "best practice" is the one that better fits for you. Your idea of making another bean for struts, has been thought before. That technique is called "DTO Pattern". Search the java blueprints for the DTO Pattern.
So you have 2 options
Use EJB entities through all your app
pros: less code to write
cons: highly coupled code. struts must stick to your EJB entity beans.
Use the DTO pattern
pros: loose coupled design. you can change your entities and your struts forms wont be affected.
cons: more code to write. You may need help from a bean to bean mapper like dozer or ezconvert
PS: DTO (Data Transfer Object), VO (Value Object), and TO (Transfer Object) are all synonyms.
Similar Messages
-
Oracle Database Lite deploying EJBs and struts
I need to deploy my enterprise application on Mobile server. My application uses EJBs and struts, are EJBs and Struts supported by Oracle Database Lite Mobile server? If yes do we need to do anything different for deploying EJBs on Mobile Server?
Regards
RoomapAlready posted a response to this here today
New Application -
Please hepl me. i m intergrating ejb3 and struts in two server. but is not working
it is simple application i m runing in tow server but i m get classsnotfound error pleas solve my problem. i will give my direct structure of application
i m runing ejb3 in weblogic 10.3 and struts in tomcat server. both communication is not happening pleas help me. i m try from many days. But is not working form me
root dir
onlyenb6
account class
package ejb3.onlyejb;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class account implements Serializable{
@Id
int accno;
public int getAccno() {
return accno;
public void setAccno(int accno) {
this.accno = accno;
public String getName() {
return name;
public void setName(String name) {
this.name = name;
public float getBalance() {
return balance;
public void setBalance(float balance) {
this.balance = balance;
String name;
float balance;
Int6_clss code
package ejb3.onlyejb;
import java.io.Serializable;
public interface Int6_cls extends Serializable {
public void storing(int acc, String name, float amt);
Session.class code
package ejb3.onlyejb;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@Stateless(mappedName="saigoud")
@Remote
public class Session_ben implements Int6_cls {
@PersistenceContext
EntityManager mrg;
public void storing(int acc, String name, float amt) {
System.out.println("session="+acc);
System.out.println("sess="+name);
account accs=new account();
accs.setAccno(acc);
accs.setName(name);
accs.setBalance(amt);
mrg.persist(accs);
build.xml
<project name="onlyejb5" default="saifile">
<property name="bea.home" value="C:/bea"/>
<property name="wl_home" value="${bea.home}/wlserver_10.3"/>
<path id="main.class.path">
<pathelement path="${bea.home}/modules/com.bea.core.utils_1.4.0.0.jar"/>
<pathelement path="${bea.home}/modules/com.bea.core.jarbuilder_1.2.0.0.jar"/>
<pathelement path="${java.class.path}"/>
</path>
<target name="saifile">
<echo message="***ANT Script should run from inside the ${wl.home}/server/lib *****" />
<echo message="***** ********* ********* *****" />
<java classname="com.bea.jarbuilder.JarBuilder">
<classpath refid="main.class.path"/>
<jvmarg value="-d ${wl.home}/server/lib -jar wljarbuilder.jar"/>
</java>
</target>
</project>
after run with ant i get successfully create wlfullclient.jar
i m taking this wlfullclient.jar and pasting in tomcat lib directery and run webapplication
my webapplication code
package ejb3.onlyejb;
import java.io.Serializable;
public interface Int6_cls extends Serializable {
public void storing(int acc, String name, float amt);
package ejb3.onlywed;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Properties;
import javax.ejb.EJB;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import ejb3.onlyejb.Int6_cls;
public class Action_cls extends Action {
public ActionForward execute(ActionMapping map, ActionForm fm, HttpServletRequest req, HttpServletResponse res)
throws IOException{
String respkey="fails";
Action_form_bean bean=(Action_form_bean)fm;
int ac=bean.getAccno();
String na=bean.getName();
float bal=bean.getAmt();
System.out.println("accno="+ac);
System.out.println("na="+na);
System.out.println("bal="+bal);
System.out.println("enter in to if loop");
Hashtable p=new Hashtable();
p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL,"t3://localhost:7001");
System.out.println("jndi properties nuderprocess");
try {
System.out.println("loading p file="+p);
InitialContext ic = new InitialContext(p);
System.out.println("loading p file over="+ic);
System.out.println("jndi file is loaded");
//System.out.println("wrs="+wrs);
System.out.println("entry in try block");
Int6_cls wrs=(Int6_cls)ic.lookup("saigoud#ejb3.onlyejb.Int6_cls");
System.out.println("lookup susfull");
wrs.storing(ac, na, bal);
respkey="ok";
} catch (NamingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
catch (Exception e) {
// TODO: handle exception
ActionForward fw=map.findForward(respkey);
return fw;
get error
accno=44
na=hjhjhj
bal=777.0
enter in to if loop
jndi properties nuderprocess
jndi properties nuderprocess22
loading p file={java.naming.provider.url=t3://localhost:7001, java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory}
loading p file over=javax.naming.InitialContext@12f9bcd
jndi file is loaded
entry in try block
Jul 5, 2013 1:36:22 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet action threw exception
java.lang.ClassNotFoundException: ejb3.onlyejb.Int6_cls
at weblogic.ejb.container.deployer.RemoteBizIntfClassLoader.getClassBytes(RemoteBizIntfClassLoader.java:151)
at weblogic.ejb.container.deployer.RemoteBizIntfClassLoader.loadClass(RemoteBizIntfClassLoader.java:96)
at weblogic.ejb.container.internal.RemoteBusinessIntfGenerator.generateRemoteInterface(RemoteBusinessIntfGenerator.java:54)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.readObject(RemoteBusinessIntfProxy.java:205)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1846)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:197)
at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:564)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:193)
at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:62)
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:240)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
at weblogic.jndi.internal.ServerNamingNode_1030_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:392)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at ejb3.onlywed.Action_cls.execute(Action_cls.java:62)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)Locking multipost.
-
Ann: North East Conference on MVC Frameworks and Struts in 3 weeks:
Ann: North East Conference on MVC Frameworks and Struts in 3 weeks:
Most people already know what MVC is, once you know what it is, here is the next step. Presenting will be the popular frameworks and components in use by 8 speakers:
-Ted Husted Author Struts Chains/2.0 the dominant framework in use, from Ziff Davis, to Apple Store to most large commercial sites.
Husted.com
-Rod Johnson Author EJB/Spring
springFrameWork.com
-Christophe Coenraets Flex-MacroMedia - back to rich UI w/SOA (Great blog entry on Struts + Flex)
markMe.com/cc
-Howard Lewis Ship Author HiveMind (SOA, IOC, AOP) commonly referred to as the next big thing
javaTapestry.blogspot.com
-Clinton Begin DAO/iBatis/SQLMaps the best DAO layer
imo, used by Spring, jPetStore, basicPortal, etc.
-Matt Raible Author displayTag/strutsMenu (displayTag is my favorite J2EE component)
Raibledesigns.com
-Jason Carreira WebWork 2
freeroller.net/page/jCarreira
- Vic Cekvenich Author basicPortal (J2EZ easy and simple to customize application for membership, portal, cms, community, store, etc. using bestPractices for large, profitable commercial sites. )
+ more
You will get a CD mailed to you once you register.
April 3rd from 8AM to 7PM in NYC at nyhotel.com, next to MSG. Advertised in JDJ, NY Times, etc. My guess is that you wont find half as many good sessions at Suns Java One.
It $99 to register now at baseBeans.com, in a few day's price keeps going up.Hey Jan,
Oracle's E-Business suite is moving to a JSF solution. This is really for three main reasons (abbreviated version):
1) JSF is much more focused on the 'view' components. The component model has a clean separation of the component definition from its rendering. This, among many other things, allows us to provide a consistent development environment and APIs for developers building apps for browsers, mobile devices, telnet devices, etc.
2) JSF has a better defined lifecycle. The JSF lifecycle maps much closer to the phases that enterprise applications need when processing data from a web application. We are able to easily extend this to add things not currently in the spec, like portlets, wireless, etc., as well as more easily plug new components into the framework.
3) Once you remove the JSP tags & FormBean from Struts, all you are left with is the navigation. There is nothing special in the Struts navigation that would cause us to try to make the two technologies work together. In fact, the Faces navigation will not be robust enough in its current form to support the declarative navigation requirements for Oracle apps. We plan to extend the JSF navigation and then work to submit that back into the standards.
Hope this helps,
Ted Farrell
Oracle Corporation. -
Problem with "package-info.java" using EJB 3.0 and OC4J
Hi all.
I already posted this question on JDeveloper forum, but didn't get any answer,
so I'll try posting here.
Anyway, I'm new both to JDeveloper and J2EE,
so I'm trying out examples for EJB 3.0, and I got stuck at "Use Security Annotations with EJB 3.0"
(http://www.oracle.com/technology/tech/java/oc4j/ejb3/howtos-ejb3/howtoejb30security/doc/how-to-ejb30-security-ejb.html).
Example code is working perfectly, if one builds it using Ant, but I'm importing all examples into JDeveloper (or at least I'm trying to :))
JDeveloper can't build file "package-info.java" containing following code:
@javax.annotation.security.SecurityRoles(roleNames={"superuser", "user"})
package oracle.ejb30;I'm getting following output in "Compiler - Log" window:
Error(2,1): 'class', 'interface', or 'enum' expected.
Help much appreciated...
platform used:
Windows XP SP2
JDeveloper Studio (Version 10.1.3, Build 3412)
JDK 1.5_06
OC4J 10.1.3 developer preview 4 (standalone version)Since you're using EJBs, you can use JTA and can skip the getTransaction() calls. If you want to use getTransaction().begin() and commit(), then make sure that your EntityManager is resource-local. The configuration for this is in persistence.xml. Set a transaction-type of RESOURCE_LOCAL rather than JTA.
-
If I drag and drop tables with One to one mapping in an ejb diagram in JDeveloper (one table have having the foreign key as the primary key). If I create ejb 2.1 beans it makes makes a One To One mapping between the entity beans created and if I drop them as ejb 3.0 it makes a OneToMany mapping. this is what I get for the same tables.
for ejb 2.1
<ejb-relation>
<ejb-relation-name>Envincidents - Incidents</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>Envincidents has one Incidents</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source>
<ejb-name>Envincidents</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>incidents_incidentsId</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>Incidents may have one Envincidents</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source>
<ejb-name>Incidents</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
for ejb 3.0
Envincidents
@Id
@ManyToOne(targetEntity="mypackage.Incidents")
@JoinColumn(name="ENVINCIDENTS.INCIDENTS_ID", referencedColumnName="INCIDENTS.ID")
public Incidents getIncidents() {
return incidents;
public void setIncidents(Incidents incidents) {
this.incidents = incidents;
Incidents
@OneToMany(targetEntity="mypackage.Envincidents")
@JoinColumn(name="ENVINCIDENTS.INCIDENTS_ID", referencedColumnName="INCIDENTS.ID")
public Collection<Envincidents> getEnvincidentsCollection() {
return envincidentsCollection;
public void setEnvincidentsCollection(Collection<Envincidents> envincidentsCollection) {
this.envincidentsCollection = envincidentsCollection;
public Envincidents addToEnvincidentsCollection(Envincidents envincidents) {
getEnvincidentsCollection().add( envincidents );
envincidents.setIncidents( this );
return envincidents;
public Envincidents removeFromEnvincidentsCollection(Envincidents envincidents) {
getEnvincidentsCollection().remove( envincidents );
envincidents.setIncidents( null );
return envincidents;
this causes the following problem.
Exception Description: Multiple writable mappings exist for the field [ENVINCIDE
NTS.INCIDENTS_ID]. Only one may be defined as writable, all others must be spec
ified read-only.
which I have already reported.
I know this is a minor inconvenience and I can hand edit the entity beans and make them one to one for ejb 3.0. But would be to good advantage to have a consistent "dropping of tables" for ejb 2.1 and 3.0. So one can have a similar behavior of entity beans created from tables using ejb 2.1 and 3.0.I guess this could be desirable if migrating from ejb 2.1 to 3.0 if one has already designed the database.
Dev -
Ejb 3.0 and webservices
Hello everybody?
Does everybody know if i can create a web service from an ejb 3.0 stateless session inside jdeveloper 10 g 10.1.3 (using a wizard for example)?
Thank youIt's almost too easy to need a wizard - try this:
Trhough your project properties add the JSR-181 Web Service library
In your session bean type @Web (at the top of the class or above a method) and you'll be prompted to import javax.jws.WebMethod (using Alt-Enter) then you can select the appropriate tag (@WebService for all methods to be published, @WebMethod at the individual method level, etc.)
Then deploy your EJB as normal and voila! See the deployed EJB and Web Service
Rgds
Susan -
Can any body give some info on integration of JSF to existing struts application
I describe the main differences between JSF and Struts in this sample Chapter from my JSF book:
http://www.oreilly.com/catalog/jsvrfaces/chapter/ch01.pdf
Hope that helps. -
JSF and Struts - differences and integration goal.
I am a newbie J2EE developer and I am not clear about main differences between JSF and Struts also I saw couple of articles describing integration between JSF and Struts. Could someone give me an explanation, what the main conceptual differences between those technologies and what's the goal of integration both of them?
I describe the main differences between JSF and Struts in this sample Chapter from my JSF book:
http://www.oreilly.com/catalog/jsvrfaces/chapter/ch01.pdf
Hope that helps. -
Does Oracle ADF UIX use Struts components internally? If yes, Does Oracle Support the issues that arises because this internally used Struts components? (I am using Oracle ADF in my application.
Thanks,
Aravind.DataForwardAction and DataAction are build on top of struts actions to coordinate ADF databindings and it's life cycle;
UIX, has xmlns:struts="http://xmlns.oracle.com/uix/struts" this XML namespace has some elements like
<struts:form> and <struts:messageTextInput> also <struts:dataScope>
They work like struts jsp tag;
here a good paper;
http://download-west.oracle.com/otn_hosted_doc/jdeveloper/904preview/uixhelp/uixdevguide/struts.html
Marcos Ortega
Brazil -
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 -
Looking up Identical EJB both locally and remotely
prior to posting this request, i have read and
attempted multiple solutions to this problem
suggested in the forums to no avail.
if i have the same EAR, which contains both
an EJB Component and a WAR, deployed to multiple
servers, is it possible to look up an EJB both
locally and remotely?
for instance, on the server performing the lookup,
EJB A is deployed. i successfully look it up
via the following call:
InitialContext context = new InitialContext();
Object ref = context.lookup(name);
return javax.rmi.PortableRemoteObject.narrow("EJBA", EJBAClass.class);
subsequently, i try to lookup the same ejb
on a remote server by performing the following
calls:
Properties environment = new Properties();
environment.put("java.naming.factory.initial", "com.evermind.server.rmi.RMIInitialContextFactory");
environment.put("java.naming.provider.url",
"ormi://remoteserver:23791/application");
environment.put( "java.naming.security.principal", "user");
environment.put( "java.naming.security.credential", "password");
jndiContext = new InitialContext(environment);
Object ref = context.lookup(name);
return javax.rmi.PortableRemoteObject.narrow("EJBA", EJBAClass.class);
however, i either receive an authentican exception, saying "user"
doesnt have access to allication "application", or a null pointer
exception int the RMIInitialContext.
on my local application, i have defined my ejbs in the web.xml
as defined by the spec. the ejb component is marked as remote="false"
in my orion-application.xml as well.
the version of oc4j is 1.0.2.2.1.
any directinon on this would be greatly appreciated.
thanks,
ted riceas a follow up to my own question, using a application
client, outisde of the web application i can
successfully look up my ejbs locally and remotely.
however, from within the web application, i constantly
receive a ClassCastException.
if no one can tell me how to resolve this, could someone
let me know if they have in fact looked up the
same EJB, both deployed locally and remotely, from the
same web application.
thanks,
ted -
Difference between ejb 3.0 and hibernate
Hi, I'm new at ejb 3.0 and I've read a little about Hibernate too, but there's one thing I don't understand. Could you tell me what's the difference between using ejb 3.0 and Hibernate, both of them are for persistence, and What about toplink?
Hi, I'm new at ejb 3.0 and I've read a little about Hibernate too, but there's one thing I don't understand. Could you tell me what's the difference between using ejb 3.0 and Hibernate, both of them are for persistence, and What about toplink?
-
JDev 1013 BUG? EJB, CMR, DTO and session facade.
I've created two CMP Entity EJB's, CourseEJB and PupilEJB, and defined a M:N relationship between them. A course has many pupils and vice versa. Each bean has only two attributes, id (Long, part of PK) and name (String) for simplicity.
1. Generated DTO's for the two beans won't compile
I get error on:
public void addcourseEJBLocalDTO(courseEJBLocalDTO courseEJBLocalDTO)
coursesDTO.add(courseEJBLocalDTO);
courseEJBLocalDTO.setPupilsDTO(this);
and:
public void addPupilEJBLocalDTO(PupilEJBLocalDTO pupilEJBLocalDTO)
pupilsDTO.add(pupilEJBLocalDTO);
pupilEJBLocalDTO.setCoursesDTO(this);
because JDev has created definitions of the setCoursesDTO function like this:
public void setCoursesDTO(Collection<courseEJBLocalDTO> coursesDTO)
this.coursesDTO = coursesDTO;
and ditto for the setPupilsDTO method, taking a Collection as argument too.
I can fix this code manually, but next step, generating a session Facade with added methods for handling the entity beans isn't exactly any better...
One M:N relation is pretty basic, am I doing something wrong here?
Message was edited by:
jonmartiForgot to add, running on 1013
-
JSR 168 and Struts support sample error
I'm trying to get the sample webapp for JSR 168 and Struts support working with
WebLogic 8.1, and I'm having problems with the struts portlet. The other portlets
seem to work fine, but the Struts portlet gives the following error after clicking
"Save" on most of the forms:
Page Flow Error - Action Not Found
Page Flow: Global.app
Action: html-setters.do
Unable to find action html-setters.do.
That error appears in the browser. At the same time, the following exception
appears in the server window:
<Aug 18, 2003 4:34:12 PM EDT> <Error> <netui> <BEA-420012> <There was an error
while running a lifecycle stage :: Lifecycle: UIControl.render :: for the control
:: null ::.
com.bea.netuix.nf.UIControlException: For portlet [strutsPortlet], could not do
page flow lookup for the given action [html-setters.do] in the given PageFlow:
[struts/exercise-taglib].
This exception is followed by hundreds of lines of the following:
at com.bea.wlw.netui.pageflow.scoping.ScopedServletUtils.strutsLookup(ScopedServletUtils.java:363)
as well as several stack overflow errors.
I believe I have installed the JSR168 and Struts support package according to
the instructions, and have copied the required jars into the samples WEB-INF/lib
directory. I also have tried to write my own Struts application in a portlet,
and it gets the exact same errors when I try to submit a form to my actions.
Any insight would be much appreciated!
Thanks,
PatrickHi Brodi,
I am having the same problem as Patrick. The problem is not in the struts portlet,
but in the forms the portlet navigates to. After the struts portlet loads, I
am able to use the html:links and navigate through the pages. Though when I try
to submit a form I get the action not found error. For example the html-select
page has a form. This page loads fine, but when I hit the save button I get the
following error.
<Aug 25, 2003 11:00:00 AM EDT> <Error> <netui> <BEA-420012> <There was an error
while running a lifecycle stage :: Lifecycle: UIControl.render :: for the contro
l :: null ::.
com.bea.netuix.nf.UIControlException: For portlet [strutsPortlet], could not do
page flow lookup for the given action [html-select.do] in the given PageFlow:
struts/exercise-taglib].
The application appears to loose the struts context. It tries to find the localhost:7001/samples/html-select.do
action instead of localhost:7001/samples/struts/exercise-taglib/html-select.do
action. How do I keep the application from loosing context?
Thank you,
Karen
"Brodi Beartusk" <[email protected]> wrote:
>
Patrick-
I've seen similar things happen when the module name is either not specified
correctly
in the StrutsContent element in the portlet, or when the module is misconfigured,
usually because of either a mising config file or a mis-named config
file.
Ensure that you have a the struts config file for the exercise-taglib
module in
WEB-INF, named jpf-struts-config-struts-exercise-taglib.xml.
-Brodi Beartusk
"Patrick Callis" <[email protected]> wrote:
I'm trying to get the sample webapp for JSR 168 and Struts support working
with
WebLogic 8.1, and I'm having problems with the struts portlet. Theother
portlets
seem to work fine, but the Struts portlet gives the following errorafter
clicking
"Save" on most of the forms:
Page Flow Error - Action Not Found
Page Flow: Global.app
Action: html-setters.do
Unable to find action html-setters.do.
That error appears in the browser. At the same time, the followingexception
appears in the server window:
<Aug 18, 2003 4:34:12 PM EDT> <Error> <netui> <BEA-420012> <There was
an error
while running a lifecycle stage :: Lifecycle: UIControl.render :: for
the control
:: null ::.
com.bea.netuix.nf.UIControlException: For portlet [strutsPortlet], could
not do
page flow lookup for the given action [html-setters.do] in the given
PageFlow:
[struts/exercise-taglib].
This exception is followed by hundreds of lines of the following:
at com.bea.wlw.netui.pageflow.scoping.ScopedServletUtils.strutsLookup(ScopedServletUtils.java:363)
as well as several stack overflow errors.
I believe I have installed the JSR168 and Struts support package according
to
the instructions, and have copied the required jars into the samples
WEB-INF/lib
directory. I also have tried to write my own Struts application ina
portlet,
and it gets the exact same errors when I try to submit a form to myactions.
Any insight would be much appreciated!
Thanks,
Patrick
Maybe you are looking for
-
Issue with Default Variable in WAD after Java Patch 7.01.7.31
Hello all, I'm running into an issue with the Web Application Designer Template execution for a particular default variable. This started occuring after Java Patch 7.01.7.31 we had implented over the weekend. The issue is when Executing the WAD Templ
-
Open Items List Production Orders
I have been having issues with my inventory quantities. After a little investigating I have found that a majority if not all my production orders are within in the Open Items List. I had the Idea that once you copy from a production order into Rec
-
InDesign Folio Error // Book
Hi, We are running into very strange problem very frequently, very recently. We have individual InDesign documents paginated as Chapters/Articles, and when we create PS or Export PDF, everything looks fine. Whereas, when we create InDesign Book (to c
-
Accessing what has been published - On Delivery Architecture
Hi All, I was wondering if there is any way of getting access to what has been published on the content delivery machine when a template executes on delivery. I want to be able to interrogate the latest items, based upon publish date; think of the re
-
N95 with more ca[acity memory cards?
Iam a user of N95-1 which after the new firmware V.20 is better but still has some bugs in the keypad sometimes, but with a good general performance including battery life. I need more space, all of us who experience the satisfaction of having comple