Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Libra » Classes not exposed under Eclipse Indigo (STS)
Classes not exposed under Eclipse Indigo (STS) [message #849018] Wed, 18 April 2012 20:12 Go to next message
Mastah Naleh is currently offline Mastah NalehFriend
Messages: 32
Registered: April 2012
Member
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 20:15]

Report message to a moderator

Re: Classes not exposed under Eclipse Indigo (STS) [message #849583 is a reply to message #849018] Thu, 19 April 2012 09:14 Go to previous messageGo to next message
Kaloyan Raev is currently offline Kaloyan RaevFriend
Messages: 189
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
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 #850707 is a reply to message #849583] Fri, 20 April 2012 08:52 Go to previous messageGo to next message
Mastah Naleh is currently offline Mastah NalehFriend
Messages: 32
Registered: April 2012
Member
Actually my classes are deployed correctly.
If I create a servlet and register it, it work properly. The servlet is found and do it's job.

My problem is more specific: using spring-dm and spring-web mvc.

In the big line: spring doesn't manage to find the controller classes (which are supposed to be in the classpath as much as the servlet is). The package containing all the classes is provided so spring can scan for the classes with the proper annotation. But for a reason that I don't understand yet, spring can't manage the find classes with the annotation even if they are supposed to be in the classpath.

If I deploy the bundle manually (ie: install file:/...) spring manage to find the annotated classes.

[Updated on: Fri, 20 April 2012 08:56]

Report message to a moderator

Re: Classes not exposed under Eclipse Indigo (STS) [message #852094 is a reply to message #850707] Sat, 21 April 2012 17:09 Go to previous messageGo to next message
Kaloyan Raev is currently offline Kaloyan RaevFriend
Messages: 189
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Unfortunately, I don't have much experience with Spring. Could you attach an example project and give instructions how to reproduce the problem?
If you are deploying to Spring DM, then you can also try to look for help in the Eclipse Virgo forum. Virgo is the successor of Spring DM and the committers in this project have strong background in Spring.
Re: Classes not exposed under Eclipse Indigo (STS) [message #852863 is a reply to message #852094] Sun, 22 April 2012 12:00 Go to previous message
Mastah Naleh is currently offline Mastah NalehFriend
Messages: 32
Registered: April 2012
Member
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 12:02]

Report message to a moderator

Previous Topic:NPE trying to convert a JPA project into a OSGi project
Next Topic:OSGi framework launcher
Goto Forum:
  


Current Time: Tue Nov 25 21:24:54 GMT 2014

Powered by FUDForum. Page generated in 0.02253 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software