postaddictme / instagram-java-scraper

Instagram Java Scraper. Get account information, photos, videos and comments.
449 stars 150 forks source link

I am trying to use your code but I get an error(or 12 to be exact). I would appreciate if you could help me. Thanks. #124

Open porfanid opened 6 years ago

porfanid commented 6 years ago
Exception in thread "main" java.lang.IllegalArgumentException: javax.xml.bind.JAXBException
 - with linked exception:
[Exception [EclipseLink-50055] (Eclipse Persistence Services - 2.7.3.v20180807-4be1041): org.eclipse.persistence.exceptions.JAXBException
Exception Description: Error creating DynamicJAXBContext: eclipselink.oxm.metadata-source (JAXBContextProperties.OXM_METADATA_SOURCE) not found in properties map, or map was null.]
    at me.postaddict.instagram.scraper.mapper.ModelMapper.mapObject(ModelMapper.java:191)
    at me.postaddict.instagram.scraper.mapper.ModelMapper.mapAccount(ModelMapper.java:147)
    at me.postaddict.instagram.scraper.Instagram.getAccountByUsername(Instagram.java:93)
    at me.postaddict.instagram.scraper.Instagram.getMedias(Instagram.java:98)
    at Main.main(Main.java:61)
Caused by: javax.xml.bind.JAXBException
 - with linked exception:
[Exception [EclipseLink-50055] (Eclipse Persistence Services - 2.7.3.v20180807-4be1041): org.eclipse.persistence.exceptions.JAXBException
Exception Description: Error creating DynamicJAXBContext: eclipselink.oxm.metadata-source (JAXBContextProperties.OXM_METADATA_SOURCE) not found in properties map, or map was null.]
    at org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory.createContextFromOXM(DynamicJAXBContextFactory.java:391)
    at me.postaddict.instagram.scraper.mapper.ModelMapper.getUnmarshaller(ModelMapper.java:208)
    at me.postaddict.instagram.scraper.mapper.ModelMapper.lambda$null$1(ModelMapper.java:197)
    at java.lang.ThreadLocal$SuppliedThreadLocal.initialValue(Unknown Source)
    at java.lang.ThreadLocal.setInitialValue(Unknown Source)
    at java.lang.ThreadLocal.get(Unknown Source)
    at me.postaddict.instagram.scraper.mapper.ModelMapper.mapObject(ModelMapper.java:188)
    ... 4 more
Caused by: Exception [EclipseLink-50055] (Eclipse Persistence Services - 2.7.3.v20180807-4be1041): org.eclipse.persistence.exceptions.JAXBException
Exception Description: Error creating DynamicJAXBContext: eclipselink.oxm.metadata-source (JAXBContextProperties.OXM_METADATA_SOURCE) not found in properties map, or map was null.
    at org.eclipse.persistence.exceptions.JAXBException.oxmKeyNotFound(JAXBException.java:778)
    ... 11 more

The code as I am using it:

OkHttpClient httpClient = new OkHttpClient();

        Instagram instagram = new Instagram(httpClient);
        PageObject<Media> medias;
        try {
            medias = instagram.getMedias("durov", 1);
            System.out.println(medias.getNodes().get(0).getDisplayUrl());
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
porfanid commented 6 years ago

BTW, I am using instagramscraper-2.2.jar

adnan175 commented 5 years ago

Hi I am getting same error. did you manage to solve it?