3362

Why does Eclipse not deploy dependency to Glassfish?

Question:

I am using Eclipse Helios, Glassfish 3.0.1 (Full Platform) and myfaces 2.0 .

There a two projects in the workspace: A simple Java project (=> JP) and a dynamic web project (=> WP). I added JP to the classpath of WP.

I added one class from JP as a managed bean to the faces-config.xml file of WP.

<managed-bean> <managed-bean-name>myBean</managed-bean-name> <managed-bean-class>myPackage.MyBean</managed-bean-class> <managed-bean-scope>application</managed-bean-scope> </managed-bean>

When I deploy the package and make a request, an error message is displayed. It says, that the myPackage.MyBean class could not be found.

If I look into WEB-INF/classes directory, of the deployed and running WP project, this directory is empty.

I did not wrote any classes inside WP itself yet, <strong>but shouldn't be the classes of JP in that directory?</strong>

<strong>What can I do to deploy JP together with WP?</strong>

Thanks in advance.

Answer1:

You need to set the plain Java Project as a module/deployment dependency. In the current Eclipse version (Helios, 3.6) you can do it in <em>Deployment Assembly</em> of the project's properties. In the older versions (Galileo, 3.5 and before) you can do it in <em>Java EE Module Dependencies</em> of the project's properties. It will then end up as a JAR in /WEB-INF/lib.

Answer2:

Failing the eclipse tie-in of "Module Dependencies" (or if it all seems complicated) then manually jar the class files of project JP (e.g. as jp.jar) and add the jar to WEB/INF/lib of project WP

this will fix your ClassNotFoundException

Recommend

  • JSF 1.2 : Not able to retrieve bean values in xhtml page
  • How to detect change in form if added a new row in prime faces datatable
  • Sightly jstl c:set analog
  • log4j: Class name showing in log is not correct when I call the logger from another class
  • Grails and Groovy metaclass package name convention
  • Referencing a CDI Bean in a non managed CDI Bean
  • How to set logback.xml properties in application.yaml
  • Render JSF h:message with p element instead of span
  • Change projection in MSSQL for web mapping (Leaflet,Openlayer, OpenStreetMaps, GoogleAPI, …) to WSG4
  • OpenCV with Python error - Assertion failed ((mask.type() == CV_8UC1 || mask.type() == CV_8SC1)) in
  • professional usage of abstract class for translation
  • How to call BeanFactoryPostProcessor.postProcessBeanFactory method when use Spring with XML configur
  • JPA CDI Injecting DAO into an Entity
  • What is the likely cause of a net::ERR_CONNECTION_ABORTED when uploading a file to Spring
  • Wrapping a c#/WPF GUI around c++/cli around native c++
  • Can I use AllJoyn Framework for Wifi Direct in iOS?
  • Display validation errors inside
  • x64 applications using gdi+: what are the consequences on performance?
  • Play WS (2.2.1): post/put large request
  • How to get a value (ex: baseURL) in every Karate feature?
  • Knitr HTML Loop - Some HTML output, some R output
  • Deserializing XML into class C#
  • Invalid access key error using credentials redeemed from an amazon open id token
  • Circular dependency while pushing http interceptor
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Is there a mandatory requirement to switch app.yaml?
  • Cannot Parse HTML Data Using Android / JSOUP
  • InvalidAuthenticityToken between subdomains when logging in with Rails app
  • Benchmarking RAM performance - UWP and C#
  • Load html files in TinyMce
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • coudnt use logback because of log4j
  • Java static initializers and reflection
  • unknown Exception android
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Unable to use reactive element in my shiny app
  • java string with new operator and a literal