Exception on service activation in mock OSGi context - unit-testing

In my Maven project, I've created a simple OSGi service that does nothing but accepts one reference:
import org.apache.sling.api.resource.ResourceResolverFactory;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
#Component
public class MyFoo {
#Reference
private ResourceResolverFactory factory;
}
Then, using osgi-mock tutorial, I've created the following test class:
import org.apache.sling.api.resource.ResourceResolverFactory;
import org.apache.sling.testing.mock.osgi.junit.OsgiContext;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.modules.junit4.PowerMockRunner;
#RunWith(PowerMockRunner.class)
public class MyFooTest {
#Rule
public OsgiContext mockContext = new OsgiContext();
#Test
public void test() {
ResourceResolverFactory mockFactory = Mockito.mock(ResourceResolverFactory.class);
mockContext.registerService(ResourceResolverFactory.class, mockFactory);
mockContext.registerInjectActivateService(new MyFoo());
}
}
The test crashes on the last line with the following exception:
org.apache.sling.testing.mock.osgi.NoScrMetadataException: No OSGi SCR metadata found for class MyFoo
at org.apache.sling.testing.mock.osgi.OsgiServiceUtil.injectServices(OsgiServiceUtil.java:381)
at org.apache.sling.testing.mock.osgi.MockOsgi.injectServices(MockOsgi.java:148)
at org.apache.sling.testing.mock.osgi.context.OsgiContextImpl.registerInjectActivateService(OsgiContextImpl.java:153)
at org.apache.sling.testing.mock.osgi.context.OsgiContextImpl.registerInjectActivateService(OsgiContextImpl.java:141)
at MyFooTest.testGetResolver(MyFooTest.java:22)
//snippet
Following the advice on the internet, I've reached this configuration guide and ensured that my pom.xml has exactly this configuration for maven-bundle-plugin - this however did not resolve the issue.
Any idea where am I making a mistake?

I tried replicating your issue, ran into the same exception initially and got it working now. Issue is probably due to spoiled classpath because of transitive dependencies between maven-scr-plugin and maven-bundle-plugin.
Ensure you have the following in place:
Use osgi-mock 2.x mock dependency which is OSGI R6 compatible. This is what I used.
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.osgi-mock</artifactId>
<version>2.3.6</version>
<scope>test</scope>
</dependency>
Remove scr maven plugins and dependencies (maven-scr-plugin and org.apache.felix.scr) as this leads to classpath conflicts when used in conjunction with OSGi R6 annotations. This is the version of maven-bundle-plugin I've used. I picked up all the required dependencies from here.
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.2.0</version>
</plugin>
Ensure your plugin build section contains the required configurations to generate the required DS metadata. You can refer to the felix docs that you've linked for more info on this.
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>scr-metadata</id>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<exportScr>true</exportScr>
<instructions>
<Bundle-SymbolicName>com.aem.chula.chula</Bundle-SymbolicName>
<Sling-Model-Packages>
com.aem.models
</Sling-Model-Packages>
<_dsannotations>*</_dsannotations>
<_metatypeannotations>*</_metatypeannotations>
</instructions>
</configuration>
</plugin>
Do a mvn clean install which will generate the DS output in /OSG-INF.
Run your tests. I've used MockitoJunitRunner, should work fine with PowerMock as well.

In my case I had to add the ds-annotations dependency
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.ds-annotations</artifactId>
<version>1.2.10</version>
<scope>provided</scope>
</dependency>
As described in http://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin/apache-felix-maven-scr-plugin-use.html

Related

Trying to use arrow-dataset java library but got missing arrow_dataset_jni.dll error

