Jump to content
  • Refresh on workspace not working correctly


    anaq
    Assigned User Massimo Rabbi
    CategoryBug report
    PriorityHigh
    ReproducibilityAlways
    ResolutionFixed
    SeverityCritical
    StatusResolved
    Versionv6.0.1

    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



    User Feedback

    Recommended Comments

    Changed Assigned User from - to @User_306070


    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.
    Link to comment
    Share on other sites

    Changed Resolution from Open to Unable to Reproduce

    Changed Status from New to Closed

    Changed Assigned User from @User_306070 to -


    Closing for lack of information. Please reopen if needed attaching further explaination.Regards,Massimo
    Link to comment
    Share on other sites

    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.

    Link to comment
    Share on other sites

    Changed Priority from Normal to High

    Changed Severity from Minor to Critical

    Changed Resolution from Unable to Reproduce to Open

    Changed Status from Closed to New


    Link to comment
    Share on other sites

    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.

    Link to comment
    Share on other sites

    Changed Resolution from Open to Fixed

    Changed Status from Feedback Requested to Resolved

    Changed Assigned User from @giulio to @mrabbi


    Hi, a fix was introduced in order to be able to correctly reload changes that are operated to external bin folders (like the case above) or jar files.It might be necessary to hit F5 or refresh on the project when this happens. A solution that helps avoiding the manual refresh is enabling in the Preferences the option General > Workspace > Refresh using native hooks or polling. I personally verified that this works fine with bin folders but it seems that with jar changes (i.e you update externally a jar that is among the referenced libraries) you might still need to hit F5/Refresh. By the way as far as I know that preference option is something very tight related to the OS you are working on, so it might work or not depending if you are working on Linux, Windows or Mac. The changes were committed on the trunk.Regards,Massimo.
    Link to comment
    Share on other sites


×
×
  • Create New...