← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #281182]: Null pointer exception using Sikuli in Java

 

Question #281182 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/281182

    Status: Answered => Solved

Borja Miñano confirmed that the question is solved:
I finally make it work!!!!

The problem came from having sikulixapi.jar inside the bundle classpath
as an internal library. For some reason, the File locator cannot get the
correct parent path in this situation.

So what finally worked was to osgify the sikulixapi.jar, make it
independent from the test bundle and load the dependencies through OSGI
system.

For your interest, this is the MANIFEST.MF that makes the jar OSGI compliant:
Manifest-Version: 1.0
Built-By: jenkins
Build-Jdk: 1.7.0_55
Created-By: Apache Maven 3.2.1
Archiver-Version: Plexus Archiver
Export-Package: org.sikuli.basics,org.sikuli.guide,org.sikuli.natives,org.sikuli.remoteinterfaces.common,org.sikuli.remoteinterfaces.entities,org.sikuli.script,org.sikuli.script.compare,org.sikuli.util
Bundle-Vendor: SpringSource
Ant-Version: Apache Ant 1.5.4 
Bundle-Version: 1.1.0
Bundle-Name: Sikulix
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.sikuli.script.Sikulix
Import-Package: javax.swing,javax.imageio

The Import-Package is not complete, as I imagine, there are other
dependent libraries to be configured there, but for my initial setup it
was enough.

RaiMan, if you are interested in provide the jar as OSGI compliant I can
help you. I am not an expert, but have some experience.

You can use the following Maven plugin to create the MANIFEST:
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<version>1.4.0</version>
				<extensions>true</extensions>
				<configuration>
					<instructions>
						<Bundle-Version>${pom.version}</Bundle-Version>
						<Bundle-Name>${pom.artifactId}</Bundle-Name>
						<Bundle-Vendor>${pom.organization.name}</Bundle-Vendor>
						<Bundle-Description>${pom.description}</Bundle-Description>
						<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
						<Export-Package>${pom.groupId}.${pom.artifactId}</Export-Package>
						<Import-Package>javax.swing, javax.imageio, ...</Import-Package>
					</instructions>
				</configuration>
			</plugin>

I hope it helps.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.