Classes not exposed under Eclipse Indigo (STS) [message #849018] |
Wed, 18 April 2012 16:12  |
Eclipse User |
|
|
|
Hi there.
I'm using eclipse indigo to create a dynamic web app using Libra. The OSGi framework I'm using is the one that come by default with eclipse (ie: equinox)
I'm basically following the demo video to use Libra.
It's deploying everything fine (META-INF, WEB-INF, jsp, css, ...) expect the classes (which are in build/classes).
So basically I can't execute any Java code.
I forgot to mention that I'm using Libra (OSGi Bundle Facet - 0.1.2.201202130952 & WAR Products - 0.1.1.201202130952)
[Updated on: Wed, 18 April 2012 16:15] by Moderator
|
|
|
Re: Classes not exposed under Eclipse Indigo (STS) [message #849583 is a reply to message #849018] |
Thu, 19 April 2012 05:14   |
Eclipse User |
|
|
|
Hi, what you describe is the expected behavior. By default the compiled Java classes of a Dynamic Web project go to build/classes. However, this should not be a problem for the tutorial you are watching. If you launch an OSGi Framework via the PDE tools, then Equinox will automatically knows to look for the classes in build/classes. If you export your web project to a WAR, then the classes will be included in WEB-INF/classes in the exported WAR. Respectively, if you export your web project to a Bundle JAR via Export > Deployable plug-ins and fragments, then the classes again go to WEB-INF/classes in the exported JAR.
Nevertheless, if you want to have the compiled classes in the WEB-INF/classes during design time, you can do this by changing the default Java output for the project. You can achieve this in two ways:
1. During project creation. Go to the second wizard page for configuring the Java capabilities. At the bottom there is a field "Default output folder". Change it to "WebContent/WEB-INF/classes".
2. In an existing project. Call the Properties of the project. Go to the Java Build Path page. In the Source tab page, at the bottom you will see the "Default output folder" field. Change the value to "WebContent/WEB-INF/classes".
Don't forget to disable the "Java output folder" filter in the Project Explorer, so you can see the compiled classes.
|
|
|
|
|
Re: Classes not exposed under Eclipse Indigo (STS) [message #852863 is a reply to message #852094] |
Sun, 22 April 2012 08:00  |
Eclipse User |
|
|
|
I've solved my problem.
Apparently when using PDE+WTP (with libra) spring web mvc can't manage to find the controller classes if you provide them via the package where to look for controllers (ie: <context:component-scan base-package="package.to.web.controller" />)
To make it work you need to declare each controller as a standard bean (ie: <bean id="controller" class="package.to.web.controller.Controller" scope="prototype" />).
If anyone need help on the matter I'll gladly give an hand.
Edit: using the package to declare where the controller can be found properly work, but you need to manually install the bundle, which is not really a solution for development.
[Updated on: Sun, 22 April 2012 08:02] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.13665 seconds