I followed the maven instructions to include the arrow-dataset in pom.xml
However, when running the code, it complained arrow-dataset-jni.dll not found
How to create or install dll ?
Thank you
J
Base on the master branch DLL is already supported and implemented. This will be available on the next release.
If you like to work with DLL support at this moment, you have 02 options:
Build the master Java branch project locally (java/dataset module)
Use current nightly packages repository
Then, steps could be:
1.- Download new jar Dataset / C Data locally from nightly packages mention
2.- Install new jar Dataset / C Data locally:
# intall dataset manually
mvn install:install-file -Dfile="C:\Users\dsusanibar\IdeaProjects\win-cookbooks\src\main\resources\files\arrow-dataset-10.0.0-SNAPSHOT.pom" -DgroupId="org.apache.arrow" -DartifactId="arrow-dataset" -Dversion="10.0.0-SNAPSHOT" -Dpackaging="pom"
mvn install:install-file -Dfile="C:\Users\dsusanibar\IdeaProjects\win-cookbooks\src\main\resources\files\arrow-dataset-10.0.0-SNAPSHOT.jar" -DgroupId="org.apache.arrow" -DartifactId="arrow-dataset" -Dversion="10.0.0-SNAPSHOT" -Dpackaging="jar"
# install c data interface manually
mvn install:install-file -Dfile="C:\Users\dsusanibar\IdeaProjects\win-cookbooks\src\main\resources\files\arrow-c-data-10.0.0-SNAPSHOT.pom" -DgroupId="org.apache.arrow" -DartifactId="arrow-c-data" -Dversion="10.0.0-SNAPSHOT" -Dpackaging="pom"
mvn install:install-file -Dfile="C:\Users\dsusanibar\IdeaProjects\win-cookbooks\src\main\resources\files\arrow-c-data-10.0.0-SNAPSHOT.jar" -DgroupId="org.apache.arrow" -DartifactId="arrow-c-data" -Dversion="10.0.0-SNAPSHOT" -Dpackaging="jar"
3.- Add new Dataset / C Data Interface dependencies into your project (Maven/Gradle)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>win-cookbooks</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<arrow.version>9.0.0</arrow.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-dataset</artifactId>
<version>10.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-netty</artifactId>
<version>${arrow.version}</version>
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-c-data</artifactId>
<version>10.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-memory-core</artifactId>
<version>${arrow.version}</version>
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-format</artifactId>
<version>${arrow.version}</version>
</dependency>
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-vector</artifactId>
<version>${arrow.version}</version>
</dependency>
</dependencies>
</project>
4.- Create Dataset with mew Dataset jar that contains DLL arrow_dataset_jni.dll + Read RecordBatches with new C Data Interface that contains DLL arrow_cdata_jni.dll:
import org.apache.arrow.dataset.file.FileFormat;
import org.apache.arrow.dataset.file.FileSystemDatasetFactory;
import org.apache.arrow.dataset.jni.NativeMemoryPool;
import org.apache.arrow.dataset.scanner.ScanOptions;
import org.apache.arrow.dataset.scanner.Scanner;
import org.apache.arrow.dataset.source.Dataset;
import org.apache.arrow.dataset.source.DatasetFactory;
import org.apache.arrow.memory.BufferAllocator;
import org.apache.arrow.memory.RootAllocator;
import org.apache.arrow.vector.VectorSchemaRoot;
import org.apache.arrow.vector.ipc.ArrowReader;
import java.io.IOException;
import java.net.URISyntaxException;
public class Recipe {
public static void main(String[] args) throws URISyntaxException {
// File at: https://github.com/apache/arrow-cookbook/blob/main/java/thirdpartydeps/parquetfiles/data1.parquet
String uri = "file:///C:\\Users\\dsusanibar\\IdeaProjects\\win-cookbooks\\src\\main\\resources\\files\\data1.parquet";
ScanOptions options = new ScanOptions(/*batchSize*/ 5);
try (
BufferAllocator allocator = new RootAllocator();
DatasetFactory datasetFactory = new FileSystemDatasetFactory(allocator, NativeMemoryPool.getDefault(), FileFormat.PARQUET, uri);
Dataset dataset = datasetFactory.finish();
Scanner scanner = dataset.newScan(options)
) {
scanner.scan().forEach(scanTask -> {
try (ArrowReader reader = scanTask.execute()) {
while (reader.loadNextBatch()) {
final int[] count = {1};
try (VectorSchemaRoot root = reader.getVectorSchemaRoot()) {
System.out.println("Number of rows per batch["+ count[0]++ +"]: " + root.getRowCount());
System.out.println(root.contentToTSVString());
}
}
} catch (IOException e) {
e.printStackTrace();
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
}
Result:
Number of rows per batch[1]: 3
id name
1 David
2 Gladis
3 Juan
Please let us know if this work on your side.

why ElastiMq keeps requiring server and check parameters since I am passing it

I am using AWS SQS for the first time. I work in certain company which blocks us via firewall to connect from our local network to SQS for some reasons beyond my control. I can upload anything I have developed to our TomCat in AWS or even run via our Linux command line with our ec2-user (upload via WinSCP and trigger via Putty).
Since I need to provide certain solution using sqs but I can't debug accessing it from my Eclipse I am interested to mock sqs. Additionally, I see advantages on such approach from test perspective. That said, after few hours searching I found exactly what I need: http://www.schibsted.pl/blog/mocking-amazon-sqs-with-elasticmq/
I downloaded the example (https://github.com/JanGurda/elastc-mq-rule-sample) but I can't start it. I understand that there is an elasticmq embbeded which should be started together with such jar. I tried other way by downloading the elasticmq and started it before running the sample but I am still getting the same output.
Basically, I am getting this output
usage: java -jar project.jar [-h] [-v] {server,check} ...
positional arguments:
{server,check} available commands
optional arguments:
-h, --help show this help message and exit
-v, --version show the application version and exit
It seems I am doing something very silly but I didn't find a north.
PS. I checked and the pom has lombok and elasticmq properly settup.
pom
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pl.schibsted.spid</groupId>
<artifactId>elastc-mq-rule-sample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>0.8.0</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-sqs</artifactId>
<version>1.10.1</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-testing</artifactId>
<version>0.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.elasticmq</groupId>
<artifactId>elasticmq-rest-sqs_2.11</artifactId>
<version>0.8.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>pl.schibsted.spid.elasticmq.server.ElasticMqRuleSampleApplication</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<includes>
<include>**/ITest*.java</include>
</includes>
</configuration>
<executions>
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
DropwizardAppRule:
public class ITestPingResource {
#ClassRule
public static DropwizardAppRule<ElasticMqRuleSampleApplicationConfiguration> app =
new DropwizardAppRule<>(ElasticMqRuleSampleApplication.class,
ITestPingResource.class.getClassLoader().getResource("test.yml").getPath());
#ClassRule
public static SqsRule sqs = new SqsRule(SqsRuleConfiguration.builder()
.queue("sample-queue").port(8888).build());
private Client client = ClientBuilder.newClient();
#After
public void tearDown() {
sqs.purgeAllQueues();
}
#Test
public void shouldPublishProcessedRequestPayload() throws Exception {
// given
String toSend = "abcdefgh";
// when
Response response = client
.target("http://127.0.0.1:" + app.getLocalPort() + "/ping")
.request().post(Entity.json(toSend));
// then
assertEquals(Status.NO_CONTENT.getStatusCode(), response.getStatus());
List<Message> messagesFromQueue = sqs.getQueue("sample-queue").read(10);
assertEquals(1, messagesFromQueue.size());
assertEquals("ABCDEFGH", messagesFromQueue.get(0).getBody());
}
}
test.yml
queueUrl: http://localhost:8888/queue/sample-queue
awsAccessKey: x
awsSecretKey: x
main:
public class ElasticMqRuleSampleApplication extends Application<ElasticMqRuleSampleApplicationConfiguration> {
public static void main(String[] args) throws Exception {
new ElasticMqRuleSampleApplication().run(args);
}
#Override
public void run(ElasticMqRuleSampleApplicationConfiguration configuration, Environment environment) throws Exception {
PingResource resource = new PingResource(configuration);
environment.jersey().register(resource);
}
}
Demetrio,
The error you get is simply standard output of Dropwizard. You should use “server” parameter to start Dropwizard application. So command you use to start Dropwizard is java -jar <> server.
If you however would like to run sample integration test (which I discussed in my article) just use Maven. Type mvn clean install. It’ll build project and run integration test.
Thanks

How to test static java methods in groovy SPOCK framework?

I am trying to test static java method in SPOCK groovy framework using Maven.
Here is the java class
public class DataController {
private DataInterface userService;
public void setUserService(DataInterface userService) {
this.userService = userService;
}
public static int addNumber(){
int a = 10;
int b = 20;
return a+b;
}
}
Here is the SPOCK test in groovy
#PrepareForTest([DataController.class])
class BasicMockStaticTest extends Specification {
#Rule PowerMockRule powerMockRule = new PowerMockRule();
def "When mocking static"() {
setup :
PowerMockito.mockStatic(DataController.class)
when :
Mockito.when(DataController.addNumber()).thenReturn(30);
then :
DataController.addNumber() == 30
}
}
and the POM File snippet
<dependencies>
<!-- Spock Framework basic dependencies: -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<!-- The version have to be compatible with Groovy -->
<version>1.0-groovy-2.3</version>
<scope>test</scope>
</dependency>
<!-- To use Hamcrest matchers: -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<!-- To mock classes: -->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>3.1</version>
<scope>test</scope>
</dependency>
<!-- Use with cglib to mock classes without default constructor: -->
<dependency>
<groupId>org.objenesis</groupId>
<artifactId>objenesis</artifactId>
<version>2.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.5</version>
</dependency>
<!-- Power mock dependencies -->
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>1.5.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4-rule</artifactId>
<version>1.5.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-classloading-xstream</artifactId>
<version>1.5.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<testSourceDirectory>E:\Workspace\Mars\rg\Spock\src\test\groovy</testSourceDirectory>
<pluginManagement>
<plugins>
<!-- GMavenPlus plugin -->
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>addSources</goal>
<goal>addTestSources</goal>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>testGenerateStubs</goal>
<goal>testCompile</goal>
<goal>removeStubs</goal>
<goal>removeTestStubs</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Only required if names of spec classes don't match default Surefire patterns (`*Test` etc.) -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<useFile>false</useFile>
<includes>
<include>**/*Test*.*</include>
<include>**/*Spec*.*</include>
</includes>
I have 4 test cases in the groovy folder , 3 are passing , but this static method test is giving error as
When mocking static(BasicMockStaticTest) Time elapsed: 0.104 sec <<< ERROR!
java.lang.IllegalStateException: Extension API internal error: org.powermock.api.extension.proxyframework.ProxyFrameworkImpl could not be located in classpath.
at org.powermock.modules.junit4.rule.PowerMockClassloaderExecutor.registerProxyframework(PowerMockClassloaderExecutor.java:60)
at org.powermock.modules.junit4.rule.PowerMockClassloaderExecutor.forClass(PowerMoc kClassloaderExecutor.java:50)
at org.powermock.modules.junit4.rule.PowerMockRule.apply(PowerMockRule.java:31)
at org.spockframework.runtime.extension.builtin.MethodRuleInterceptor.intercept(MethodRuleInterceptor.java:37)
at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:87)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:120)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:103)
at org.apache.maven.surefire.Surefire.run(Surefire.java:169)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)
I am running mvn test to test these junits , I tried changing the version of cglib-nodep from 3.1 to 2.2.2 but it did not work.
I checked in the java build path following jar files are included
powermock-module-junit4-1.5.4
powermock-module-junit4-common-1.5.4
powermock-reflect-1.5.4
powermock-module-junit4-rule-1.5.4
powermock-classloading-base-1.5.4
powermock-classloading-xstream-1.5.4
powermock-api-support-1.5.4
powermock-core-1.5.4
groovy-all-2.3.1.jar
spock-core-1.0-grovy-2.3.jar
I also added powermock-mockito-release-full-1.5.4 but after adding that none of the test cases ran and build was success but that was not my intent.
I am suspecting may be some of the dependencies are missing or some of the existing are conflicting but not able to move forward.
Can any one tell what is wrong , I can move forward with the test case even if it fails , I will correct it but I need to remove the error first .
On a side note I did try groovyMock also but it gave nullpointer exception for static method , then I searched and found static method did not work with groovyMock.
I have tried top google link results with popular blogs and tutorial but none seems to work.
I'm using GroovyMock in Spock to test static methods (static methods in Java, BTW):
GroovyMock(Foo, global: true)
Foo.bar(_) >> "my-fake-result"
I also added this annotation to my test method in Spock,
to my mock not interfere in other tests:
#ConfineMetaClassChanges([Foo])

Deploy production and UAT web services at once

I have a web service that runs on Wildfly on http://localhost:8080/ws which I deploy from maven using wildfly-maven-plugin.
I would like to deploy the same web service, but pointing to a test datasource, to http://localhost:8080/ws_test so I can use it as a UAT enviroment and run tests without affecting the production database.
Is there an easy way to do that?
More information:
The root (ws) is configured in jboss-web.xml:
<jboss-web>
<context-root>/ws</context-root>
</jboss-web>
I have this class:
#ApplicationPath("/")
public class MyApplication extends Application { }
my production datasource is "hardcoded":
#Resource(lookup = "java:jboss/jdbc/prod")
private javax.sql.DataSource ds;
the maven pom (extract):
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.0.2.Final</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<hostname>localhost</hostname>
<username>user</username>
<password>pass</password>
</configuration>
</execution>
</executions>
</plugin>
What I ended up doing is this:
add a second datasource corresponding to the test DB:
#Resource(lookup = "java:jboss/jdbc/test")
private javax.sql.DataSource dsTest;
let my controller know it could be called from two URIs:
#Path("{a:(test/)?}some_page")
public class MyController { ... }
direct the calls to the right DB:
private #Context UriInfo uriInfo;
DataSource getDatasource() {
LOG.info("in mode: {}", uriInfo.getPath());
return uriInfo.getPath().startsWith("/test") ? dsTest : ds;
}

jmeter-maven-plugin blocked at getting service port from "javax.xml.ws.Service" when executing JMX file

I'm using jmeter-maven-plugin to run Performance test using JMX files:
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.9.0</version>
<dependencies>
<dependency>
<groupId>com.gemalto.pse.pim</groupId>
<artifactId>pim-ws-client</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
<configuration>
<testFilesIncluded>
<jMeterTestFile>file_1.jmx</jMeterTestFile>
<jMeterTestFile>file_2.jmx</jMeterTestFile>
</testFilesIncluded>
</configuration>
</execution>
</executions>
</plugin>
The JMX file file_1.jmx execute a method in a class that call a web-service as follows:
final String ENDPOINT_ADDRESS = "http://10.256.45.147:8080/service-ejb/ServiceClass?wsdl";
final QName SERVICE_NAME = new QName(
"http://service.tools.com/", "ServiceClassService");
javax.xml.ws.Service service = javax.xml.ws.Service.create(
new URL(ENDPOINT_ADDRESS), SERVICE_NAME);
IServiceClass myService = dataFinderService.getPort(IServiceClass.class);
The problem is that Jmeter plugin is blocked at execution of file_1.jmx and does not process the file_2.jmx, the process is blocked at:
IServiceClass myService = dataFinderService.getPort(IServiceClass.class);
And when i cancel the execution (type Ctrl+C) the process continues and Jmeter-maven-plugin generate the output report file
Any one have encounter this problem ? ... Thanks a lot in advance :)
The problem is resolved, all what i implimented is right, the problem is just that i should use jmeter-maven-plugin version 1.8.0 instead of 1.9.0 :)