Ejb-link
Hi all,
I am using weblogic 6.1. Whenever i deploy EJBs, i put them in different
application folders and deploy them as different applications by specifying
them in config.xml.
Now, i have two entity beans (say A and B) in two different such
applications. Now B contains an CMR field of type A. When i write the
ejb-jar.xml for B, i specify A in the relationship.
Now the weblogic does't recognise the entry of B in the relationship as it
is in a different application. SO, i try to give an ejb-ref for the entity
bean B.
Now the question, when i define ejb-link tag in the ejb-ref, how do i
specify the the name of the ejb A in this tag. if my application name "a"
and the entity bean name is "A", shall i say "a.A" OR "a#A".
I couldnot find any documents for this. Any help is hightly appreciated.
Thanks
Lakshmanan
For two beans to participate in a relation, both of them must be there in
the same jar. See ejb-spec.
So this wouldn't work.
Rupesh
Lakshman <[email protected]> wrote in message
news:[email protected]..
Hi all,
I am using weblogic 6.1. Whenever i deploy EJBs, i put them in different
application folders and deploy them as different applications byspecifying
them in config.xml.
Now, i have two entity beans (say A and B) in two different such
applications. Now B contains an CMR field of type A. When i write the
ejb-jar.xml for B, i specify A in the relationship.
Now the weblogic does't recognise the entry of B in the relationship as it
is in a different application. SO, i try to give an ejb-ref for theentity
bean B.
Now the question, when i define ejb-link tag in the ejb-ref, how do i
specify the the name of the ejb A in this tag. if my application name"a"
and the entity bean name is "A", shall i say "a.A" OR "a#A".
I couldnot find any documents for this. Any help is hightly appreciated.
Thanks
Lakshmanan
Similar Messages
-
Error: Unresolved ejb-link :
I want to call a session bean from a servlet.while deploying i am getting the error
Error: Unresolved <ejb-link>:
I am using Netbeans 6.0 IDE. here i am posting my code.
Calling code in servlet :
Context ctx = new InitialContext();
Object objref = ctx.lookup("java:comp/env/ejb/Etrack");
testBean=(MyHome)PortableRemoteObject.narrow(objref,MyHome.class);
web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>MyClientServlet</servlet-name>
<servlet-class>MyClientServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MyClientServlet</servlet-name>
<url-pattern>/MyClientServlet</url-pattern>
</servlet-mapping>
<ejb-local-ref>
<ejb-ref-name>ejb/Etrack</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>MyHome</local-home>
<local>MyRemote</local>
<ejb-link>Etrack</ejb-link>
</ejb-local-ref>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
My 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>
<session>
<display-name>Etrack Bean</display-name>
<ejb-name>Etrack</ejb-name>
<local-home>MyHome</local-home>
<local>MyRemote</local>
<ejb-class>MyEjbClass</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref>
<ejb-ref-name>ejb/Etrack</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>MyHome</local-home>
<local>MyRemote</local>
<ejb-link>Etrack</ejb-link>
</ejb-local-ref>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>Etrack</ejb-name>
<method-intf>Local</method-intf>
<method-name>*</method-name>
</method>
<trans-attribute>NotSupported</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
My sun-ejb-jar.xml :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 8.1 EJB 2.1//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_2_1-1.dtd">
<sun-ejb-jar>
<enterprise-beans>
<ejb>
<ejb-name>Etrack</ejb-name>
<stateless-session-descriptor>
<bean-pool>
<steady-pool-size>10</steady-pool-size>
<resize-quantity>10</resize-quantity>
<max-pool-size>100</max-pool-size>
<pool-idle-timeout-in-seconds>600</pool-idle-timeout-in-seconds>
</bean-pool>
</stateless-session-descriptor>
<jndi-name>ejb/Etrack</jndi-name>
<pass-by-reference>true</pass-by-reference>
<ejb-ref>
<ejb-name>Etrack</ejb-name>
<ejb-ref-name>ejb/Etrack</ejb-ref-name>
<jndi-name>ejb/Etrack</jndi-name>
</ejb-ref>
</ejb>
</enterprise-beans>
</sun-ejb-jar>
Can anyone help me in resolving this issue.It will be a great help for me.Thanks in advanceYou could always try removing the ejb-link, and see if the container can inject a reference in the runtime environment (accessible using jndi java:comp/env/ejb/Etrack).
If it doesn't, check these:
1) http://www.redhat.com/docs/manuals/rhaps/jonas-guide/ch-beans-ejbref.html
2) the ejb 2.0 spec, which the original poster was using (although this is the same in 2.1 and 3.0), states the folowing:
+20.3.2 Application Assembler’s responsibilities+
The Application Assembler can use the ejb-link element in the deployment descriptor to link an*
EJB reference to a target enterprise bean.*
The Application Assembler specifies the link between two enterprise beans as follows:*
+• The Application Assembler uses the optional ejb-link element of the ejb-ref or+
ejb-local-ref element of the referencing enterprise bean. The value of the ejb-link*
element is the name of the target enterprise bean. (It is the name defined in the ejb-name element*
of the target enterprise bean.) The target enterprise bean can be in any ejb-jar file in the*
same J2EE application as the referencing application component.*
+• Alternatively, to avoid the need to rename enterprise beans to have unique names within an+
entire J2EE application, the Application Assembler may use the following syntax in the*
ejb-link element of the referencing application component. The Application Assembler*
specifies the path name of the ejb-jar file containing the referenced enterprise bean and*
appends the ejb-name of the target bean separated from the path name by # . The path name*
is relative to the referencing application component jar file. In this manner, multiple beans with*
the same ejb-name may be uniquely identified when the Application Assembler cannot*
change ejb-names.*
+• The Application Assembler must ensure that the target enterprise bean is type-compatible with+
the declared EJB reference. This means that the target enterprise bean must be of the type indicated*
in the ejb-ref-type element, and that the home and component interfaces of the target*
enterprise bean must be Java type-compatible with the interfaces declared in the EJB*
reference.*
The following illustrates an ejb-link in the deployment descriptor.*
+...+
*+<enterprise-beans>+*
*+<session>+*
+...+
*+<ejb-name>EmployeeService</ejb-name>+*
*+<ejb-class>com.wombat.empl.EmployeeServiceBean</ejb-class>+*
+...+
*+<ejb-ref>+*
*+<ejb-ref-name>ejb/EmplRecord</ejb-ref-name>+*
*+<ejb-ref-type>Entity</ejb-ref-type>+*
*+<home>com.wombat.empl.EmployeeRecordHome</home>+*
*+<remote>com.wombat.empl.EmployeeRecord</remote>+*
*+<ejb-link>EmployeeRecord</ejb-link>+*
*+</ejb-ref>+*
+...+
*+</session>+*
+...+
*+<entity>+*
*+<ejb-name>EmployeeRecord</ejb-name>+*
*+<home>com.wombat.empl.EmployeeRecordHome</home>+*
*+<remote>com.wombat.empl.EmployeeRecord</remote>+*
+...+
*+</entity>+*
+...+
*+</enterprise-beans>+*
+...+
The Application Assembler uses the ejb-link element to indicate that the EJB reference “Empl-*
Record” declared in the EmployeeService enterprise bean has been linked to the EmployeeRecord*
enterprise bean.</stro
The following example illustrates using the ejb-link element to indicate an enterprise bean reference*
to the ProductEJB enterprise bean that is in the same J2EE application unit but in a different ejb-jar*
file.*
*+<entity>+*
+...+
*+<ejb-name>OrderEJB</ejb-name>+*
*+<ejb-class>com.wombat.orders.OrderBean</ejb-class>+*
+...+
*+<ejb-ref>+*
*+<ejb-ref-name>ejb/Product</ejb-ref-name>+*
*+<ejb-ref-type>Entity</ejb-ref-type>+*
*+<home>com.acme.orders.ProductHome</home>+*
*+<remote>com.acme.orders.Product</remote>+*
*+<ejb-link>../products/product.jar#ProductEJB</ejb-link>+*
*+</ejb-ref>+*
+...+
*+</entity>+* -
Ejb-link not working when i access ejb in different ear
Hi All
I am here trying to access ejb's which is in different ear, I am providing ejb-link inside web.xml of war file deployed inside deffirent ear file.
I am using wls8.1sp5. I tried different combination with elb-link name , but its not working . <ejb-ref>
<ejb-ref-name>ejb/AuditService</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.onstar.audit.ejb.AuditServiceHome</home>
<remote>com.onstar.audit.ejb.AuditService</remote>
<ejb-link>ccarenewal.jar#AuditService</ejb-link>
</ejb-ref>
<ejb-ref>
<ejb-ref-name>ejb/AccountService</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.onstar.account.ejb.AccountServiceHome</home>
<remote>com.onstar.account.ejb.AccountService</remote>
<ejb-link>ccarenewal.jar#AccountService</ejb-link>
</ejb-ref>
Exception:weblogic.management.ApplicationException: activate failed for sbwo Module: sbwo Error: weblogic.management.DeploymentException: Could not setup environment - with nested exception: [weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'ccarenewal.jar#AuditService' declared in the ejb-ref or ejb-local-ref 'ejb/AuditService' in the application module 'accountadj.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.] weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'ccarenewal.jar#AuditService' declared in the ejb-ref or ejb-local-ref 'ejb/AuditService' in the application module 'accountadj.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.EnvironmentBuilder.addEJBLinkRef(EnvironmentBuilder.java:658) at weblogic.deployment.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:467) at weblogic.servlet.internal.CompEnv.init(CompEnv.java:123) at weblogic.servlet.internal.WebAppServletContext.activate
I will appreciate any help.
RajivRob,
Thanks for your reply.
Below is all deployment descriptor entries i have(ejb-jar.xml, weblogic-ejb-jar.xml, web.xml, weblogic.xml)
please correct me if i have wrong entries any where.
ejb-jar.xml
ejb-ref>
<description />
<ejb-ref-name>ejb/AccountService</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.onstar.account.ejb.AccountServiceHome</home>
<remote>com.onstar.account.ejb.AccountService</remote>
<ejb-link>AccountService</ejb-link>
</ejb-ref>
weblogic-ejb-jar.xml
<ejb-reference-description>
<ejb-ref-name>ejb/AccountService</ejb-ref-name>
<jndi-name>cca/AccountService</jndi-name>
</ejb-reference-description>
web.xml
<ejb-ref>
<ejb-ref-name>ejb/AccountService</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.onstar.account.ejb.AccountServiceHome</home>
<remote>com.onstar.account.ejb.AccountService</remote>
<ejb-link>ccarenewal.jar#AccountService</ejb-link>
</ejb-ref>
weblogic.xml
<ejb-reference-description>
<ejb-ref-name>ejb/AccountService</ejb-ref-name>
<jndi-name>cca/AccountService</jndi-name>
</ejb-reference-description>
I appreciate your help.
Thanks
Rajiv -
[J2EE:160167] uses ejb-links but no EJB modules
Dear All
Seeking support/assistance to resolve the below problem. I'm using laster Jdeveloper 11g software publish in 2011.
weblogic.deployment.EnvironmentException: [J2EE:160167]The module abc-ViewController-context-root in application abc_Project1_abc uses ejb-links but no EJB modules were found for this application
Please provide guidelines why this appears and how to resolve it.
Best Regards
Shahebaz ShaikhThe module abc-ViewController-context-root in application abc_Project1_abc uses ejb-links but no EJB modules were found for this application
Is the application deployed as an EAR application with web and ejb modules? If not, deploy as an EAR application. -
Avk w/ ejb-links in different jars
Hello all,
I'm trying to use the 1.4.1 AVK and keep running into an issue.
I have an entity EJB jar and two session EJB jars, each with their own ejb-jar.xml.
In the entity jar's ejb-jar.xml I have:
=====
<ejb-name>Mydataobject</ejb-name>
=====
For each of the session jars, their ejb-jar.xml has a local reference:
=====
<ejb-local-ref id="EJBLocalRef_1">
<ejb-ref-name>com/mydomain/interfaces/MydataobjectLocalHome</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>com.mydomain.interfaces.MydataobjectLocalHome</local-home>
<local>com.mydomain.interfaces.MydataobjectLocal</local>
<ejb-link>Mydataobject</ejb-link>
</ejb-local-ref>
=======
Now, everything I've read regarding the EJB2.1 spec (specifically section 20.3.2) says this is how you can do this as long as all the jars are within the same application. So how come the AVK keeps coming failing with:
========
Error: No enterprise bean matching [ Mydataobject ] found within [ com.mydomain.session.ejb.<SessionOne or SessionTwo> ] JAR file.
Assertion:
EJB Link element test. Please refer to EJB 2.1 Specification Section #20.3.2 for further information.
Test Name:
tests.ejb.elements.EjbLinkElement
========
thanks, very confused.
-DTry to consolidate the Session and Entity Beans into a single jar containing the consolidated ejb-jar.xml file having implementations for both Session and Entity.
-
Ejb-link is still required when using local references?
Hi!
In BEA's link (http://e-docs.bea.com/wls/docs81/ejb/DDreference-ejb-jar.html#1114738) there is the following comment for weblogic-ejb-jar.xml element 'jndi-name':
"Assigning a JNDI name to a bean is not recommended. Global JNDI names generate heavy multicast traffic during clustered server startup. See Using EJB Links for the better practice."
Since we're using local references (local-jndi-name) to access our ejbs instead of remote references, is this still recommendation still pertinent?
Thanks
ChristianneIt is enough if you add the ejb-ref & ejb-link in the session bean. The
session will look up relative to java:comp/env
The following doc shows an example of accessing an ejb from a web app using
ejb-link.
http://e-docs.bea.com/wls/docs81/webapp/components.html#146848
--Sathish
<Christianne Carvalho> wrote in message news:[email protected]..
I'm not getting very well how the ejb-link is used. In my case I have
entity beans that are referenced in session beans.
In my entity beans I have the following XDoclet tag.
* @ejb.bean
* name="ProductDescription"
* display-name="ProductDescription"
* jndi-name="ejb/ProductDescription"
* local-jndi-name="ejb/ProductDescriptionLocal"
* view-type="local"
* type="CMP"
In my session bean I'm currently getting the reference for the entity bean
using the following code:
productDescriptionLocalHome=(ProductDescriptionLocalHome)
lookupLocalHome(ProductDescriptionLocalHome.JNDI_NAME);
If I add the following XDoclet tag to my session bean, in ejb-jar.xml a
<ejb-link> is created inside <ejb-local_ref> tag.
* @ejb.ejb-ref ejb-name="ProductDescription" view-type="local"
Considering the info above:
1) In the entity bean, is there any extra tag to define the ejb-link or is
the ejb-link only defined in the session bean?
2) Re session bean, only adding the @ejb-ref xdoclet tag is enough for
using the ejb-link or do I also have to change my lookup? If I do, what do
I have to search for in the lookup?
Thanks! -
Ejb-ref, ejb-link or JNDI lookup
If I have an application in which one EJB is using another EJB in the SAME application,
what is the best of way of accessing the other EJB?
Why would I use ejb-ref / ejb-link instead of just looking it up in the JNDI?
Just curious.
Thanks.
Danejb-ref/ejb-link were introduced in the ejb spec to allow bean developers to
develop beans without any knowledge of the environment into which they would
be deployed. If you can live with hard coded jndi names then that is fine or
you can use the mechanism define below but using ejb-ref/ejb-link makes your
beans more reuseable and less dependent on the final environement.
If both the ejbs are in the same application I would recommend using ejb-ref
and ejb-link.
-- Anand
"Chad McDaniel" <[email protected]> wrote in message
news:[email protected]..
"Dan Baumbach" <[email protected]> writes:
If I have an application in which one EJB is using another EJB in the
SAME application,
what is the best of way of accessing the other EJB?
Why would I use ejb-ref / ejb-link instead of just looking it up in theJNDI?
>>
>
I believe that ejb-ref/link is not useful in most systems and causes
another level of complexity to maintain. Since EJBs are complex enough
I think that using the basic JNDI lookup is preferable. Also, this
frees you to move the beans to a remote server if you ever want to.
The simplest and most flexible technique, I believe, is to use a
utility class that handles all EJB lookups for you and use a simple
EJB and JNDI name mapping that this class can generate the JNDI name
with a simply manipulation of the bean name. If you ever change the
reference technique you will then only have one class to modify.
This is also a good place to cache home references. -
Hi,
I am trying to hook up a web service that talks to one of my EJBs. I feel that
I have followed the instructions to the letter, but no matter what I do I keep
getting a ServletException when I try to deploy it.
The EJB I am trying to invoke is deployed in an ejb module called SunstartEJBModule
which is deployed within an application called SunstartApplication.
This is the build file I am using:
<project name="buildWebservice" default="generate-typeinfo">
<target name="generate-typeinfo">
<source2wsdd
javaSource="sunstart/ejbs/webservices/StudentWS.java"
ejbLink="SunstartEJBModule.jar#ejb/StudentWS"
ddFile="ddfiles/web-services.xml"
serviceURI="/StudentService"
/>
</target>
<target name="generate-webservice">
<wspackage
output="ears/SunstartApplication.ear"
contextURI="web_services"
webAppClasses="com.sun.ad.sunstart.ejbs.webservices.StudentWS"
ddFile="ddfiles/web-services.xml"
overwrite="false"
/>
</target>
</project>
The SunstartWS ejb is definitely deployed as I can access it using my ServiceLocator
using java:comp/env/ejb/StudentWS. I notice in the server error log it is trying
to use a slightly different JNDI name to this - java:/app/ejb/SunstartEJBModule.jar#ejb/StudentWS/home
but I can't see how I can control this in the ant script because whenever I remove
the "SunstartEJBModule.jar#ejb/StudentWS" part and change it to "ejb/StudentWS"
it won't even deploy.
The full exception trace I am seeing is:
javax.servlet.ServletException: ERROR: The EJB component named: StudentWS specified
an ejb-link to SunstartEJBModule.jar#ejb/StudentWS, but this ejb-link could not
be found in JNDI. Please ensure that this ejb-link refers to a valid EJB, and
this EJB has already deployed. The exception was: javax.naming.NamingException:
Could not lookup EJB home, tried java:/app/ejb/SunstartEJBModule.jar#ejb/StudentWS/home
and java:/app/ejb/SunstartEJBModule.jar#ejb/StudentWS/localhome
at weblogic.webservice.server.servlet.WebServiceServlet.initLocal(WebServiceServlet.java:132)
at weblogic.webservice.server.servlet.WebServiceServlet.init(WebServiceServlet.java:86)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at weblogic.servlet.internal.ServletStubImpl$ServletInitAction.run(ServletStubImpl.java:993)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:869)
at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:848)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:787)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:3252)
at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext.java:3197)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:3174)
at weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServletContext.java:5647)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:869)
at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer.java:2022)
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2063)
at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.activateContainer(SlaveDeployer.java:2592)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(SlaveDeployer.java:2515)
at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeployer.java:2317)
at weblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit(SlaveDeployer.java:2399)
at weblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDeployer.java:2311)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2479)
at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:798)
at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:507)
at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:465)
at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
>
If anyone know what I Am doing wrong I would be grateful if they would let me
know as this has been driving me nuts over the past few days!
Cheers,
Lucas.Here is am working example of how to use source2wsdd
with an EJB.
http://manojc.com/?sample10
Please check if this works ok for you.
Regards,
-manoj
http://manojc.com
"Lucas King" <[email protected]> wrote in message
news:40d9b346$1@mktnews1...
>
Hi,
I am trying to hook up a web service that talks to one of my EJBs. I feelthat
I have followed the instructions to the letter, but no matter what I do Ikeep
getting a ServletException when I try to deploy it.
The EJB I am trying to invoke is deployed in an ejb module calledSunstartEJBModule
which is deployed within an application called SunstartApplication.
This is the build file I am using:
<project name="buildWebservice" default="generate-typeinfo">
<target name="generate-typeinfo">
<source2wsdd
javaSource="sunstart/ejbs/webservices/StudentWS.java"
ejbLink="SunstartEJBModule.jar#ejb/StudentWS"
ddFile="ddfiles/web-services.xml"
serviceURI="/StudentService"
/>
</target>
<target name="generate-webservice">
<wspackage
output="ears/SunstartApplication.ear"
contextURI="web_services"
webAppClasses="com.sun.ad.sunstart.ejbs.webservices.StudentWS"
ddFile="ddfiles/web-services.xml"
overwrite="false"
/>
</target>
</project>
The SunstartWS ejb is definitely deployed as I can access it using myServiceLocator
using java:comp/env/ejb/StudentWS. I notice in the server error log it istrying
to use a slightly different JNDI name to this -java:/app/ejb/SunstartEJBModule.jar#ejb/StudentWS/home
but I can't see how I can control this in the ant script because wheneverI remove
the "SunstartEJBModule.jar#ejb/StudentWS" part and change it to"ejb/StudentWS"
it won't even deploy.
The full exception trace I am seeing is:
javax.servlet.ServletException: ERROR: The EJB component named: StudentWSspecified
an ejb-link to SunstartEJBModule.jar#ejb/StudentWS, but this ejb-linkcould not
be found in JNDI. Please ensure that this ejb-link refers to a valid EJB,and
this EJB has already deployed. The exception was:javax.naming.NamingException:
Could not lookup EJB home, triedjava:/app/ejb/SunstartEJBModule.jar#ejb/StudentWS/home
and java:/app/ejb/SunstartEJBModule.jar#ejb/StudentWS/localhome
atweblogic.webservice.server.servlet.WebServiceServlet.initLocal(WebServiceSer
vlet.java:132)
atweblogic.webservice.server.servlet.WebServiceServlet.init(WebServiceServlet.
java:86)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
atweblogic.servlet.internal.ServletStubImpl$ServletInitAction.run(ServletStubI
mpl.java:993)
atweblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
t.java:317)
atweblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
atweblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java
:869)
atweblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.ja
va:848)
atweblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.jav
a:787)
atweblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletC
ontext.java:3252)
atweblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServlet
Context.java:3197)
atweblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServle
tContext.java:3174)
atweblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServletConte
xt.java:5647)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:869)
atweblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer.java:2
022)
atweblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.jav
a:2063)
atweblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.activat
eContainer(SlaveDeployer.java:2592)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(SlaveDeployer.java:2515)
atweblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeployer.jav
a:2317)
atweblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit(SlaveDep
loyer.java:2399)
atweblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDeployer.ja
va:2311)
atweblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDep
loyer.java:2479)
atweblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeplo
yer.java:798)
atweblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.ja
va:507)
atweblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.j
ava:465)
atweblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.ja
va:25)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
>
If anyone know what I Am doing wrong I would be grateful if they would letme
know as this has been driving me nuts over the past few days!
Cheers,
Lucas. -
Javax.naming.NameNotFoundException: Unable to resolve ejb-link.
Env: JDK 1.3.1_08
Weblogic: 7.0
We are attempting to use EJB's (session) and have it all localized in a jar.
The Business and Custom Logic is all compiled to WEB-INF/classes. All the jars including the EJB jar is under WEB-INF/lib.
On Startup Weblogic throws the error message
weblogic.management.ApplicationException: activate failed for application
Module Name: application, Error: weblogic.j2ee.DeploymentException: Could not setup environment - with nested exception:
[javax.naming.NameNotFoundException: Unable to resolve ejb-link. Appejb.jar#AppServerBean is not in the context. The context includes the following link bindings: {} Make sure the link reference is relative to the URI of the referencing module.]
I have tried using the ../ notation before the Appejb.jar in the web.xml and what not, but that does not work either.
I have sucesfully deployed the EJB jar through the weblogic console.
Any Clues or suggestions will be most appreciated..
thanks
-aCreate a ear application from the ejb jar and web application war.
Copy ear application to the applications directory.
In the ejb-link element in web.xml specify the relative path to the ejb jar.
<ejb-link>../Appejb.jar</ejb-link>
thanks,
Deepak
Akshay <[email protected]> wrote:
Env: JDK 1.3.1_08
Weblogic: 7.0
We are attempting to use EJB's (session) and have it all localized in
a jar.
The Business and Custom Logic is all compiled to WEB-INF/classes. All
the jars including the EJB jar is under WEB-INF/lib.
On Startup Weblogic throws the error message
weblogic.management.ApplicationException: activate failed for application
Module Name: application, Error: weblogic.j2ee.DeploymentException: Could
not setup environment - with nested exception:
[javax.naming.NameNotFoundException: Unable to resolve ejb-link. Appejb.jar#AppServerBean
is not in the context. The context includes the following link bindings:
{} Make sure the link reference is relative to the URI of the referencing
module.]
I have tried using the ../ notation before the Appejb.jar in the web.xml
and what not, but that does not work either.
I have sucesfully deployed the EJB jar through the weblogic console.
Any Clues or suggestions will be most appreciated..
thanks
-a -
Error Deploying Application - ejb-link or jndi-name
I get the following error when depoying my J2EE application. Can anyone help ?
Deployment failed on Server MServer1
weblogic.management.DeploymentException:
Exception:weblogic.management.ApplicationException: activate failed for Supplier
Module: Supplier Error: weblogic.management.DeploymentException: Could not setup environment - with nested exception:
[weblogic.deployment.EnvironmentException: ejb-ref ejb/ReceiverSes requires an ejb-link or jndi-name]
weblogic.deployment.EnvironmentException: ejb-ref ejb/ReceiverSes requires an ejb-link or jndi-name
at weblogic.deployment.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:473)
at weblogic.servlet.internal.CompEnv.init(CompEnv.java:123)
at weblogic.servlet.internal.WebAppServletContext.activate(WebAppServletContext.java:5616)
at weblogic.servlet.internal.WebAppServletContext.setActive(WebAppServletContext.java:5588)
at weblogic.servlet.internal.WebAppModule.activate(WebAppModule.java:841)
at weblogic.j2ee.J2EEApplicationContainer.activateModule(J2EEApplicationContainer.java:3127)
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2081)
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2062)
at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.activateContainer(SlaveDeployer.java:2592)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(SlaveDeployer.java:2515)
at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeployer.java:2317)
at weblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit(SlaveDeployer.java:2399)
at weblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDeployer.java:2311)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2479)
at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:798)
at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:507)
at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:465)
at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
--------------- nested within: ------------------
weblogic.management.DeploymentException: Could not setup environment - with nested exception:
[weblogic.deployment.EnvironmentException: ejb-ref ejb/ReceiverSes requires an ejb-link or jndi-name]
at weblogic.servlet.internal.CompEnv.init(CompEnv.java:133)
at weblogic.servlet.internal.WebAppServletContext.activate(WebAppServletContext.java:5616)
at weblogic.servlet.internal.WebAppServletContext.setActive(WebAppServletContext.java:5588)
at weblogic.servlet.internal.WebAppModule.activate(WebAppModule.java:841)
at weblogic.j2ee.J2EEApplicationContainer.activateModule(J2EEApplicationContainer.java:3127)
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2081)
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2062)
at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.activateContainer(SlaveDeployer.java:2592)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(SlaveDeployer.java:2515)
at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeployer.java:2317)
at weblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit(SlaveDeployer.java:2399)
at weblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDeployer.java:2311)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2479)
at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:798)
at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:507)
at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:465)
at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)I found the issue. The below entries were missing from weblogic.xml
<ejb-reference-description>
<ejb-ref-name>ejb/PipelineExecutor</ejb-ref-name>
<jndi-name>${APPNAME}.BEA_personalization.PipelineExecutor</jndi-name>
</ejb-reference-description>
"rohit" <[email protected]> wrote:
>
Does anyone knows why we would get the below error. I verified the web.xml
and
it seems to be right. Any help appreciated. Rohit
<Jul 1, 2003 5:08:12 PM PDT> <Error> <Deployer> <149231> <The slave deployer
was
unable to set the activation state to true for the application portalApp
weblogic.management.ApplicationException: activate failed forceoportal
Module Name: ceoportal, Error: weblogic.j2ee.DeploymentException: Could
not setu
p environment - with nested exception:
[weblogic.deployment.EnvironmentException: ejb-ref ejb/PipelineExecutor
requires
an ejb-link or jndi-name]
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContai
ner.java:1093)
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContai
ner.java:1022)
at weblogic.management.deploy.slave.SlaveDeployer.setActivationStateForA
llApplications(SlaveDeployer.java:617)
at weblogic.management.deploy.slave.SlaveDeployer.resume(SlaveDeployer.j
ava:376)
at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.resum
e(DeploymentManagerServerLifeCycleImpl.java:235)
at weblogic.t3.srvr.ServerLifeCycleList.resume(ServerLifeCycleList.java:
65)
at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:832)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:300)
at weblogic.Server.main(Server.java:32) -
I am fairly new to weblogic and have the following problem on deployment. It complains
about an ejb-link property that cannot be resolved, but I have done a bunch of
research and cannot figure out why I'm getting this problem. The ejb in the ejb-link
is in the same jar as the ejb-jar.xml. The entries look correct. Strange thing
is, the ejb it complains about not being able to deploy isn't even referencing
the other ejb in question. I've attached the ejb-jar.xml we're using. The app
server we were using was fairly liberal with this sort of thing and we got away
with it. There probably is a problem, but it's not clear what. Any help would
be appreciated. I've included the output from weblogic.
[Deployer:149033]preparing application Armanta on Armanta-Custom
[Deployer:149033]prepared application Armanta on Armanta-Custom
[Deployer:149033]activating application Armanta on Armanta-Custom
[Deployer:149033]failed application Armanta on Armanta-Custom
[Deployer:149034]An exception occurred for task [Deployer:149026]Deploy application
Armanta on Armanta-Custom.:
Exception:weblogic.management.ApplicationException: activate failed for ArmantaCustomEJB.jar
Module: ArmantaCustomEJB.jar Error: Exception activating module: EJBModule(ArmantaCustomEJB.jar,status=PREPARED)
Unable to deploy EJB: ejb/CouponType from ArmantaCustomEJB.jar:
weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'ejb/SysProperty'
declared in the ejb-ref or ejb-local-ref 'ejb/SysProperty' in the application
module 'ArmantaCustomEJB.jar' could not be resolved. The target EJB for the ejb-ref
could not be found. Please ensure the link is correct.
at weblogic.ejb20.deployer.EnvironmentBuilder.addEJBLinkRef(EnvironmentBuilder.java:738)
at weblogic.ejb20.deployer.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:537)
at weblogic.ejb20.deployer.EJBDeployer.bindEJBReferences(EJBDeployer.java:1609)
at weblogic.ejb20.deployer.EJBDeployer.activate(EJBDeployer.java:1375)
at weblogic.ejb20.deployer.EJBModule.activate(EJBModule.java:610)
at weblogic.j2ee.J2EEApplicationContainer.activateModule(J2EEApplicationContainer.java:3127)
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2081)
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2062)
at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.activateContainer(SlaveDeployer.java:2592)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(SlaveDeployer.java:2515)
at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeployer.java:2317)
at weblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit(SlaveDeployer.java:2399)
at weblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDeployer.java:2311)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2479)
at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:798)
at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:507)
at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:465)
at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
[ejb-jar.xml]Thanks Deepak. It's strange that the O'reilly 3rd edition enterprise javabeans
book doesn't mention this.
"Deepak Vohra" <[email protected]> wrote:
>
Refer to http://e-docs.bea.com/wls/docs81/webserv/wsp.html#ejb-link
"Eric Kaplan" <[email protected]> wrote:
I am fairly new to weblogic and have the following problem on deployment.
It complains
about an ejb-link property that cannot be resolved, but I have donea
bunch of
research and cannot figure out why I'm getting this problem. The ejb
in the ejb-link
is in the same jar as the ejb-jar.xml. The entries look correct. Strange
thing
is, the ejb it complains about not being able to deploy isn't even referencing
the other ejb in question. I've attached the ejb-jar.xml we're using.
The app
server we were using was fairly liberal with this sort of thing andwe
got away
with it. There probably is a problem, but it's not clear what. Any help
would
be appreciated. I've included the output from weblogic.
[Deployer:149033]preparing application Armanta on Armanta-Custom
[Deployer:149033]prepared application Armanta on Armanta-Custom
[Deployer:149033]activating application Armanta on Armanta-Custom
[Deployer:149033]failed application Armanta on Armanta-Custom
[Deployer:149034]An exception occurred for task [Deployer:149026]Deploy
application
Armanta on Armanta-Custom.:
Exception:weblogic.management.ApplicationException: activate failedfor
ArmantaCustomEJB.jar
Module: ArmantaCustomEJB.jar Error: Exception activating module: EJBModule(ArmantaCustomEJB.jar,status=PREPARED)
Unable to deploy EJB: ejb/CouponType from ArmantaCustomEJB.jar:
weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link
'ejb/SysProperty'
declared in the ejb-ref or ejb-local-ref 'ejb/SysProperty' in the application
module 'ArmantaCustomEJB.jar' could not be resolved. The target EJBfor
the ejb-ref
could not be found. Please ensure the link is correct.
at weblogic.ejb20.deployer.EnvironmentBuilder.addEJBLinkRef(EnvironmentBuilder.java:738)
at weblogic.ejb20.deployer.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:537)
at weblogic.ejb20.deployer.EJBDeployer.bindEJBReferences(EJBDeployer.java:1609)
at weblogic.ejb20.deployer.EJBDeployer.activate(EJBDeployer.java:1375)
at weblogic.ejb20.deployer.EJBModule.activate(EJBModule.java:610)
at weblogic.j2ee.J2EEApplicationContainer.activateModule(J2EEApplicationContainer.java:3127)
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2081)
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2062)
at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.activateContainer(SlaveDeployer.java:2592)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(SlaveDeployer.java:2515)
at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeployer.java:2317)
at weblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit(SlaveDeployer.java:2399)
at weblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDeployer.java:2311)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2479)
at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:798)
at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:507)
at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:465)
at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) -
Creating Ejb link to another Weblogic server
I am trying to create a EJB jndi link to another weblogic server from a weblogic
server.
Basically I have a web application that uses an EJB that is deploed on another
weblogic server and I would like to connect to it.
One way I can do is the remote lookup using the Hashtable and the context factory,
something like this
Hashtable props = new Hashtable();
props.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
props.put(Context.PROVIDER_URL, "t3://localhost:7001/");
Context context = new InitialContext(props);
I used a jndi-link in resin previously, that did not require me to do a remote
lookup and rather created a link at the server level and allowed me to do a direct
InitialContext() lookup.
<jndi-link>
<jndi-name>java:comp/env/ejb/test</jndi-name>
<jndi-factory>weblogic.jndi.WLInitialContextFactory</jndi-factory>
<init-param java.naming.provider.url="t3://xx.x.x.x:7001"/>
<jndi-lookup>ejb.test</jndi-lookup>
</jndi-link>
Can I do something similar in Weblogic? If yes, how can I do it.
Appreciate your help.
Thanks,
Varun"Varun Garg" <[email protected]> wrote:
>
I am trying to create a EJB jndi link to another weblogic server from
a weblogic
server.
Basically I have a web application that uses an EJB that is deploed on
another
weblogic server and I would like to connect to it.
One way I can do is the remote lookup using the Hashtable and the context
factory,
something like this
Hashtable props = new Hashtable();
props.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
props.put(Context.PROVIDER_URL, "t3://localhost:7001/");
Context context = new InitialContext(props);
I used a jndi-link in resin previously, that did not require me to do
a remote
lookup and rather created a link at the server level and allowed me to
do a direct
InitialContext() lookup.
<jndi-link>
<jndi-name>java:comp/env/ejb/test</jndi-name>
<jndi-factory>weblogic.jndi.WLInitialContextFactory</jndi-factory>
<init-param java.naming.provider.url="t3://xx.x.x.x:7001"/>
<jndi-lookup>ejb.test</jndi-lookup>
</jndi-link>
Can I do something similar in Weblogic? If yes, how can I do it.
Appreciate your help.
Thanks,
Varun
hi,
Yes, it is possible in weblogic for more info visit this url,
http://e-docs.bea.com/wls/docs70/ejb/reference.html#1221067
u have the description of how to use the below tags
<initial-context-factory>weblogic.jndi.WLInitialContextFactory</initial-context-factory>
<provider-url>WeblogicURL:Port</provider-url>
<indi-name>jndiweb</jndi-name>
hope it help u
regards,
Elango TR -
Most EJB Links broken on ejb 3 Howto's
Most of the links on this page don't work to access pertinent examples for ejb 3. Definately irritating. Is there a new location for EJB 3 howto documentation.
http://www.oracle.com/technology/tech/java/ejb30.html
Thanks.Hi and Welcome to the Community!
So, the one thing you don't say you tried is to use AutoLoader to reload your current OS version. This actually is very important...with 10.3.2, you cannot fall back to 10.3.1 or earlier...you must stay on 10.3.2. This is due to the governmental requirement for a "kill switch", and this exists in 10.3.2 only and not prior versions, and falling back would put BB out of compliance with those regulations...so falling back to earlier is blocked.
So, I suggest you obtain an AutoLoader for your current OS version, and use that to cleanly reload the current OS onto your device. If it still doesn't work, try other 10.3.2 OS AutoLoaders...maybe there is something in the version you installed that is a problem.
Good luck and let us know! -
Error connecting to an EJB 3.0 Remote on OC4J 10.1.3.2 from Tomcat
Hi, I want to connect to a Remote Session Bean running on the OC4J 10.1.3 and it doesn´t work.
I have connected to it from a java standalone application using:
public static void main(String [] args) {
try {
final Context context = getInitialContext();
SessionEJB sessionEJB = (SessionEJB)context.lookup("java:comp/env/ejb/SessionEJB");
System.out.println(sessionEJB.mergeEntity(""));
System.out.println( "hola" );
} catch (Exception ex) {
ex.printStackTrace();
private static Context getInitialContext() throws NamingException {
Hashtable env = new Hashtable();
// Standalone OC4J connection details
env.put( Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.naming.ApplicationClientInitialContextFactory" );
env.put( Context.SECURITY_PRINCIPAL, "oc4jadmin" );
env.put( Context.SECURITY_CREDENTIALS, "passw" );
env.put(Context.PROVIDER_URL, "ormi://localhost:23791/ejb3jar");
return new InitialContext( env );
with this application-client.xml file:
<?xml version = '1.0' encoding = 'windows-1252'?>
<application-client 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/application-client_1_4.xsd" version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee">
<display-name>Model-app-client</display-name>
<ejb-ref>
<ejb-ref-name>ejb/SessionEJB</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<remote>ar.com.eds.ejb3.model.SessionEJB</remote>
<ejb-link>SessionEJB</ejb-link>
</ejb-ref>
thats works fine, but when I try to use the same solution from a jsf proyect running on a Tomcat 5.5.20, it fails with this error:
Caused by: java.lang.RuntimeException: Error while creating home.
at ar.com.mcd.fawkes.ui.locator.EJB3Locator.get(EJB3Locator.java:32)
at ar.com.mcd.fawkes.ui.locator.ServiceLocator$1.get(ServiceLocator.java:12)
at net.sf.opentranquera.web.jsf.locator.ServiceLocatorBean.get(ServiceLocatorBean.java:42)
at com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:79)
at com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:187)
at com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:171)
at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:263)
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:160)
... 80 more
Caused by: javax.naming.NameNotFoundException: Name ejb is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:769)
at org.apache.naming.NamingContext.lookup(NamingContext.java:139)
at org.apache.naming.NamingContext.lookup(NamingContext.java:780)
at org.apache.naming.NamingContext.lookup(NamingContext.java:139)
at org.apache.naming.NamingContext.lookup(NamingContext.java:780)
at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:136)
at javax.naming.InitialContext.lookup(Unknown Source)
at ar.com.mcd.fawkes.ui.locator.EJB3Locator.get(EJB3Locator.java:28)
... 87 more
Could you please help me with any tip?
Mauricio
Message was edited by:
MauricioHi, Rick
Thanks for your help.
I deleted de application-client.xml file, added the following lines to the web.xml file:
<ejb-ref>
<ejb-ref-name>ejb/SessionEJB</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<remote>ar.com.eds.ejb3.model.SessionEJB</remote>
</ejb-ref>
and now I´m using oracle.j2ee.rmi.RMIInitialContextFactory
there is no error, and it doesn´t throw any exception but the following line returns null.
SessionEJB sessionEJB = (SessionEJB)context.lookup("java:comp/env/ejb/SessionEJB");
Its seems the lookup method finds the remote ejb because it doesn´t fail, but it returns null.
Any idea what is wrong?
Mauricio. -
EJB 3.0 Local References
I have an EJB module that contains a session bean, MasterBean, with a local interface MasterLocal, packaged in an EAR file. I am trying to look up a reference to MasterLocal in a regular Java class in the same EAR file. I am able to look up the MasterLocal in my WAR file using the following code
web.xml:
<ejb-local-ref>
<ejb-ref-name>ejb/MasterLocal</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>facade.MasterLocal</local>
<ejb-link>MasterBean</ejb-link>
</ejb-local-ref> Lookup:
MasterLocal masterLocal = null;
try {
InitialContext ic = new InitialContext();
masterLocal = (MasterLocal) ic.lookup("java:comp/env/ejb/MasterLocal");
} catch (NamingException ex) {
logger.severe("Error getting MasterLocal: " + ex.getMessage());
}How can I use similar code to look up a reference to MasterLocal in the EAR module?
Luke Mauldin[#|2007-02-01T12:09:04.263-0600|INFO|sun-appserver-pe9.0|javax.enterprise.system.container.ejb|_ThreadID=15;_ThreadName=httpWorkerThread-8080-0;|
javax.ejb.EJBException
at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:3730)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3630)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3431)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:192)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:71)
at $Proxy93.searchVisitorBadge(Unknown Source)
at securitylog.login.SelectVisitors.search_action(SelectVisitors.java:752)
at securitylog.login.SelectVisitors.init(SelectVisitors.java:712)
at com.sun.rave.web.ui.appbase.servlet.LifecycleListener.fireInit(LifecycleListener.java:555)
at com.sun.rave.web.ui.appbase.servlet.LifecycleListener.attributeAdded(LifecycleListener.java:405)
at org.apache.coyote.tomcat5.CoyoteRequest.setAttribute(CoyoteRequest.java:1634)
at org.apache.coyote.tomcat5.CoyoteRequestFacade.setAttribute(CoyoteRequestFacade.java:522)
at javax.servlet.ServletRequestWrapper.setAttribute(ServletRequestWrapper.java:295)
at com.sun.faces.context.RequestMap.put(ExternalContextImpl.java:1055)
at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:525)
at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:82)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:62)
at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:65)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
at com.sun.faces.application.ValueBindingValueExpressionAdapter.getValue(ValueBindingValueExpressionAdapter.java:102)
at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.pageBean(ViewHandlerImpl.java:666)
at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.pageBean(ViewHandlerImpl.java:641)
at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:249)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:133)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:244)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:203)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
Caused by: java.lang.RuntimeException: javax.naming.NameNotFoundException: No object bound to name java:comp/env/ejb/MasterLocal
at model.listeners.VisitorBadgeListener.lookupMasterBean(VisitorBadgeListener.java:67)
at model.listeners.VisitorBadgeListener.PostLoad(VisitorBadgeListener.java:45)
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 oracle.toplink.essentials.internal.security.PrivilegedAccessHelper.invokeMethod(PrivilegedAccessHelper.java:307)
at oracle.toplink.essentials.internal.ejb.cmp3.metadata.listeners.MetadataEntityListener.invokeMethod(MetadataEntityListener.java:302)
at oracle.toplink.essentials.internal.ejb.cmp3.metadata.listeners.MetadataEntityListener.invokeMethod(MetadataEntityListener.java:324)
at oracle.toplink.essentials.internal.ejb.cmp3.metadata.listeners.MetadataEntityListener.postClone(MetadataEntityListener.java:404)
at oracle.toplink.essentials.descriptors.DescriptorEventManager.notifyListener(DescriptorEventManager.java:640)
at oracle.toplink.essentials.descriptors.DescriptorEventManager.notifyEJB30Listeners(DescriptorEventManager.java:591)
at oracle.toplink.essentials.descriptors.DescriptorEventManager.executeEvent(DescriptorEventManager.java:199)
at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.populateAttributesForClone(ObjectBuilder.java:2088)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.populateAndRegisterObject(UnitOfWorkImpl.java:2816)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.cloneAndRegisterObject(UnitOfWorkImpl.java:673)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkIdentityMapAccessor.getAndCloneCacheKeyFromParent(UnitOfWorkIdentityMapAccessor.java:152)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkIdentityMapAccessor.getFromIdentityMap(UnitOfWorkIdentityMapAccessor.java:90)
at oracle.toplink.essentials.internal.sessions.IdentityMapAccessor.getFromIdentityMap(IdentityMapAccessor.java:295)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerExistingObject(UnitOfWorkImpl.java:3055)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerExistingObject(UnitOfWorkImpl.java:3004)
at oracle.toplink.essentials.queryframework.ObjectBuildingQuery.registerIndividualResult(ObjectBuildingQuery.java:319)
at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneNormally(ObjectBuilder.java:441)
at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:406)
at oracle.toplink.essentials.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:372)
at oracle.toplink.essentials.queryframework.ReportQueryResult.processItem(ReportQueryResult.java:205)
at oracle.toplink.essentials.queryframework.ReportQueryResult.buildResult(ReportQueryResult.java:167)
at oracle.toplink.essentials.queryframework.ReportQueryResult.<init>(ReportQueryResult.java:83)
at oracle.toplink.essentials.queryframework.ReportQuery.buildObject(ReportQuery.java:579)
at oracle.toplink.essentials.queryframework.ReportQuery.buildObjects(ReportQuery.java:628)
at oracle.toplink.essentials.queryframework.ReportQuery.executeDatabaseQuery(ReportQuery.java:776)
at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:609)
at oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:677)
at oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:731)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2218)
at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:937)
at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:909)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:346)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getResultList(EJBQueryImpl.java:447)
at facade.DataLookupBean.searchVisitorBadge(DataLookupBean.java:416)
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 com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1050)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:165)
at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2766)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3847)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:184)
... 53 more
Caused by: javax.naming.NameNotFoundException: No object bound to name java:comp/env/ejb/MasterLocal
at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:751)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:156)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at model.listeners.VisitorBadgeListener.lookupMasterBean(VisitorBadgeListener.java:63)
... 101 more
|#]
Maybe you are looking for
-
Setting up EA4500 after having used it before
I'm running a EA4500 and use all Mac computers. I tried to log in to change the guest login the router, but could not connect. I downloaded the setup program, but it would not detect the router. Finally, in frustration, I tried to start all over, res
-
Execute a string containing a PL/SQL block
Hi, I would like to build a string containing a PL/SQL block and execute it dynamically. Is there way to do this. Note - The reason I want to this is because, based on certain table data dictionary views the declaration section of the PL/SQL block th
-
PM Order Settlement to two costcenters
Dear I have to settle cost based on consumption of spares ie Electrical & Electronics. Is there any procedure settle cost to costcenter based on cosumption of material as this causing manual entry to amount to respective costcenter. Thanks and Regard
-
BAPI or Function Module to create the Rebate Agreement
Hi All, I have a requirement where I get the flat file which consists of the header and item level data. Using that I have to create the REBATE AGREEMENT. The transaction code to create the Rebate Agreement is VBO1 (Create Rebate Agreement). Is there
-
Microsoft Security Bulletin Installation Prerequisites
Hi Team, Just wanted to know that, is there any Prerequisites before installing / deploying any Microsoft patches to Servers 2003/2008/2012. Thanks Regards, Pavi