[#4050] - Refresh on workspace not working correctly

Category:
Bug report
Priority:
High
Status:
Feedback Requested
Project: Severity:
Critical
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:
0

I' creating a report which uses javabean collection datasource with DTO objects contains other DTO objects. This DTOs are defined in a Netbeans project and imported into workspace as External class folder.
When I change the DTO class (in Netbeans -> Clean&Build on project) and use Refresh (F5) on workspace in Jasper Studio, report is unable to compile because of this exception:
net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
...
Caused by: java.lang.ClassCastException: com.x.y.MyDto cannot be cast to com.x.y.MyDto

I think there is problem with the class versioning - jasper holds old version of MyDto class and tries to cast it to the new version.
Report compiles without problems after restarting Studio. This is annoying, because I'm creating the DTO together with a bigger report and I have to restart Studio very frequently.

Michal

v6.0.1
anaq's picture
6
Joined: Mar 4 2010 - 2:02am
Last seen: 2 years 5 months ago

8 Comments:

#1
  • Assigned:»

Eclipse has it's own mechanism to reaload the modified classes, but they must be modified from eclipse itself. Essentially everything that is shown inside the workspace is under the eclipse filesystem (even if it's a linked folder) and there are handlers to reload the elements when necessary. But this handler start only when something is modified from inside eclipse. In your case there is something that it is putting the new classes stealthy under eclipse, so eclipse dosen't recognize and doesn't reload the class. The eclipse refresh also has nothing to do with the class reloading, it only update the tree essentially.
I will look if there is something we can do, but at the moment i suggest to move your project from netbeans to eclipse\jss, se when you rebuild it the platform will automatically load the new classes.

#2
  • Resolution:Open» Unable to Reproduce
  • Status:New» Closed
  • Assigned:»

Closing for lack of information. Please reopen if needed attaching further explaination.

Regards,
Massimo

#3

This is a problem that should have a solution. I'm also developing reports that have ties to classes developed in NetBeans (for packaging and deployment reasons).

Attached is a screen shot (class-files.png) of the directory hierarchy that shows two classes in the "jasper" package:

- EmbeddedImageTranscoder
- ReportFormatFactory

Attached is a screen shot (js-studio-class-files.png) showing the same build directory after refreshing (F5) and restarting JasperSoft Studio.

The EmbeddedImageTranscoder class is not picked up by JS Studio.

The file exists in the file system, so regardless of how Eclipse has its files set up, refreshing should go back to the operating system's file system to pick up any new classes.

AttachmentSize
class-files.png9.96 KB
js-studio-class-files.png19.27 KB
#4
  • Priority:Normal» High
  • Severity:Minor» Critical
  • Resolution:Unable to Reproduce» Open
  • Status:Closed» New
#5

Here is how to work around the issue:

0. Compile the project in NetBeans to create its build/classes directory.
1. Select Project >> Properties
2. Select Java Build Path.
3. Click Libraries tab.
4. Click Add External Class Folder.
5. Browse to and select NetBeans classes directory (from step 0).
6. Click OK.

To make a relative path:

1. Quit Jaspersoft Studio.
2. Open ".classpath" file in the project's directory.
3. Change classpathentry for classes directory to use "../..", up as many levels required.
4. Save the file.
5. Restart Jaspersoft Studio.

The classes should now refresh. Test it:

1. Open directory containing a class built with NetBeans.
2. Delete a class file.
3. Return to Jaspersoft Studio.
4. Expand classes folder where class was deleted in Jaspersoft Studio.
5. Select the Project (must click it!)
6. Press F5 to refresh

NOTE: Pressing F5 with "classes" folder selected will not work -- MUST press F5 when selecting the project name.

Now the directory refreshes as expected.

Not sure if the classloader will reload changes to the .class files, but at least it's a viable workaround.

#6
  • Assigned:» giulio
#7

Can you clarify, please, which option do you use (from the ones, displayed on the screenshot) to import your classes?

Screenshot: http://joxi.net/Y2LXl3kI9JgNE2

Thanks.

#8
  • Status:New» Feedback Requested
Feedback