views:

31

answers:

2

Hi,

I have setup a dynamic web project in eclipse with JSF in which I trust on code from another project (framework). Therefore, I added the framework project to the build path of the website project.

So far so good, Eclipse recognises every class and the project builds without errors.

Problem is though that when I do "run on server" to test it on tomcat 6.0.24, the application fails. I get ClassNotFoundException on every class from the framework project.

Is this a bug or is some specific configuration necessary for this?

A: 

Did you check Warnings in Problems view?

Do you see Classpath entry /your/framework.jar will not be exported or published. Runtime ClassNotFoundExceptions may result warning?

If you do.

  1. Right-Click the warning and choose Quick Fix.
  2. Choose "Mark the associated entry as publish/export dependency." from Select a Fix box.
  3. Click Finish.

EDIT
Now, I think I understand where disconnect is. I think now I remember the joy of figuring this out for the first time.

In your website project ( I will speculate here , but I guess you've created it as a Dynamic Web Project ):

  1. Open project properties
  2. Select Java EE Module Dependencies panel
  3. Check your framework project in JAR/Module column. Beware, that for reasons not known to me, the list is not sorted ( and is not sortable ) in any particular order, so you may need to search for your project reference there.

The results of this operation will be written to /website-project/.settings/org.eclipse.wst.common.component file. Put this file into your source control.

Alexander Pogrebnyak
No nothing, I only see some code related warnings, nothing I didn't expect (deprecation and such things).
Steven De Groote
@Steven. Did you mark framework jar files as exported in Build Path `Order and Export` tab?
Alexander Pogrebnyak
Actually I think the problem is that there is no framework.jar, instead only the framework sources in the framework project which I need to use and deploy when running my website project.I expect I need to modify the org.eclipse.wst.common.component file, but I cannot work out how I add an entry that refers to a different project.
Steven De Groote
I haven't found an ideal solution yet, but I have added an ant builder task to my framework project to automatically create a jar of my framework, and then use that jar from the website project.
Steven De Groote
@Steven. I've updated my answer, please check if that helps you.
Alexander Pogrebnyak
A: 

First, why you think you want to deploy "sources". Normally one want to deploy compiled classes.

Second, is the "framework"-project a java-project or a dynamic-web-project. It would work only with java-project.

Third, you need to do:

  1. Open project properties Select Java EE
  2. Module Dependencies panel Check your
  3. check your "framework" project in JAR/Module column

If this does not work for you, apply for a management job. :-)

iimuhin