facebook

EJB jar not being included in web project

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #263029 Reply

    wsweetman
    Member

    Hi,

    I have tried deploying separately and as an enterprise application but I am having trouble with the inclusion of a client ejb jar in a ejb client web appliation project. This makes the client project unable to access the ejb tier. NetBeans carries this task out without configuration. I cannot seem to find any documentation that would indicate how this could be achieved within MyEclipse. Could I be pointed in the right direction?

    #263118 Reply

    Riyad Kalla
    Member

    Absolutely. A quick overview of how enterprise projects work in MyEclipse is as follows:

    
    + Enterprise Application Project (Meta-project)
      + 0+ EJB Projects (Modules)
      + 0+ Web Projects (Modules)
      + 0+ Java Projects (Common library projects required by modules)
    

    In the notation above, “Meta-project” means that the Enterprise Application Project (EAP) is actually an umbrealla used to specify a bunch of modules that comprise the application. It doesn’t actually contain a source tree and code or anything like that.

    Also the “0+” notation means 0 or more. So you could have an EAR that was just a bunch of EJB projects, or an EAR that was 3 web projects, or an EAR that was 1 EJB project, 2 Web projects and then a Java Project that contained all the common library code that all the projects used.

    Normally when we have new developers comming over from other IDEs, it’s an issue of mentally mapping what they have, to the ME project structure and it’s fairly straight forward. After reading this let me know if you need more help figuring out how these puzzle pieces fit together. Let me know the “modules” you have, what common links they have and I’ll see if I cna help you lay it all out.

    #263146 Reply

    wsweetman
    Member

    This was not exactly my question and I appologise if it was not clear from my first mail. I have an ejb module and a web project. If I deploy as an enterprise application project I am not able to authenticate (I am using an LDAP realm and the modules are being deployed to sun application sever). If I deploy separately to the server I am able to authenticate but the calls from the web app to the business tier fail. Even though the ejb project is on build path and the web project is configured to jar dependent project in lib dir the ejb jar is not included in the web project.

    Maybee this is something that eclipse is not intended to achieve and that I have to manually add the client jar that is created by the ejb module deployment to the web project

    There is an option in standard eclipse platfrom to create an ejb client jar project from a ejb project which seems to have been removed by myeclipse. This ejb client jar project could have been included as the dependent project for the web application so the client jar would have been included in the web project upon deployment. Why was this removed?

    #263155 Reply

    Riyad Kalla
    Member

    Actually this is a very standard deployment setup. When you create an EAR project, and as part of the wizard create an EJB and Web module, you’ll notice that the Web module immediately gets the EJB added to it’s project reference/build path. This is because the EAR classloader hierarchy when the projects are deployed allow that access level. So it’s assumed your web project will be using your EJB modules.

    When you deploy your EAR it should all be correct unless something was mangled in the build paths from the default and they cannot see eachother. What I was a bit confused about was this comment;

    If I deploy as an enterprise application project I am not able to authenticate (I am using an LDAP realm and the modules are being deployed to sun application sever). If I deploy separately to the server I am able to authenticate but the calls from the web app to the business tier fail.

    So it sounds like when you deploy the whole EAR, it’s working as it should, but your auth is failing for some reason (config is my guess)… but when you deploy separately *then* your interaction between the Web/EJB modules fail… so why not just keep deploying everything together and try and troubleshoot why LDAP is failing?

    #263209 Reply

    wsweetman
    Member

    I am carrying out that task but I can see that in the future there will be a requirement to access these ejbs from a web project that could be deployed on a different server. There is still the need to create this client jar project.

    I dont quite get what you mean by config though. Could you expand? I could see what you are poiting at if authentication fails all of the time but not if it only fails for the web module if deployed within an EAR file.

    #263213 Reply

    Riyad Kalla
    Member

    wsweetman,
    Are you talking about a J2EE Enterprise Client Project? We had another user recently request this type of project be added. It is new to me (haven’t heard of it until now) so I’m still rusty on the full usages of it.

    Also as far as config, I just meant the authentication/LDAP configuration because you said it was failing… but independent of that, I think I understand your situation a little better and see that you may need to deploy these modules separately and have them work.

    #263215 Reply

    wsweetman
    Member

    this is from the eclipse help

    EJB client JAR projects
    An EJB client JAR project contains all the class files that a client program needs to use the client view of the enterprise beans that are contained in the EJB module.

    With the EJB tooling, you can create an EJB project with a corresponding EJB client JAR project. The EJB project will depend on the EJB client JAR project. The EJB client JAR project contains all necessary classes for a client of the enterprise beans, including all interface classes, key classes, and supporting classes. Because these classes are not duplicated in the EJB project, the EJB project depends on its EJB client JAR project. Any project that has a reference to an enterprise bean in the EJB project will need a reference to the EJB client JAR project. If the EJB client JAR project is in another enterprise application, the EJB client JAR file must be added to the referencing EAR file as a utility JAR file.

    After the EJB client JAR project is created, it is up to you to add any necessary value objects to this project that are needed by the home or component interfaces. If the objects are not present, compilation errors will result.

    EJB client JAR files

    EJB client projects are exported as EJB client JAR files when the application is exported. The EJB client JAR file is specified in the deployment descriptor of the EJB JAR file using the optional ejb-client-jar element. The value of the ejb-client-jar element is the path name specifying the location of the EJB client JAR file in the containing J2EE Enterprise Application Archive (.ear) file. The value of the path name is a URI relative to the EJB JAR file within the application.
    Note: The relative URI path for the EJB client JAR file should be the same in all applications that the EJB project belongs to.
    When you create an EJB client JAR project for an EJB project, the EJB client JAR file is added to the containing enterprise application as a project utility JAR. The reference to this EJB client JAR file cannot be removed from the enterprise application as long as the EJB project is defined as a module for the application.

    Important: If you use the Export EJB JAR file wizard to export an EJB project, the export wizard does not include an EJB project’s associated EJB client JAR project. To include the EJB client JAR file, it is recommended that you export the enterprise application EAR file that contains the EJB project. The resulting EAR file will include any dependent EJB client JAR files as utility JAR files. Alternatively, you can export the EJB client JAR project separately as a JAR file.

    The project that you mention is for non-web clients

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: EJB jar not being included in web project

You must be logged in to post in the forum log in