ejb-local-ref usage
Hi
Can someone explain me exact use of this <ejb-local-ref>
tag. I have seen ejb running without this config also and most of the professionally written ejb have this. When should this be used and why.
Also i see <ejb-link> tag being used. I beleive if want to reference another ejb in another jar of the same ear, this should be used. I would appreciate if someone can explain me these 2 things.
Thanks
Can someone explain me exact use of this
<ejb-local-ref>
tag. I have seen ejb running without this config also
and most of the professionally written ejb have this.
When should this be used and why.ejb-ref is a way of getting reference to another ejb from within the bean code in one ejb. It provides a way to link ejbs based on ejb names rather than jndi-names.
you can also refer to another ejb using the jndi name of the target ejb by looking it up from the global jndi tree. However, this is not a clean way, bcos the jndi name is the deployer's responsibility and could change. If you hook different ejbs using the jndi-names it could be quite inflexible and also you may not be able to take advantage of the container's colocation optimizations.
To link ejbs within the same J2ee application in a flexible way and to take advantage of the container's optimizations, you can use ejb-refs and ejb-links.
hope this helps,
Mihir
Also i see <ejb-link> tag being used. I beleive if
want to reference another ejb in another jar of the
same ear, this should be used. I would appreciate if
someone can explain me these 2 things.
Thanks
Similar Messages
-
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
SajivThis 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> -
Ejb3 help needed( ejb-local-ref )
hi
I have developed one enterprise application.In client refers the session bean in turn session bean refers the entity bean.
But the problem is when i run that application i am not getting desired output.I ahve used JNDI look up to refer the bean.
i am using netbeansIDE5.5 and sun's application server
i think my web.xml ( )is not correcct.
content of web.xml (partly)
<ejb-local-ref>
<ejb-ref-name>TaskSessionLocal</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home/>
<local>TaskEjb.TaskSessionLocal</local>
<ejb-link>TaskSession</ejb-link>
</ejb-local-ref>
can anybody please tell me what all these signifies(<ejb-local-ref> and all)
regards
shruthiIf you're referring to an EJB 3.0 Local Business interface using an ejb-local-ref do not
include the <local-home> element. Here's a full description of the meaning of each
element from our EJB FAQ :
https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#EJB_ejb-ref_ejb_local_ref -
Hi!
Im a novice at this environment so I have been running the EJB Tutorial provided
with 8.1
Everything works as i should until I deploy the application.
I get a:
weblogic.management.DeploymentException: Could not setup environment - with nest
ed exception:
[weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'Ban
dsExampleEJB.jar#Music' declared in the ejb-ref or ejb-local-ref 'ejb/MusicLink'
in the application module 'webapp' could not be resolved. The target EJB for
th
e ejb-ref could not be found. Please ensure the link is correct.]
The code for the ejb-local-ref is as folows:
<ejb-local-ref>
<ejb-ref-name>ejb/MusicLink</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>examples.ejb20.relationships.bands.MusicHome</local-home>
<local>examples.ejb20.relationships.bands.Music</local>
<ejb-link>BandsExampleEJB.jar#Music</ejb-link>
</ejb-local-ref>
What can I be doing wrong?
/PeterGunnar,
There are a few mistakes in the tutorial that will
be fixed for the upcoming SP2 release. As far as the tutorial code
itself goes I've reproduced this problem by following the tutorial
exactly as its stated and there's a couple of things that can be
what's causing all the problems for you and others.
The easiest solution is to use the supplied MusicBean source that's
supplied with the tutorial. That bean code is correct and functional.
The tutorial is missing some of the steps required to reproduce that
exact bean code.
I'll cover all the errors I found. One of these is quite possibly what's
tripping you and others up.
1) The getBands() and addBand() method should be made to be local
methods instead of remote methods.
So in step 4 after you've created these methods change the interface
exposure
to be local either directly in the source by changing the tag, or in the
design view
by right clicking the method and selecting "local". This will show the
methods
with a yellow diamond next to them in the design view.
You also need to enable local interfaces as well as update the local
interface and local home interface.
To do this:
1) switch to the design view
2) click on the EJB
3) find the "naming" node in the property editor and uncheck "Remote EJB"
4) check the "Local EJB" checkbox which will then enable the fields for
the local and local home interfaces
5) enter the value of local interface to be: "Music"
6) enter the value of local home interface to be: "MusicHome"
2) The setup datasource step is incorrect in the tutorial.
The entity beans that are imported use a datasource called
"examples-dataSource-demoPool".
This datasource doesn't exist in the default workshop domain so in this step
the user
is to create the missing datasource. So going to the datasource viewer and
choosing "add datasource"
and pasting in the above name will create the datasource that's needed for
the entity beans.
3) In the source code listing for MusicBean there's missing imports for:
javax.naming.InitialContext
javax.naming.NamingException
4) the ejb-local-ref XML has one problem, possibly two:
1) The case is incorrect for the EJB ref name. The tutorial has it as:
ejb/MusicLink
but addBand.jsp refers to it as ejb/musicLink. So either change the
jsp file or the ejb-ref-name so
that the two match.
2) The placement of the <ejb-local-ref> XML may be in the wrong spot.
This element must
appear at the bottom of web.xml. i.e.
<webapp>
<ejb-local-ref>
<ejb-ref-name>ejb/musicLink</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>examples.ejb20.relationships.bands.MusicHome</local-home>
<local>examples.ejb20.relationships.bands.Music</local>
<ejb-link>BandsExampleEJB.jar#Music</ejb-link>
</ejb-local-ref>
</web-app>
5) and finally ensure that your application's build order is correct. Make
sure that the EJB
project builds before the web project.
This can be verified by selecting the menu "tools->application properties"
and then
clicking on the "build" node to get the build order.
All of these mistakes will be fixed for the SP02 release. Hopefully one of
these solutions fixes
the problems you're experiencing.
-Michael
"Gunnar Skogen" <[email protected]> wrote in message
news:[email protected]...
>
This thread :
Suggestions on newbie tutorials for Workshop and Weblogic 8.1
Date: 8 Aug 2003 15:06:55 -0700
From: "Morgan" <[email protected]>
Organization: BEA NEWS SITE
Newsgroup: weblogic.developer.interest.workshop
Describes the same problem, no solution - so:
1) When will the tutorial(s)/ and or workshop be fixed ?
2) Could we get a fix for this particular problem ? ( I tried more than Iwant
to admit )
"Gunnar Skogen" <[email protected]> wrote:
Hi,
(chiming in because:)
I have exactly the same problem with the same app:
This is following the tutorial for 8.1 :"Tutorial EJB project, Part one"
to the
letter and running the build.
The link names etc are correct, however, nothing is/has been deployed
according
to console..
NB: Following the tutorial the MusicBean is set up as a remote bean
(default
in
workshop?) - have tried going the local way also without any success.
It appears
the tutorial itself is faulty(?) ( it also shows the dialog for importing
a webapp
when it most probably means to create an empty one )
Michael Kovacs <[email protected]> wrote:
Hi Peter,
A couple of things...
Ensure that your EJBs are deployed to the server properly. It
seems from your error that they might very well already be
deployed successfully, but that's just a guess. To verify this you
can have a look at the WebLogic admin console and see that your
beans have been deployed to the server by looking at your
application.
Assuming your beans are deployed....
Ensure that the reference to the EJB ref is using the exact
name of the ejb-ref-name. The name is case sensitive.
So when you do your lookup of the bean in your JSP
ensure that the "ejb/MusicLink" from the <ejb-ref-name>
matches exactly. i.e.
Object obj = ctx.lookup("java:comp/env/ejb/MusicLink");
Also, make sure that the <ejb-link> is correct.
The format for the link name is:
EJBprojectname.jar#EJBName
So for your example, make sure that "BandsExampleEJB"
is the name of your EJB project or correct that value in the
link name, and that your Bean's EJB name is "Music".
Let me know if this helps.
-Michael
Peter Hegedüs wrote:
Hi!
Im a novice at this environment so I have been running the EJB
Tutorial
provided
with 8.1
Everything works as i should until I deploy the application.
I get a:
weblogic.management.DeploymentException: Could not setup environment- with nest
ed exception:
[weblogic.deployment.EnvironmentException: [J2EE:160101]Error: Theejb-link 'Ban
dsExampleEJB.jar#Music' declared in the ejb-ref or ejb-local-ref
'ejb/MusicLink'
in the application module 'webapp' could not be resolved. The targetEJB for
th
e ejb-ref could not be found. Please ensure the link is correct.]
The code for the ejb-local-ref is as folows:
<ejb-local-ref>
<ejb-ref-name>ejb/MusicLink</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>examples.ejb20.relationships.bands.MusicHome</local-home>
<local>examples.ejb20.relationships.bands.Music</local>
<ejb-link>BandsExampleEJB.jar#Music</ejb-link>
</ejb-local-ref>
What can I be doing wrong?
/Peter -
Ejb-ref and ejb-local-ref tags
Hi everyone,
Can someone please tell me
1) Is it necessary for me to define ejb-ref or ejb-local-ref tags if I am referering one ejb from other ejb? I mean to say is it mandatory that I should have these deployment descriptor tags?
2) What is purpose of ejb-link tag ?Hi everyone,
Can someone please tell me
1) Is it necessary for me to define ejb-ref or
ejb-local-ref tags if I am referering one ejb from
other ejb? I mean to say is it mandatory that I should
have these deployment descriptor tags?Yes, to write portable J2EE components, every time you have a dependency on an ejb, you need to declare an ejb-ref (for a Remote EJB client) or ejb-local-ref (for a Local EJB client). This is true no matter what kind of J2EE component is accessing the ejb (Application Client, JSP, Servlet, or another ejb).
Think of the ejb-ref or ejb-local-ref as a pointer. It's different from the thing that is pointed to. Instead, it represents a dependency between a client component and a target ejb.
2) What is purpose of ejb-link tag ?Every ejb-ref or ejb-local-ref must be resolved to unambiguously point to the target ejb. The ejb-link tag is one way to resolve this dependency for the case where the target ejb lives in the same .ear as the referring component. The ejb-link tag is the ejb-name (or <ejb-jar uri>#<ejb-name>) of the target ejb.
Note that this means ejb-link is the ONLY way to resolve an ejb-local-ref, since by definition Local EJB access can only take place between two ejbs within the same .ear or a web component/ejb that live within the same .ear.
For ejb-refs, you can use ejb-link if the target ejb is within the same .ear. If not, the ejb specification does not prescribe how the dependency is resolved. It's left up to the J2EE implementation. The most common approach is for the vendor to provide a product-specific runtime .xml element that resolves the ejb-ref by associating it with the global JNDI name of the target EJB. That's the approach used in the J2EE SDK and Sun Java System Application Server.
Kenneth Saks
J2EE SDK Team
SUN Microsystems -
Ejb-local-refs not showing up in webapp
I have an EAR that has a WAR and an EJBJAR inside (nothing new here). I have my
WAR reference several local ejbs from the EJBJAR. All of my local-ejb-ref entries
in web.xml are not appearing in the console.
Are there any restrictions on this?
ThanksLocal refs in web.xml is supported in 70 (servlet 2.3) and up, I suppose.
Chris Bono wrote:
I have an EAR that has a WAR and an EJBJAR inside (nothing new here). I have my
WAR reference several local ejbs from the EJBJAR. All of my local-ejb-ref entries
in web.xml are not appearing in the console.
Are there any restrictions on this?
Thanks--
Rajesh Mirchandani
Developer Relations Engineer
BEA Support -
EJB Local Interfaces / javax.naming.NamingException
Hi!
I have tried to deploy a very simple (Hello World like)EJB-Application. It contains a simple stateless SessionBean (with local interfaces) and a JSP which is using the EJB.
Opening the JSP i get the following error message:
javax.naming.NamingException: Error instantiating web-app JNDI-context: No location specified and no suitable instance found for the ejb-local-ref 'ejb/TesterEJB', an EJB matching it's ejb-link 'ejb-jar-ic.jar#TesterEJB' was found, but it contained an Entity, not a Session
Here's my ejb-jar.xml:
<?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>oc4jJAR</display-name>
<enterprise-beans>
<session>
<display-name>TesterEJB</display-name>
<ejb-name>TesterEJB</ejb-name>
<local-home>oc4jtest.TesterHome</local-home>
<local>oc4jtest.Tester</local>
<ejb-class>oc4jtest.TesterBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<security-identity>
<description/>
<use-caller-identity/>
</security-identity>
</session>
</enterprise-beans>
<assembly-descriptor>
<method-permission>
<unchecked/>
<method>
<ejb-name>TesterEJB</ejb-name>
<method-intf>Local</method-intf>
<method-name>getMessage</method-name>
<method-params/>
</method>
<method>
<ejb-name>TesterEJB</ejb-name>
<method-intf>Local</method-intf>
<method-name>getPrimaryKey</method-name>
<method-params/>
</method>
<method>
<ejb-name>TesterEJB</ejb-name>
<method-intf>Local</method-intf>
<method-name>getEJBLocalHome</method-name>
<method-params/>
</method>
<method>
<ejb-name>TesterEJB</ejb-name>
<method-intf>LocalHome</method-intf>
<method-name>remove</method-name>
<method-params>
<method-param>java.lang.Object</method-param>
</method-params>
</method>
<method>
<ejb-name>TesterEJB</ejb-name>
<method-intf>Local</method-intf>
<method-name>remove</method-name>
<method-params/>
</method>
<method>
<ejb-name>TesterEJB</ejb-name>
<method-intf>Local</method-intf>
<method-name>isIdentical</method-name>
<method-params>
<method-param>javax.ejb.EJBLocalObject</method-param>
</method-params>
</method>
<method>
<ejb-name>TesterEJB</ejb-name>
<method-intf>LocalHome</method-intf>
<method-name>create</method-name>
<method-params/>
</method>
</method-permission>
<container-transaction>
<method>
<ejb-name>TesterEJB</ejb-name>
<method-intf>Local</method-intf>
<method-name>getMessage</method-name>
<method-params/>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
And here's my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>
<web-app>
<display-name>oc4jWAR</display-name>
<filter>
<filter-name>TestFilter</filter-name>
<display-name>TestFilter</display-name>
<description/>
<filter-class>oc4jtest.TestFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>TestFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>test</servlet-name>
<display-name>test</display-name>
<jsp-file>/test.jsp</jsp-file>
</servlet>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>/test.jsp</welcome-file>
</welcome-file-list>
<ejb-local-ref>
<ejb-ref-name>ejb/TesterEJB</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>oc4jtest.TesterHome</local-home>
<local>oc4jtest.Tester</local>
<ejb-link>ejb-jar-ic.jar#TesterEJB</ejb-link>
</ejb-local-ref>
</web-app>
What's wrong?
Comments would be appreciated!
Thanks!
Peter
PS: The application runs fine on Sun's Reference Implementation!Hi!
I have tried to deploy a very simple (Hello World like)EJB-Application. It contains a simple stateless SessionBean (with local interfaces) and a JSP which is using the EJB.
Opening the JSP i get the following error message:
javax.naming.NamingException: Error instantiating web-app JNDI-context: No location specified and no suitable instance found for the ejb-local-ref 'ejb/TesterEJB', an EJB matching it's ejb-link 'ejb-jar-ic.jar#TesterEJB' was found, but it contained an Entity, not a Session
Here's my ejb-jar.xml:
<?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>oc4jJAR</display-name>
<enterprise-beans>
<session>
<display-name>TesterEJB</display-name>
<ejb-name>TesterEJB</ejb-name>
<local-home>oc4jtest.TesterHome</local-home>
<local>oc4jtest.Tester</local>
<ejb-class>oc4jtest.TesterBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<security-identity>
<description/>
<use-caller-identity/>
</security-identity>
</session>
</enterprise-beans>
<assembly-descriptor>
<method-permission>
<unchecked/>
<method>
<ejb-name>TesterEJB</ejb-name>
<method-intf>Local</method-intf>
<method-name>getMessage</method-name>
<method-params/>
</method>
<method>
<ejb-name>TesterEJB</ejb-name>
<method-intf>Local</method-intf>
<method-name>getPrimaryKey</method-name>
<method-params/>
</method>
<method>
<ejb-name>TesterEJB</ejb-name>
<method-intf>Local</method-intf>
<method-name>getEJBLocalHome</method-name>
<method-params/>
</method>
<method>
<ejb-name>TesterEJB</ejb-name>
<method-intf>LocalHome</method-intf>
<method-name>remove</method-name>
<method-params>
<method-param>java.lang.Object</method-param>
</method-params>
</method>
<method>
<ejb-name>TesterEJB</ejb-name>
<method-intf>Local</method-intf>
<method-name>remove</method-name>
<method-params/>
</method>
<method>
<ejb-name>TesterEJB</ejb-name>
<method-intf>Local</method-intf>
<method-name>isIdentical</method-name>
<method-params>
<method-param>javax.ejb.EJBLocalObject</method-param>
</method-params>
</method>
<method>
<ejb-name>TesterEJB</ejb-name>
<method-intf>LocalHome</method-intf>
<method-name>create</method-name>
<method-params/>
</method>
</method-permission>
<container-transaction>
<method>
<ejb-name>TesterEJB</ejb-name>
<method-intf>Local</method-intf>
<method-name>getMessage</method-name>
<method-params/>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
And here's my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>
<web-app>
<display-name>oc4jWAR</display-name>
<filter>
<filter-name>TestFilter</filter-name>
<display-name>TestFilter</display-name>
<description/>
<filter-class>oc4jtest.TestFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>TestFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>test</servlet-name>
<display-name>test</display-name>
<jsp-file>/test.jsp</jsp-file>
</servlet>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>/test.jsp</welcome-file>
</welcome-file-list>
<ejb-local-ref>
<ejb-ref-name>ejb/TesterEJB</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>oc4jtest.TesterHome</local-home>
<local>oc4jtest.Tester</local>
<ejb-link>ejb-jar-ic.jar#TesterEJB</ejb-link>
</ejb-local-ref>
</web-app>
What's wrong?
Comments would be appreciated!
Thanks!
Peter
PS: The application runs fine on Sun's Reference Implementation! -
Creating a simple java client for a session EJB local interface
Hi all
Is it possible to create a simple java client for a session ejb local interface with JDeveloper.
The problem is that it creates a test client for a remote interface only...
i.e.
MySessionEJB sessionEJB = context.lookup("MySessionEJB")
and once i try to adjust it manually for the local interface...
MySessionEJBLocal sessionEJB = (MySessionEJBLocal) context.lookup("MySessionEJBLocal") (MySessionEJBLocal - is the name of my local interface)
it generates the exception:
javax.naming.NotFoundException: SessionEJBLocal not found
at...........................(RMIClientContext.java:52)
There is still no problem with accessing the local interface object from the jsf project where i've added <ejb-local-ref> tag into the web.xml file.
but i need the possibility of testing the simple java client for the local interface to test business methods wich should return objects without indirect properties
Thanks in advance.
Alex.Pedja thanks for reply.
I still dont understand what is wrong with my example.
The first peace of the code i wrote (getting the reference to the remote interface object) works pretty well, and even more it is produced automatically by JDeveloper, so why we cant get a reference to the local interface object the same way?
Certanly we should use the local interface for getting access to the resource functioning under the same local jvm and i think it doesnt metter wich app server we really use wls or oas or others
Thanks. Alex. -
Unable to lookup ejb local home interface after moving to wls 7.0
I'm getting an exception trying to lookup an ejb's local home interface
which I believe was deployed correctly. On startup I get the message:
EJB Deployed EJB with JNDI name
com.logistics.basedata.ejb.shipperspecificfveb.ShipperSpecificFVDOLocalHome.
However, when I try to do a lookup using this jndi name, I get the
following exception:
javax.naming.LinkException: . Root exception is
javax.naming.NameNotFoundException: Unable to resolve
'app/ejb/ShipperSpecificFVDO.jar#com.logistics.basedata.ejb.shipperspecificfveb/local-home'
Resolved: 'app/ejb'
Unresolved:'ShipperSpecificFVDO.jar#com.logistics.basedata.ejb.shipperspecificfveb'
; remaining name
'ShipperSpecificFVDO.jar#com.logistics.basedata.ejb.shipperspecificfveb/local-home'
The name it can't resolve is different than the name I was trying to
look up. I can see
com.logistics.basedata.ejb.shipperspecificfveb.ShipperSpecificFVDOLocalHome
in the jndi tree through the admin console, but the attributes Object
Class, Object Hash Code, and Object To String are blank.
This worked with weblogic 6.1 sp3. Is there something I missed in the
migration to 7.0?
Any help would be appreciated. Thanks in advance,
-BradThat explains it - in 7.0 (unlike 6.1 - then the only factor was
classloaders arrangement) client has to be
in the same application (ear) - note JNDI links used to be able to lookup
local homes.
"Brad Geddes" <[email protected]> wrote in message
news:[email protected]...
I'm looking it up from a web application. I did notice a message on thistopic
from last thursday (subject: "Pls Help! Failed to access local Sessionbean in
7.0!"). In it, the individual said he had to add ejb-local-ref elementsin the
web.xml. I tried this but can't seem to get it to work.
javax.naming.NameNotFoundException: Unable to resolve ejb-link.
ShipperSpecificFVDO.jar#com.logistics.basedata.ejb.shipperspecificfveb isnot in
the context. The context includes the following link bindings: {} Makesure the
link reference is relative to the URI of the referencing module.
Also, I don't have a war or ear in the environment I'm working in; theejb's are
all deployed separately in jar files, and the web app is in explodedformat.
>
-Brad
"Dimitri I. Rakitine" wrote:
Are you looking up the local home from outside of an application ?
"Brad Geddes" <[email protected]> wrote in message
news:[email protected]...
I'm getting an exception trying to lookup an ejb's local home
interface
which I believe was deployed correctly. On startup I get the message:
EJB Deployed EJB with JNDI name
com.logistics.basedata.ejb.shipperspecificfveb.ShipperSpecificFVDOLocalHome.
>>>
However, when I try to do a lookup using this jndi name, I get the
following exception:
javax.naming.LinkException: . Root exception is
javax.naming.NameNotFoundException: Unable to resolve
'app/ejb/ShipperSpecificFVDO.jar#com.logistics.basedata.ejb.shipperspecificf
veb/local-home'
Resolved: 'app/ejb'
Unresolved:'ShipperSpecificFVDO.jar#com.logistics.basedata.ejb.shipperspecif
icfveb'
; remaining name
'ShipperSpecificFVDO.jar#com.logistics.basedata.ejb.shipperspecificfveb/loca
l-home'
The name it can't resolve is different than the name I was trying to
look up. I can see
com.logistics.basedata.ejb.shipperspecificfveb.ShipperSpecificFVDOLocalHome
in the jndi tree through the admin console, but the attributes Object
Class, Object Hash Code, and Object To String are blank.
This worked with weblogic 6.1 sp3. Is there something I missed in the
migration to 7.0?
Any help would be appreciated. Thanks in advance,
-Brad
Dimitri--
Dimitri -
Using EJB Local Interface problem
Hi to all
I have got a problem in using Local EJB Interface in Weblogic , please attention to my description
I use JDeveloper as IDE
At first I create an Application in JDeveloper that has two projects that their names are Model and ViewContorller that first one contains my EJB and another contains my JSP page respectively
The EJB code is :
@Stateless(name="AliEJB001Bean")
@Remote
@Local
public class AliEJB001Bean implements AliEJB001, AliEJB001Local {
public AliEJB001Bean() {
public String Hi(){
return "Hi000";
And its Local Interface code is :
@Local
public interface AliEJB001Local {
String Hi();
I deploy Model project to an EJB Jar file that its name is AliEE1ejb1.jar
and I deploy the ViewContorller project to a WAR file that its name is AliEE1WebApp.war
Now I add this tags to web.xml
<ejb-local-ref>
<ejb-ref-name>ali/testejb</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>model.AliEJB001Local</local>
</ejb-local-ref>
Then I deploy the Application to an EAR file by name AliEE1
After those I run my JSP page witch calls the EJB in JDeveloper (through Local EJB Interface) , JDeveloper deploy my Application to the ItegratedWeblogicServer
Ultimately the JSP can calls the EJB through Local Interface and use the Hi method and shows me the result but JDeveloper while compiles the application give me these Warnings :
Warning: <May 15, 2011 9:02:52 AM PDT> <Error> <J2EE> <BEA-160187> <weblogic.appc failed to compile your application. Recompile with the -verbose option for more details. Please see the error message(s) below.>
Warning: There are 1 nested errors:
Warning: weblogic.servlet.internal.dd.compliance.ComplianceException: Element "<ejb-local-ref>" with ejb-ref-name "ali/testejb" must either specify a valid ejb-link element or have a corresponding ejb-reference-descriptor element in weblogic.xml with a valid jndi-name.
Warning: at weblogic.servlet.internal.dd.compliance.BaseComplianceChecker.addDescriptorError(BaseComplianceChecker.java:74)
Warning: at weblogic.servlet.internal.dd.compliance.BaseComplianceChecker.addDescriptorError(BaseComplianceChecker.java:80)
Warning: at weblogic.servlet.internal.dd.compliance.EJBRefsComplianceChecker.validate(EJBRefsComplianceChecker.java:97)
Warning: at weblogic.servlet.internal.dd.compliance.EJBRefsComplianceChecker.checkEJBLocalRef(EJBRefsComplianceChecker.java:47)
Warning: at weblogic.servlet.internal.dd.compliance.EJBRefsComplianceChecker.check(EJBRefsComplianceChecker.java:39)
Warning: at weblogic.servlet.internal.dd.compliance.ComplianceUtils.checkCompliance(ComplianceUtils.java:48)
Warning: at weblogic.servlet.jsp.JspcInvoker.checkCompliance(JspcInvoker.java:145)
Warning: at weblogic.servlet.jsp.JspcInvoker.compile(JspcInvoker.java:198)
Warning: at weblogic.application.compiler.AppcUtils.compileWAR(AppcUtils.java:376)
Warning: at weblogic.application.compiler.WARModule.compile(WARModule.java:245)
Warning: at weblogic.application.compiler.flow.SingleModuleCompileFlow.proecessModule(SingleModuleCompileFlow.java:18)
Warning: at weblogic.application.compiler.flow.SingleModuleFlow.compile(SingleModuleFlow.java:36)
Warning: at weblogic.application.compiler.FlowDriver$FlowStateChange.next(FlowDriver.java:69)
Warning: at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
Warning: at weblogic.application.compiler.FlowDriver.nextState(FlowDriver.java:36)
Warning: at weblogic.application.compiler.FlowDriver.run(FlowDriver.java:26)
Warning: at weblogic.application.compiler.WARCompiler.compile(WARCompiler.java:29)
Warning: at weblogic.application.compiler.flow.AppCompilerFlow.compileInput(AppCompilerFlow.java:112)
Warning: at weblogic.application.compiler.flow.AppCompilerFlow.compile(AppCompilerFlow.java:37)
Warning: at weblogic.application.compiler.Appc.runBody(Appc.java:198)
Warning: at weblogic.utils.compiler.Tool.run(Tool.java:158)
Warning: at weblogic.utils.compiler.Tool.run(Tool.java:115)
Warning: at weblogic.application.compiler.Appc.main(Appc.java:257)
Warning: at weblogic.appc.main(appc.java:14)
According to the warning messages I wanna add <ejb-link> tag to the web.xml for resolving warnings I add the <ejb-link> like this:
<ejb-local-ref>
<ejb-ref-name>ali/testejb</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>model.AliEJB001Local</local>
<ejb-link>AliEE1ejb1.jar#AliEJB001Bean </ejb-link>
</ejb-local-ref>
But when JDeveloper want deploy my application again it shows me this Error
[09:29:59 AM] Redeploying Application...
<May 15, 2011 9:29:59 AM PDT> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1305476999381' for task '7'. Error is: 'weblogic.application.ModuleException: Could not setup environment'
weblogic.application.ModuleException: Could not setup environment
at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1499)
at weblogic.servlet.internal.WebAppModule.activate(WebAppModule.java:442)
at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:375)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.ModuleStateDriver.activate(ModuleStateDriver.java:95)
Truncated. see log file for complete stacktrace
Caused By: weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'AliEE1ejb1.jar#AliEJB001Bean' declared in the ejb-ref or ejb-local-ref 'ali/testejb' in the application module 'ViewControllerWebApp.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.
at weblogic.deployment.BaseEnvironmentBuilder.addEJBLinkRef(BaseEnvironmentBuilder.java:464)
at weblogic.deployment.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:485)
at weblogic.servlet.internal.CompEnv.activate(CompEnv.java:157)
at weblogic.servlet.internal.WebAppServletContext.activate(WebAppServletContext.java:3117)
at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1497)
Truncated. see log file for complete stacktrace
>
<May 15, 2011 9:29:59 AM PDT> <Error> <Deployer> <BEA-149202> <Encountered an exception while attempting to commit the 9 task for the application 'AliEE1'.>
<May 15, 2011 9:29:59 AM PDT> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application 'AliEE1'.>
<May 15, 2011 9:29:59 AM PDT> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException: Could not setup environment
at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1499)
at weblogic.servlet.internal.WebAppModule.activate(WebAppModule.java:442)
at weblogic.application.internal.flow.ModuleStateDriver$2.next(ModuleStateDriver.java:375)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.ModuleStateDriver.activate(ModuleStateDriver.java:95)
Truncated. see log file for complete stacktrace
Caused By: weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'AliEE1ejb1.jar#AliEJB001Bean' declared in the ejb-ref or ejb-local-ref 'ali/testejb' in the application module 'ViewControllerWebApp.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.
at weblogic.deployment.BaseEnvironmentBuilder.addEJBLinkRef(BaseEnvironmentBuilder.java:464)
at weblogic.deployment.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:485)
at weblogic.servlet.internal.CompEnv.activate(CompEnv.java:157)
at weblogic.servlet.internal.WebAppServletContext.activate(WebAppServletContext.java:3117)
at weblogic.servlet.internal.WebAppModule.activateContexts(WebAppModule.java:1497)
Truncated. see log file for complete stacktrace
>
[09:30:00 AM] #### Deployment incomplete. ####
[09:30:00 AM] Remote deployment failed
Do you know how I can solve this issue ?
thanksThank you so much
I find out the solution
I have to define my EJB in ejb-jar.xml like this
<enterprise-beans>
<session>
<ejb-name>ReplicableSFSB2</ejb-name>
<business-local>model2.AliEJB001Local</business-local>
<business-remote>model2.AliEJB001</business-remote>
<ejb-class>model2.AliEJB001Bean</ejb-class>
<session-type>Stateless</session-type>
</session>
</enterprise-beans>
And then I use the EJB name witch I defined in <ejb-name> tag in <ejb-link> tag of web.xml
like this
<ejb-local-ref>
<ejb-ref-name>ali/testejb2</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>model2.AliEJB001Local</local>
<ejb-link>Model2EJB.jar#ReplicableSFSB2</ejb-link>
</ejb-local-ref> -
Naming.NameNotFoundException: env/ejb/local/bpel/CubeDeliveryBean
Hi All,
I have posted this issue in WebLogic Server - Upgrade / Install / Environment / Migration section as i am migrating a resource adapter from OC4J to weblogic server and also in weblogic-ejb,, i did not get any response. I was pointed to post the issue in this forum.
The resource adapter was working fine in OC4J (both outbound and inbound).
I am hitting the below issue when performing inbound transaction. I use the message endpoint api provided by JCA and Oracle(oracle.tip.adapter.fw.jca.messageinflow.MessageEndpointImpl) to pass the messages from the adapter to the invoking BPEL Process.
I have created a partner-link service in BPEL similar to File Adapter(Read operation). Also defined the message types and other configurations in wsdl and .jca bindings.
When the adapter calls MessageEndpointImpl.onMessage(rec) the control is passed to oracle.integration.platform.blocks.adapter.fw.jca.mdb.AdapterServiceMDB and i get the below error.
Jan 11, 2010 4:05:56 PM com.collaxa.cube.CubeLogger error
SEVERE: Error occured while handling a post operation
javax.naming.NameNotFoundException: remaining name: env/ejb/local/bpel/CubeDeliveryBean
at weblogic.j2eeclient.SimpleContext.resolve(SimpleContext.java:35)
at weblogic.j2eeclient.SimpleContext.resolve(SimpleContext.java:39)
at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:59)
at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:59)
at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:64)
at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:45)
at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:130)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.oracle.bpel.client.util.BeanRegistry.lookupDeliveryLocalBean(BeanRegistry.java:210)
at com.oracle.bpel.client.util.BeanCache.getDeliveryLocalBean(BeanCache.java:41)
at oracle.fabric.CubeServiceEngine.post(CubeServiceEngine.java:476)
at oracle.integration.platform.blocks.mesh.AsynchronousMessageHandler.doPost(AsynchronousMessageHandler.java:142)
at oracle.integration.platform.blocks.mesh.MessageRouter.post(MessageRouter.java:194)
at oracle.integration.platform.blocks.mesh.MeshImpl.post(MeshImpl.java:204)
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 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at oracle.integration.platform.metrics.PhaseEventAspect.invoke(PhaseEventAspect.java:59)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy195.post(Unknown Source)
at oracle.integration.platform.blocks.adapter.fw.jca.mdb.AdapterServiceMDB.onMessage(AdapterServiceMDB.java:511)
at oracle.integration.platform.blocks.adapter.fw.jca.messageinflow.MessageEndpointImpl.onMessage(MessageEndpointImpl.java:376)
at com.abc.asc.oracle.fusion.adapter.ra.SPIManagedConnectionFactory.integrateMessage(SPIManagedConnectionFactory.java:80)
Do i need to create a new Message Driven Bean so that this bean is called instead of oracle.integration.platform.blocks.adapter.fw.jca.mdb.AdapterServiceMDB or this is an internal flow.
Any inputs will be really helpful in resolving the issue. I am using SOA 11g.
Thanks,
AmithHi Amith,
Can you Please post a Code snippet of "com.oracle.bpel.client.util.BeanRegistry.lookupDeliveryLocalBean" method where your code is actually invoking the InitialContext.lookup() method.
By looking at the stacktrace it seems that the JNDI name for your Local bean is not found... Are you trying to perform lookup for your LocalBean like mentioned in the following link?
http://jaysensharma.wordpress.com/2009/08/16/weblogic-10-3-ejb3-local-lookup-sample/
FYI: You may get more Pointers from EJB experts if you will post in EJB specific forum As the issue is more related to EJB Migration from Another Container to WebLogic: http://forums.oracle.com/forums/forum.jspa?forumID=580
Thanks
Jay SenSharma
Edited by: Jay SenSharma on Jan 13, 2010 2:24 PM -
The new Yosemite Photos app local storage usage question
Hi,
Did anyone check the local storage usage for the new Photos on Yosemite?
How much space does it take for all the lores photos locally if the originals are stored in iCloud.
Lets say if 100GB of RAW files are migrated from Aperture in to Photos to cloud. This should be 100GB in the cloud and how much on OS X?
Can a RAW file still be downloaded from cloud later or are they transformed to jpgs once uploaded?
What if there is not enough storage for all lores photos on iOS or OS X representing all the original iCloud photos?
I'm really puzzled about this.
ThanksI just installed the Yosemite upgrade with Photos. I don't use Aperture of the iCloud, but the iPhotos library migrated with about the same disk space, but it is doubled, because the old iPhoto library is still on disk.
-
GetObjectField returns a local ref to an array: original array or copy?
When GetObjectField returns a local ref to an array object, does it return a reference
to the original array or a copy that needs to be freed?
tiaBTW GetObjectField creates a new local reference of the array and you should delete it.Depends. It will be automatically deleted when the JNI function ends.
So it is a case by case decision to make for explicit deletion.
Regards -
Is there support for ejb local interface?
Hi,
Is there support for ejb local intefaces in JDev? By default it creates remote interfaces
& I have to manually edit the interfaces as well as the ejb-jar.xml files.
I am using JDev 9.0.2.
Thanks in advance...
Regards..
DipankarRight. The aforementioned -migrate flag on the jdev or jdevw command line will migrate the IDE settings from your previous build.
Other upgrade issues are handled automatically the first time you open a project and save it with the new version. -
Does OAS9i(oc4j) support EJB Local interface?
Hi, I'm trying to use the petstore 1.3 framework on oc4j. I read the documentation, and know that it supports EJB 2. But I find the ejb local interface isn't supported.
Am I right?Hi Patrick,
As far as I know, OC4J only partially implements EJB 2.0 -- it
doesn't implement local interfaces. However, there are several,
different versions available. Which version are you using?
If you haven't already found it, there is a version of the pet
store application available for download from:
http://technet.oracle.com/sample_code/tech/java/oc4j/content.html
but it's an implementation of the 1.1.2 version.
Hope this helps,
Avi.
Maybe you are looking for
-
I am having problem while doing vf01 for credit memo
I have done va01 for credit memo. but when i m doing vf01 for credit memo it is showing account detemination error. pls help me.
-
What program would I use to make Tumblr Theme
I would like to make my own tumblr theme and Im not sure which adobe program I would use to make one or even if adobe has such a program. I would like to make it so it looks like a magazine sitting on a surface and you drag accross the pages to move
-
Can't open one custom page from other custom page after import.
Hi all! I've created 2 custom pages "EITPersonPG" and "EITPersonMainPG" and imported them to the mds repository using import.bat. I created a function for "EITPersonPG" and added it into menu. I can open my pages from menu directly but when I try ope
-
Hai all, I have a colmn called Kilometers in table of datatype varchar and has got morethan 20,000 numeric records in it.. only numbers are getting stored in that column.. now am creating one more table with column called kiometres with datatype numb
-
HELP! Curve 8520 Problems
Hi, I updated my software last night from 5.0 to 5.2 and since then everytime I try to use it, it crashes! It tells me that my media card is corrupt, it wiped all my photos, music, apps and settings!!! The options of the update to back up were grey,