GithubHelp home page GithubHelp logo

Comments (12)

mfatihercik avatar mfatihercik commented on May 21, 2024

İf you write absolute path to "dsm-config-file.yaml" it will work. Problem is not related to DSM. Java can't find the file. if the file is in your class path you should use getResourceasStrram function.

Please check #11 issue. You can find example usage getResourceasStrram. İf problem isn't solved please let me know.

from dsm.

sivareddyuppathi avatar sivareddyuppathi commented on May 21, 2024

Thanks for quick response .....

i wrote absolute path to builder. builder object is created

when i am trying to create dsm object i am getting the error

here is my code..

DSMBuilder builder = new DSMBuilder(new File("C:\\Users\\SivireddyUppathi\\Downloads\\split_1580192862146\\dsmYML.yml"));
DSM dsm = builder.setType(DSMBuilder.TYPE.XML).create();
Pet pet = (Pet) dsm.toObject(new File("C:\\Users\\SivireddyUppathi\\Downloads\\split_1580192862146\\dsmXML.xml"));

error in second line...

from dsm.

mfatihercik avatar mfatihercik commented on May 21, 2024

can you please write the error you get.

from dsm.

sivareddyuppathi avatar sivareddyuppathi commented on May 21, 2024

run:
Exception in thread "main" java.lang.IllegalArgumentException: URI is not hierarchical
at java.io.File.(File.java:418)
at com.github.mfatihercik.dsb.resource.FileSystemResourceAccessor.addRootPath(FileSystemResourceAccessor.java:54)
at com.github.mfatihercik.dsb.resource.AbstractResourceAccessor.init(AbstractResourceAccessor.java:39)
at com.github.mfatihercik.dsb.resource.FileSystemResourceAccessor.init(FileSystemResourceAccessor.java:47)
at com.github.mfatihercik.dsb.resource.FileSystemResourceAccessor.(FileSystemResourceAccessor.java:27)
at com.github.mfatihercik.dsb.configloader.AbstractConfigLoader.setResourceAccessor(AbstractConfigLoader.java:89)
at com.github.mfatihercik.dsb.configloader.AbstractConfigLoader.(AbstractConfigLoader.java:32)
at com.github.mfatihercik.dsb.configloader.YamlConfigLoaderStrategy.(YamlConfigLoaderStrategy.java:11)
at com.github.mfatihercik.dsb.DSMBuilder.create(DSMBuilder.java:99)
at com.ads.ammdatatypes.vo.DSMStAX.main(DSMStAX.java:38)
C:\Users\SivireddyUppathi\AppData\Local\NetBeans\Cache\11.0\executor-snippets\run.xml:111: The following error occurred while executing this line:
C:\Users\SivireddyUppathi\AppData\Local\NetBeans\Cache\11.0\executor-snippets\run.xml:94: Java returned: 1
BUILD FAILED (total time: 1 second)

from dsm.

mfatihercik avatar mfatihercik commented on May 21, 2024

When you pass File object to DSM.toObject, DSM assume file is in classpath if you didn't specified rootPath.
I suggest you to pass InputStream to toObject method. You can create InputStream from File.

from dsm.

sivareddyuppathi avatar sivareddyuppathi commented on May 21, 2024
        File ymlFile = new File("C:\\Users\\SivireddyUppathi\\Downloads\\split_1580192862146\\dsmYML.yml");
        InputStream ymlStream = new FileInputStream(ymlFile);
        DSMBuilder builder = new DSMBuilder(ymlStream);
        DSM dsm = builder.setType(DSMBuilder.TYPE.XML).create();
        File xmlFile = new File("C:\\Users\\SivireddyUppathi\\Downloads\\split_1580192862146\\dsmXML.xml");
        InputStream xmlStream = new FileInputStream(xmlFile);
        Pet pet = (Pet) dsm.toObject(xmlStream);

this is also not working for me....

for me the exception raised at below line not at toObject method...

DSM dsm = builder.setType(DSMBuilder.TYPE.XML).create();

from dsm.

mfatihercik avatar mfatihercik commented on May 21, 2024

Only change toObject method to use input Stream.
Can you share exception trace

from dsm.

sivareddyuppathi avatar sivareddyuppathi commented on May 21, 2024

Exception in thread "main" java.lang.IllegalArgumentException: URI is not hierarchical
at java.io.File.(File.java:418)
at com.github.mfatihercik.dsb.resource.FileSystemResourceAccessor.addRootPath(FileSystemResourceAccessor.java:54)
at com.github.mfatihercik.dsb.resource.AbstractResourceAccessor.init(AbstractResourceAccessor.java:39)
at com.github.mfatihercik.dsb.resource.FileSystemResourceAccessor.init(FileSystemResourceAccessor.java:47)
at com.github.mfatihercik.dsb.resource.FileSystemResourceAccessor.(FileSystemResourceAccessor.java:27)
at com.github.mfatihercik.dsb.configloader.AbstractConfigLoader.setResourceAccessor(AbstractConfigLoader.java:89)
at com.github.mfatihercik.dsb.configloader.AbstractConfigLoader.(AbstractConfigLoader.java:32)
at com.github.mfatihercik.dsb.configloader.YamlConfigLoaderStrategy.(YamlConfigLoaderStrategy.java:11)
at com.github.mfatihercik.dsb.DSMBuilder.create(DSMBuilder.java:99)
at com.ads.ammdatatypes.vo.DSMStAX.main(DSMStAX.java:38)
C:\Users\SivireddyUppathi\AppData\Local\NetBeans\Cache\11.0\executor-snippets\run.xml:111: The following error occurred while executing this line:
C:\Users\SivireddyUppathi\AppData\Local\NetBeans\Cache\11.0\executor-snippets\run.xml:94: Java returned: 1

from dsm.

mfatihercik avatar mfatihercik commented on May 21, 2024

The problem is not related the code. which java version are you using?

from dsm.

mfatihercik avatar mfatihercik commented on May 21, 2024

#9 close this

from dsm.

sivareddyuppathi avatar sivareddyuppathi commented on May 21, 2024

Jdk 8

from dsm.

mfatihercik avatar mfatihercik commented on May 21, 2024

1.0.4 released. can you try new version.

from dsm.

Related Issues (19)

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.