Api 1.7.1.0 Maven Dependency Problem

trialuser4andy
Posts: 2
Joined: Tue Aug 16, 2016 8:27 am

Api 1.7.1.0 Maven Dependency Problem

Postby trialuser4andy » Wed Aug 24, 2016 9:19 am

Dear Scientiamobile,
I am using the JAVA OnSite API 1.7.1.0 WURFL from your company via Maven.
For some Reason the Dependencies are not correct working in my Project.

I have two Moduls:
1. AA - Device Detector
2. BB - Module using the Device Detector

Pom xml from AA:

Code: Select all

    <repositories>
         <repository>
            <id>net.sourceforge.wurfl</id>
            <name>net.sourceforge.wurfl</name>
            <url>https://xxxxxxxxxx/scientiamobile</url>
         </repository>
    </repositories>
[…]
        <dependency>
          <groupId>net.sourceforge.wurfl</groupId>
          <artifactId>wurfl</artifactId>
          <version>1.7.1.0</version>
        </dependency>
(https://xxxxxxxxxx/scientiamobile is a local repository pointing to: http://maven.scientiamobile.com:8081/ne ... repository with correct username and password)

The Engine is initialised like this:

Code: Select all

private DetectorEngine() {
        logger.info("Initialising DetectorEngine...");
        WURFLResource res = new XMLResource(getClass().getClassLoader().getResourceAsStream("wurfl.xml"), "__notNull");
        this.engine = new GeneralWURFLEngine(res);
        this.engine.setEngineTarget(EngineTarget.accuracy);
        this.engine.setCapabilityFilter(CAPABILITIES);
        logger.info("DetectorEngine initialised.");
    }
With this dependencies and code i obtain the Information and jar file, can compile and also Junit Tests are working fine.


BUT:
If i use the module AA in BB i get this Exception:

Code: Select all

java.lang.ClassNotFoundException: org.apache.commons.collections.iterators.ReverseListIterator
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
        at net.sourceforge.wurfl.core.resource.DefaultWURFLModel.getDeviceAncestor(DefaultWURFLModel.java:348)
        at net.sourceforge.wurfl.core.resource.DefaultWURFLModel.applyPatches(DefaultWURFLModel.java:184)
        at net.sourceforge.wurfl.core.resource.DefaultWURFLModel.init(DefaultWURFLModel.java:130)
        at net.sourceforge.wurfl.core.resource.DefaultWURFLModel.<init>(DefaultWURFLModel.java:107)
        at net.sourceforge.wurfl.core.GeneralWURFLEngine.init(GeneralWURFLEngine.java:340)
        at net.sourceforge.wurfl.core.GeneralWURFLEngine.initIfNeeded(GeneralWURFLEngine.java:319)
        at net.sourceforge.wurfl.core.GeneralWURFLEngine.getDeviceForRequest(GeneralWURFLEngine.java:459)


In the pom.xml of Module BB i need following:

Code: Select all

        <!-- Device Detector -->
        <dependency>
            <groupId>AA</groupId>
            <artifactId>AA</artifactId>
            <version>1.0.0-SNAPSHOT</version>
        </dependency>
  
                 <dependency>
		<groupId>commons-collections</groupId>
		<artifactId>commons-collections</artifactId>
		<version>3.2.1</version>
	</dependency>
	<dependency>
		<groupId>commons-lang</groupId>
		<artifactId>commons-lang</artifactId>
		<version>2.6</version>
	</dependency>
Only adding the dependenciy of Modul AA is not enough.
I would like to know if i implemented WURFL correctly or a change on my code/dependency handling is needed.

(In the .m2 local folder it downloads the wurfl jar and my own device-detector jar. But it does not work withouth commons-collections and commons-lang)

With greetings

david
Posts: 20
Joined: Thu Jun 30, 2016 9:54 am

Re: Api 1.7.1.0 Maven Dependency Problem

Postby david » Thu Aug 25, 2016 2:16 pm

Hello,

I tried installing and running the Java API using Maven and was unable to reproduce your issue. This leads me to believe you may have a maven configuration issue which the causes can be various.

The first thing you should check is the local repo you are using to forward to maven.scientiamobile.com. Try pointing to maven.scientiamobile.com directly just to test if it changes anything. Also check if the war contains all the dependency jars or not. This will help us to understand if the problem is in war creation.

Let us know you findings.

Thanks,
David
Scientiamobile Support
support@scientiamobile.com

trickydee
Posts: 33
Joined: Fri Jul 17, 2015 8:58 am

Re: Api 1.7.1.0 Maven Dependency Problem

Postby trickydee » Fri Aug 26, 2016 5:57 pm

The groupId has been changed to com.scientiamobile.wurfl.
[edit] actually that might be only 1.8, ignore my remark.

trialuser4andy
Posts: 2
Joined: Tue Aug 16, 2016 8:27 am

Re: Api 1.7.1.0 Maven Dependency Problem

Postby trialuser4andy » Tue Aug 30, 2016 8:11 am

david wrote:Hello,

I tried installing and running the Java API using Maven and was unable to reproduce your issue. This leads me to believe you may have a maven configuration issue which the causes can be various.

The first thing you should check is the local repo you are using to forward to maven.scientiamobile.com. Try pointing to maven.scientiamobile.com directly just to test if it changes anything. Also check if the war contains all the dependency jars or not. This will help us to understand if the problem is in war creation.

Let us know you findings.

Thanks,
David
Scientiamobile Support
support@scientiamobile.com
Pointing directly to the repository did not change anything (actually was first setup after we added it to our repository).

The needed jars exist (commons-collections and commons-lang) inside the war file.
The deployed project (on tomcat 6) also owns the jars in WEB-INF/lib/

But starting the analysis of a user-agent still throws the Exception:

Code: Select all

java.lang.NoClassDefFoundError: org/apache/commons/collections/iterators/ReverseListIterator
        at net.sourceforge.wurfl.core.resource.DefaultWURFLModel.getDeviceAncestor(DefaultWURFLModel.java:348)
        at net.sourceforge.wurfl.core.resource.DefaultWURFLModel.applyPatches(DefaultWURFLModel.java:184)
        at net.sourceforge.wurfl.core.resource.DefaultWURFLModel.init(DefaultWURFLModel.java:130)
        at net.sourceforge.wurfl.core.resource.DefaultWURFLModel.<init>(DefaultWURFLModel.java:107)
        at net.sourceforge.wurfl.core.GeneralWURFLEngine.init(GeneralWURFLEngine.java:340)
        at net.sourceforge.wurfl.core.GeneralWURFLEngine.initIfNeeded(GeneralWURFLEngine.java:319)
        at net.sourceforge.wurfl.core.GeneralWURFLEngine.getDeviceForRequest(GeneralWURFLEngine.java:459)
thanks for the help in any case if we find a solution or not.


Who is online

Users browsing this forum: No registered users and 9 guests