File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Creating a managed bean from a referenced project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Creating a managed bean from a referenced project" Watch "Creating a managed bean from a referenced project" New topic
Author

Creating a managed bean from a referenced project

Chris Stewart
Ranch Hand

Joined: Sep 29, 2001
Posts: 124
I'm working in Eclipse on a JSF project. I have a POJO I want to reference from another project in my workspace. I've added this project to my build path in the Eclipse project properties. If I attempt to reference the class in the external project in the managed-bean-class element, it isn't found. I can create the POJO in the same project, change the namespace to the local project, and it works fine. I can only assume I'm missing a needed reference. Any help would be greatly appreciated.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16158
    
  21

Eclipse has absolutely zero to do with running a JSF webapp as far as cross-referencing projects are concerned. No matter what you define in Eclipse, it won't get referenced come runtime. The only things that your webapp container and the webapp itself can locate are items in the deployed application or in the webapp container's CLASSPATH chains.

On the other hand, if what you really mean is that you have created some sort of component that you want to deploy as part of a webapp, but the component is constructed outside of the project where you're building the webapp itself, you need to tailor the webapp build process so that the constructed component will be copied into the resulting deployable unit. In other words, if I made a Google Maps JSF tag component (which actually, I have) and made it a drop-in component in a JAR, I would copy that JAR into my webapp build. If the actual Google Maps component JAR is built in a different Eclipse project, about the only things Eclipse will do for me is allow me to get at the internal symbols for debugging purposes and ensure that any automated dependent build processes get done in the proper order (most of my deployables are built with Maven or Ant, so that's of limited use to me).


Customer surveys are for companies who didn't pay proper attention to begin with.
Chris Stewart
Ranch Hand

Joined: Sep 29, 2001
Posts: 124
Tim,

That makes sense. I'm currently running my application in Tomcat using the built-in server functionality with Eclipse. I suspect I'll need to somehow alter that "run" process to include a custom Ant script. Is that the correct path to take, or is there a better way?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16158
    
  21

It's not a "run" thing, it's a "build" thing. Doesn't matter if you use Eclipse, Ant, or even DOS batch files.

The Tomcat that Eclipse is running is still Tomcat - just launched and managed by Eclipse - and it's still subject to the same constraints that every other J2EE container is. Which is that if you want an application to be able to see something, it has to be party of the application's deployment unit (WAR). No peeking outside.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16158
    
  21

It's not a "run" thing, it's a "build" thing. Doesn't matter if you use Eclipse, Ant, or even DOS batch files.

The Tomcat that Eclipse is running is still Tomcat - just launched and managed by Eclipse - and it's still subject to the same constraints that every other J2EE container is. Which is that if you want an application to be able to see something, it has to be party of the application's deployment unit (WAR). No peeking outside.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Creating a managed bean from a referenced project