Problems in configuring deployment descriptors to use EJB in JSP - Weblogic

This is a discussion on Problems in configuring deployment descriptors to use EJB in JSP - Weblogic ; Hello, I've been trying to use an EJB in a JSP on Weblogic 8.1. The relevent part of my web.xml and weblogic.xml look like this: ===================================== web.xml - Purchase order bean deployed ejb/Purchaseorder Entity mypackage2.PurchaseorderHome mypackage2.Purchaseorder /PO.jar#Purchaseorder purchase order ejb/Purchaseorder ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Problems in configuring deployment descriptors to use EJB in JSP

  1. Problems in configuring deployment descriptors to use EJB in JSP


    Hello,

    I've been trying to use an EJB in a JSP on Weblogic 8.1. The relevent part of
    my web.xml and weblogic.xml look like this:
    =====================================
    web.xml -


    Purchase order bean deployed
    ejb/Purchaseorder
    Entity
    mypackage2.PurchaseorderHome
    mypackage2.Purchaseorder
    /PO.jar#Purchaseorder




    purchase order
    ejb/Purchaseorder
    Entity
    mypackage2.PurchaseorderLocalHome
    mypackage2.PurchaseorderLocal
    /PO.jar#Purchaseorder

    =====================================

    weblogic.xml -

    ejb/Purchaseorder
    Purchaseorder


    =================================
    My ejb-jar.xml file looks like this (this EJB jar is already deployed on Weblogic):


    Entity Bean ( CMP )
    Purchaseorder
    Purchaseorder
    mypackage2.PurchaseorderHome
    mypackage2.Purchaseorder
    mypackage2.PurchaseorderLocalHome
    mypackage2.PurchaseorderLocal
    mypackage2.PurchaseorderBean
    ==============================================
    Finally, my weblogic-ejb-jar.xml looks like this:



    Purchaseorder
    Purchaseorder


    ===============================================

    But despite many many efforts, I keep getting the following error:

    Could not setup environment - with nested exception: [weblogic.deployment.EnvironmentException:
    [J2EE:160101]Error: The ejb-link '/PO.jar#Purchaseorder' declared in the ejb-ref
    or ejb-local-ref 'ejb/Purchaseorder' in the application module 'public_html' 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 '/PO.jar#Purchaseorder' declared in the ejb-ref or ejb-local-ref
    'ejb/Purchaseorder' in the application module 'public_html' could not be resolved.
    The target EJB for the ejb-ref could not be found. Please ensure the link is correct.
    at

    I have changed around a lot of things. I've a classes directory under web-inf
    where I have mypackage2\all-the-class-files. I've also made available PO.jar file
    (which contains Purchaseorder) at various levels to ensure that the class can
    be found. I've changed the "/PO.jar#Purchaseorder" value of tag accordingly
    to try various things. (e.g ejb/Purchaseorder, mypackage2.Purchaseorder, and a
    lot of other things) but of no avail. I keep getting the same error over and over
    again. (Do you think banging my head on the wall would do the trick?)

    Any help would be greatly appreciated. Thanks.


  2. Re: Problems in configuring deployment descriptors to use EJB in JSP

    I guess to start off with I'm making the assumption that your PO.jar is your
    EJB module
    and that it is contained in the same EAR as your webapp module, looking
    something like
    this:

    myEAR.ear
    |_ PO.jar
    |_ webapp
    |_ jspCallingEJB.jsp

    If this is correct, the first thing I'd suggest trying is to remove your "/"
    from the front of your and
    just make the value PO.jar#Purchaseorder

    The EJB example that ships with 8.1 platform makes use of an EJB from a jsp
    page so you could
    look to that example for some guidance, which references the EJB in this
    same way in the web.xml ejb-local-ref element.
    hope that helps.
    --
    Michael Kovacs
    Senior Software Engineer
    BEA Systems
    "ARoman" wrote in message
    news:3f44595f$1@newsgroups.bea.com...
    >
    > Hello,
    >
    > I've been trying to use an EJB in a JSP on Weblogic 8.1. The relevent part

    of
    > my web.xml and weblogic.xml look like this:
    > =====================================
    > web.xml -
    >
    >
    > Purchase order bean deployed
    > ejb/Purchaseorder
    > Entity
    > mypackage2.PurchaseorderHome
    > mypackage2.Purchaseorder
    > /PO.jar#Purchaseorder
    >
    >

    >
    >
    > purchase order
    > ejb/Purchaseorder
    > Entity
    > mypackage2.PurchaseorderLocalHome
    > mypackage2.PurchaseorderLocal
    > /PO.jar#Purchaseorder
    >

    > =====================================
    >
    > weblogic.xml -
    >
    > ejb/Purchaseorder
    > Purchaseorder
    >

    >
    > =================================
    > My ejb-jar.xml file looks like this (this EJB jar is already deployed on

    Weblogic):
    >
    >
    > Entity Bean ( CMP )
    > Purchaseorder
    > Purchaseorder
    > mypackage2.PurchaseorderHome
    > mypackage2.Purchaseorder
    > mypackage2.PurchaseorderLocalHome
    > mypackage2.PurchaseorderLocal
    > mypackage2.PurchaseorderBean
    > ==============================================
    > Finally, my weblogic-ejb-jar.xml looks like this:
    >
    >
    >
    > Purchaseorder
    > Purchaseorder
    >

    >

    > ===============================================
    >
    > But despite many many efforts, I keep getting the following error:
    >
    > Could not setup environment - with nested exception:

    [weblogic.deployment.EnvironmentException:
    > [J2EE:160101]Error: The ejb-link '/PO.jar#Purchaseorder' declared in the

    ejb-ref
    > or ejb-local-ref 'ejb/Purchaseorder' in the application module

    'public_html' 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 '/PO.jar#Purchaseorder' declared in the ejb-ref or

    ejb-local-ref
    > 'ejb/Purchaseorder' in the application module 'public_html' could not be

    resolved.
    > The target EJB for the ejb-ref could not be found. Please ensure the link

    is correct.
    > at
    >
    > I have changed around a lot of things. I've a classes directory under

    web-inf
    > where I have mypackage2\all-the-class-files. I've also made available

    PO.jar file
    > (which contains Purchaseorder) at various levels to ensure that the class

    can
    > be found. I've changed the "/PO.jar#Purchaseorder" value of tag

    accordingly
    > to try various things. (e.g ejb/Purchaseorder, mypackage2.Purchaseorder,

    and a
    > lot of other things) but of no avail. I keep getting the same error over

    and over
    > again. (Do you think banging my head on the wall would do the trick?)
    >
    > Any help would be greatly appreciated. Thanks.
    >




  3. Re: Problems in configuring deployment descriptors to use EJB inJSP

    You can only use ejb-links when connecting to EJBs that are in the same
    application (ear). If you want to have them separate you will have to
    use a global JNDI name for the EJB and look up that.

    Sam

    A Roman wrote:
    > Michael,
    >
    > I'm not deploying EJB as an .ear application that'd include web app and .jar.
    > Instead I have deployed .jar as stand alone EJB and want to deploy .war (exploded
    > directory structure) as a seperate web app. Both .jar and .war will be deployed
    > on the same server. That's exactly why I cannot use the syntax that's used in
    > the samples.
    >
    > Thanks.
    >
    > "Michael Kovacs" wrote:
    >
    >>I guess to start off with I'm making the assumption that your PO.jar
    >>is your
    >>EJB module
    >>and that it is contained in the same EAR as your webapp module, looking
    >>something like
    >>this:
    >>
    >>myEAR.ear
    >> |_ PO.jar
    >> |_ webapp
    >> |_ jspCallingEJB.jsp
    >>
    >>If this is correct, the first thing I'd suggest trying is to remove your
    >>"/"

    >
    >>from the front of your and

    >
    >>just make the value PO.jar#Purchaseorder
    >>
    >>The EJB example that ships with 8.1 platform makes use of an EJB from
    >>a jsp
    >>page so you could
    >>look to that example for some guidance, which references the EJB in this
    >>same way in the web.xml ejb-local-ref element.
    >>hope that helps.
    >>--
    >>Michael Kovacs
    >>Senior Software Engineer
    >>BEA Systems
    >>"ARoman" wrote in message
    >>news:3f44595f$1@newsgroups.bea.com...
    >>
    >>>Hello,
    >>>
    >>>I've been trying to use an EJB in a JSP on Weblogic 8.1. The relevent

    >>
    >>part
    >>of
    >>
    >>>my web.xml and weblogic.xml look like this:
    >>>=====================================
    >>>web.xml -
    >>>
    >>>
    >>> Purchase order bean deployed
    >>> ejb/Purchaseorder
    >>> Entity
    >>> mypackage2.PurchaseorderHome
    >>> mypackage2.Purchaseorder
    >>> /PO.jar#Purchaseorder
    >>>
    >>>

    >>>
    >>>
    >>> purchase order
    >>> ejb/Purchaseorder
    >>> Entity
    >>> mypackage2.PurchaseorderLocalHome
    >>> mypackage2.PurchaseorderLocal
    >>> /PO.jar#Purchaseorder
    >>>

    >>>=====================================
    >>>
    >>>weblogic.xml -
    >>>
    >>>ejb/Purchaseorder
    >>>Purchaseorder
    >>>

    >>>
    >>>=================================
    >>>My ejb-jar.xml file looks like this (this EJB jar is already deployed

    >>
    >>on
    >>Weblogic):
    >>
    >>>
    >>> Entity Bean ( CMP )
    >>> Purchaseorder
    >>> Purchaseorder
    >>> mypackage2.PurchaseorderHome
    >>> mypackage2.Purchaseorder
    >>> mypackage2.PurchaseorderLocalHome
    >>> mypackage2.PurchaseorderLocal
    >>> mypackage2.PurchaseorderBean
    >>> ==============================================
    >>>Finally, my weblogic-ejb-jar.xml looks like this:
    >>>
    >>>
    >>>
    >>> Purchaseorder
    >>> Purchaseorder
    >>>

    >>>

    >>>===============================================
    >>>
    >>>But despite many many efforts, I keep getting the following error:
    >>>
    >>>Could not setup environment - with nested exception:

    >>
    >>[weblogic.deployment.EnvironmentException:
    >>
    >>>[J2EE:160101]Error: The ejb-link '/PO.jar#Purchaseorder' declared in

    >>
    >>the
    >>ejb-ref
    >>
    >>>or ejb-local-ref 'ejb/Purchaseorder' in the application module

    >>
    >>'public_html' 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 '/PO.jar#Purchaseorder' declared in the ejb-ref or

    >>
    >>ejb-local-ref
    >>
    >>>'ejb/Purchaseorder' in the application module 'public_html' could not

    >>
    >>be
    >>resolved.
    >>
    >>>The target EJB for the ejb-ref could not be found. Please ensure the

    >>
    >>link
    >>is correct.
    >>
    >>>at
    >>>
    >>>I have changed around a lot of things. I've a classes directory under

    >>
    >>web-inf
    >>
    >>>where I have mypackage2\all-the-class-files. I've also made available

    >>
    >>PO.jar file
    >>
    >>>(which contains Purchaseorder) at various levels to ensure that the

    >>
    >>class
    >>can
    >>
    >>>be found. I've changed the "/PO.jar#Purchaseorder" value of

    >>
    >>tag
    >>accordingly
    >>
    >>>to try various things. (e.g ejb/Purchaseorder, mypackage2.Purchaseorder,

    >>
    >>and a
    >>
    >>>lot of other things) but of no avail. I keep getting the same error

    >>
    >>over
    >>and over
    >>
    >>>again. (Do you think banging my head on the wall would do the trick?)
    >>>
    >>>Any help would be greatly appreciated. Thanks.
    >>>

    >>
    >>

    >




  4. Re: Problems in configuring deployment descriptors to use EJB in


    Sam, thanks for the explanation. It makes sense now that why it's not working.
    But is this specific to Weblogic? I'm actually using JDevloper to develop my
    EJB (CMP) and JSP. Within JSP, I can use the tag library ejbtag provided by Oracle
    to specify home, create instance, and get collection back from an EJB. I've specify
    the tag lib URI in the web.xml but I kept getting the error message in Weblogi
    when running the test to load JSP saying that it could not find the EJB (Purchaseorder)
    specified. That led me to do some research and I came accross the and
    tags.

    If it is a restriction only posed by Weblogic then I guess I'll have to create
    a JavaBean to interact with EJB first and then get the collection.

    Thanks.
    Sam Pullara wrote:
    >You can only use ejb-links when connecting to EJBs that are in the same
    >
    >application (ear). If you want to have them separate you will have to
    >
    >use a global JNDI name for the EJB and look up that.
    >
    >Sam
    >
    >A Roman wrote:
    >> Michael,
    >>
    >> I'm not deploying EJB as an .ear application that'd include web app

    >and .jar.
    >> Instead I have deployed .jar as stand alone EJB and want to deploy

    >.war (exploded
    >> directory structure) as a seperate web app. Both .jar and .war will

    >be deployed
    >> on the same server. That's exactly why I cannot use the syntax that's

    >used in
    >> the samples.
    >>
    >> Thanks.
    >>
    >> "Michael Kovacs" wrote:
    >>
    >>>I guess to start off with I'm making the assumption that your PO.jar
    >>>is your
    >>>EJB module
    >>>and that it is contained in the same EAR as your webapp module, looking
    >>>something like
    >>>this:
    >>>
    >>>myEAR.ear
    >>> |_ PO.jar
    >>> |_ webapp
    >>> |_ jspCallingEJB.jsp
    >>>
    >>>If this is correct, the first thing I'd suggest trying is to remove

    >your
    >>>"/"

    >>
    >>>from the front of your and

    >>
    >>>just make the value PO.jar#Purchaseorder
    >>>
    >>>The EJB example that ships with 8.1 platform makes use of an EJB from
    >>>a jsp
    >>>page so you could
    >>>look to that example for some guidance, which references the EJB in

    >this
    >>>same way in the web.xml ejb-local-ref element.
    >>>hope that helps.
    >>>--
    >>>Michael Kovacs
    >>>Senior Software Engineer
    >>>BEA Systems
    >>>"ARoman" wrote in message
    >>>news:3f44595f$1@newsgroups.bea.com...
    >>>
    >>>>Hello,
    >>>>
    >>>>I've been trying to use an EJB in a JSP on Weblogic 8.1. The relevent
    >>>
    >>>part
    >>>of
    >>>
    >>>>my web.xml and weblogic.xml look like this:
    >>>>=====================================
    >>>>web.xml -
    >>>>
    >>>>
    >>>> Purchase order bean deployed
    >>>> ejb/Purchaseorder
    >>>> Entity
    >>>> mypackage2.PurchaseorderHome
    >>>> mypackage2.Purchaseorder
    >>>> /PO.jar#Purchaseorder
    >>>>
    >>>>

    >>>>
    >>>>
    >>>> purchase order
    >>>> ejb/Purchaseorder
    >>>> Entity
    >>>> mypackage2.PurchaseorderLocalHome
    >>>> mypackage2.PurchaseorderLocal
    >>>> /PO.jar#Purchaseorder
    >>>>

    >>>>=====================================
    >>>>
    >>>>weblogic.xml -
    >>>>
    >>>>ejb/Purchaseorder
    >>>>Purchaseorder
    >>>>

    >>>>
    >>>>=================================
    >>>>My ejb-jar.xml file looks like this (this EJB jar is already deployed
    >>>
    >>>on
    >>>Weblogic):
    >>>
    >>>>
    >>>> Entity Bean ( CMP )
    >>>> Purchaseorder
    >>>> Purchaseorder
    >>>> mypackage2.PurchaseorderHome
    >>>> mypackage2.Purchaseorder
    >>>> mypackage2.PurchaseorderLocalHome
    >>>> mypackage2.PurchaseorderLocal
    >>>> mypackage2.PurchaseorderBean
    >>>> ==============================================
    >>>>Finally, my weblogic-ejb-jar.xml looks like this:
    >>>>
    >>>>
    >>>>
    >>>> Purchaseorder
    >>>> Purchaseorder
    >>>>

    >>>>

    >>>>===============================================
    >>>>
    >>>>But despite many many efforts, I keep getting the following error:
    >>>>
    >>>>Could not setup environment - with nested exception:
    >>>
    >>>[weblogic.deployment.EnvironmentException:
    >>>
    >>>>[J2EE:160101]Error: The ejb-link '/PO.jar#Purchaseorder' declared

    >in
    >>>
    >>>the
    >>>ejb-ref
    >>>
    >>>>or ejb-local-ref 'ejb/Purchaseorder' in the application module
    >>>
    >>>'public_html' 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 '/PO.jar#Purchaseorder' declared in the ejb-ref or
    >>>
    >>>ejb-local-ref
    >>>
    >>>>'ejb/Purchaseorder' in the application module 'public_html' could

    >not
    >>>
    >>>be
    >>>resolved.
    >>>
    >>>>The target EJB for the ejb-ref could not be found. Please ensure the
    >>>
    >>>link
    >>>is correct.
    >>>
    >>>>at
    >>>>
    >>>>I have changed around a lot of things. I've a classes directory under
    >>>
    >>>web-inf
    >>>
    >>>>where I have mypackage2\all-the-class-files. I've also made available
    >>>
    >>>PO.jar file
    >>>
    >>>>(which contains Purchaseorder) at various levels to ensure that the
    >>>
    >>>class
    >>>can
    >>>
    >>>>be found. I've changed the "/PO.jar#Purchaseorder" value of
    >>>
    >>>tag
    >>>accordingly
    >>>
    >>>>to try various things. (e.g ejb/Purchaseorder, mypackage2.Purchaseorder,
    >>>
    >>>and a
    >>>
    >>>>lot of other things) but of no avail. I keep getting the same error
    >>>
    >>>over
    >>>and over
    >>>
    >>>>again. (Do you think banging my head on the wall would do the trick?)
    >>>>
    >>>>Any help would be greatly appreciated. Thanks.
    >>>>
    >>>
    >>>

    >>

    >
    >



  5. Re: Problems in configuring deployment descriptors to use EJB in

    Hi,

    According to the J2EE 1.3 specification, section 5.3.2 the target
    enterprise bean can be in any ejb-jar file in the same J2EE application
    as the referencing application component.

    It's possible that the other containers treat independently deployed
    EJBs and webapps as being in some virtual default application. WebLogic
    does not. I'll forward on your feedback.

    Sam

    A Roman wrote:

    > Sam, thanks for the explanation. It makes sense now that why it's not working.
    > But is this specific to Weblogic? I'm actually using JDevloper to develop my
    > EJB (CMP) and JSP. Within JSP, I can use the tag library ejbtag provided by Oracle
    > to specify home, create instance, and get collection back from an EJB. I've specify
    > the tag lib URI in the web.xml but I kept getting the error message in Weblogi
    > when running the test to load JSP saying that it could not find the EJB (Purchaseorder)
    > specified. That led me to do some research and I came accross the and
    > tags.



+ Reply to Thread