Giter Club home page Giter Club logo

Comments (10)

zdenek-jonas avatar zdenek-jonas commented on June 18, 2024 2

The version 1.3.1 has been released. Please test it again, if any problems occurs, just reopen this issue.

from store.

zdenek-jonas avatar zdenek-jonas commented on June 18, 2024 1

Thank you for providing us with the demo. I can confirm that this is a bug.
We are now working on the new Spring Integration, we will fix it together.

from store.

zdenek-jonas avatar zdenek-jonas commented on June 18, 2024 1

The reason for this problem is, that the Root object is created with another classloader als application context classloader.

This must be fixed.

@manideeps
as temporary workaround, disable root in configuration and created it manually for the first time:

@SpringBootApplication
@Import(EclipseStoreSpringBoot.class)
public class StoredemoApplication {

  public static void main(String[] args) {
    ConfigurableApplicationContext context = SpringApplication.run(StoredemoApplication.class, args);
    StorageManager manager = context.getBean(StorageManager.class);
    Object root = manager.root();

    if (root == null) {
      root = new Data();
      manager.setRoot(root);
      manager.storeRoot();
    }

    if (root instanceof Data data){
      System.out.println("Welcome---"+data.getWelcomeText());
      System.out.println("Root is data");
      data.setWelcomeText(data.getWelcomeText()+"-append--"+"welcome again");
      manager.storeRoot();
    }else {
      System.out.println("Root is not data");
    }

  }

}

from store.

zdenek-jonas avatar zdenek-jonas commented on June 18, 2024 1

It will be fixed with this PR:
#136

from store.

zdenek-jonas avatar zdenek-jonas commented on June 18, 2024

Do you create your own embedded manager or is injected by Spring? Could you prepare some repository, to see, what are you doing and help us to identify the problem?

In general, the issue is that with dev tools, the classes are loaded by a different class loader than the default one.
Therefore, I need to know exactly what you are doing and how you are using it, so I can assess whether it is an error in our code or incorrect usage.

from store.

manideeps avatar manideeps commented on June 18, 2024

I used the storage manager created by spring. But Issue occurs for own embedded manager as-well. Repo is - https://github.com/manideeps/eclipsestore-sample

from store.

manideeps avatar manideeps commented on June 18, 2024

There is no issue when app starting for first time or with empty storage directory. But from next time when eclipsestore loading existing from storage directory or root object , its throws TypeCastException

from store.

fschon avatar fschon commented on June 18, 2024

Can you explain in a little more detail on how to get this workaround working please.

See also my question with code at: #158

I have commented out the data root in application.properties and modified the main() as per your code above, but now get an error:

Caused by: java.lang.NullPointerException: Cannot invoke "com.example.data.DataRoot.emails()" because the return value of "com.example.data.Emails.dataRoot()" is null

from store.

hg-ms avatar hg-ms commented on June 18, 2024

Hello fschon,

Did you try to delete the storage after doing the modifications of your code?
The exception you posted indicates that the stored root is null.
The workaround manually creates a new Root object if it’s null and then sets the root element and stores it:

if (root == null) {
   root = new Data();
   manager.setRoot(root);
   manager.storeRoot();
}

Looking at you code in #158 I found another problem in the ‘Emails.save(String email) method’ :
This methods calls the store on the passed String but not on the List the String is added. This way the modification of the Emails list is not persisted and, after reloading the storage, the Emails list does not contain the added email.
You need to store the list storageManager.store(dataRoot().emails()). The added email will then be stored implicitly if it is not already stored. (see https://docs.eclipsestore.io/manual/storage/storing-data/lazy-eager-full.html for details)

from store.

amagnolo avatar amagnolo commented on June 18, 2024

This bug was driving me crazy!
Since spring-boot-devtools is enabled by default in Vaadin, this is probably turning away most Vaadin users who saw the EclipseStore webinar and wanted to give it a try.
You should at least mention in the 1.2 documentation that the solution to TypeCastException is to either remove org.eclipse.store.root from application.properties or spring-boot-devtools from the dependencies (or wait for next release with the fix).

from store.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.