Build question

Using NetBeans 5.5:

Let's say I have created an Enterprise Application with an EJB called MyEJB.

I have also created a Web Application that is a client or consumer of MyEJB. While editing the Web Application I can right click inside my java file and select Enterprise Resources->call EnterpriseBean. This creates some code inside my java file to find the home interface to MyEJB.

Now here is where my question arises. In addition to the code this creates this procedure also adds the necessary import statements. Unfortunately, the web application won't compile because the added imports aren't in any jar files or libraries in my web application.

I can add the entire MyEJB.jar to the Web App but this seems foolish when all I really need is a jar file with the MyEJB interfaces.

Is there anyway to get NetBeans to automatically create a jar file like this when I create an EJB? I hope have made my question clear.

Thanks,

Bryan

[984 byte] By [bwootena] at [2007-11-27 2:30:01]
# 1

I think the correct way to do this is to include the webmodule in the enterprise application.

Even if ejb.jar is included to satisy compile time dependencies and the compile succeeds, the calls will break in runtime. If the web application and enterprise application are deployed separately in the server, then they will be running as separate applications and will not be able to directly call each other. So, the web application will need to be deployed as a webmodule.

You may want to take a look at: http://www.netbeans.org/kb/50/quickstart-j2ee.html

KarthikRa at 2007-7-12 2:43:28 > top of Java-index,Development Tools,Java Tools...
# 2

Thanks for the reply, I understand you point but it doesn't address the real issue.

I have several (100s) of Web applications that all need to use the functionality of this EJB.

For example I work at a University and this EJB provides services for maintaining Student information (name, address, etc). Virtually every app we have need to access this student information.

I don't want to create one giant Web application that includes all these smaller apps. We have that situation now and are trying to move to a more modular system were invidual apps can be deployed / restarted / updated without affecting all the apps.

And since EJBs can be called remotely it seems a Web app that calls the eJB using the remote interface would not be part the the enterprise application that deploys the EJB.

I realize I can package the interface files from the EJB as a seperate jar file, but I am not sure how to create a build process in the IDE that insures everything is update and in sync.

bwootena at 2007-7-12 2:43:28 > top of Java-index,Development Tools,Java Tools...
# 3

I had misunderstood the original question; i apologize. You are right that webapps should be able to call ejbs remotely.

> I realize I can package the interface files from the EJB as a seperate jar file

There is a FAQ entry, http://wiki.netbeans.org/wiki/view/DevFaqCallEjbFromNbm , which details how to make calls to ejbs from a standalone application:

ensure that the same applies to jar with EJB interfaces and its helper classes

So, as you have said, the interfaces and helpers need to be packaged and made available in the classpath.

> but I am not sure how to create a build process in the IDE that insures everything

In the project properties dialog for a webapp (right-click on project, select properties), if you go to 'Libraries' panel, you will notice 'Add Project...' button that lets you add other projects that the webapp may depend on. There is also a checkbox 'Build required projects' which is checked by default. Would you be able to use this feature to create multiple projects and make sure they reference each other and remain in sync?

> is update and in sync.

KarthikRa at 2007-7-12 2:43:28 > top of Java-index,Development Tools,Java Tools...