Closed ops4j-issues closed 13 years ago
CharlesM commented
I also tried this approach :
1) Copied every jar from the system folder of Fuse 4
systemPackages("javax.xml.stream;version=1.0.0", "com.sun.org.apache.xerces.internal.dom",
"javax.xml.stream.util;version=1.0.0", "com.sun.org.apache.xerces.internal.xni",
"javax.xml.stream.events;version=1.0.0"),
logProfile(),
systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("TRACE"),
repositories("http://repository.ops4j.org/maven2", "http://nexus.in.canoe.com/content/groups/public`@snapshots`"),
felix(), profile("felix.prefs"), profile("felix.webconsole"),
configProfile(), profile("spring"), profile("spring.dm"), webProfile(),
profile("url"),
provision(scanDir("C:/Documents and Settings/charles-andre.martin/Bureau/fuse bundles")));
...
systemProperty("bnews.memcached.cachedTime").value("3600"),
systemProperty("org.ops4j.pax.web.session.timeout").value("3600"),
systemPackages("javax.xml.ws.http;version=2.1.0"),
provision(scanFeatures("http://...catamaran.features-1.0.0-features.xml", "bnews/1.0.0.BUILD-SNAPSHOT")));
It still freeze...
Bartosz Kowalewski commented
Hi,
I used the CXF in Pax Exam, but not through profiles. I used some SMX4 features + additional maven bundles.
I also observed various issues when using CXF inside Felix launched by Pax Exam. Please try using Equinox and add configuration that mimics the settings which are normally used in Fuse ESB 4:
equinox(),
// EXTREMELY IMPORTANT !!!
rawPaxRunnerOption("--ee", "J2SE-1.5"),
bootDelegationPackages("sun.*", "com.sun.*",
"javax.transaction", "javax.transaction.*"),
systemPackages("com.sun.org.apache.xalan.internal.xsltc.trax",
"com.sun.org.apache.xerces.internal.dom",
"com.sun.org.apache.xerces.internal.jaxp",
"com.sun.org.apache.xerces.internal.xni")
For details see etc/config.properties in your installation of Fuse ESB 4.
Hope this helps.
Bartek
Kyle Miller commented
Thank you for your comment Bartosz. I was seeing behavior similar to what Charles-André Martin reported, and your suggestion resolved my issue.
Toni Menzel commented
reopen to set fix version to RC1
CharlesM created PAXEXAM-156
Hi all,
I would like to use Pax Exam for integration tests. Currently,
I have one bundle which has REST services. I use JAX-RS (CXF) for the
REST services. My plans are to setup Pax Exam with JUnit and to use
HTTP client to tests the REST services. The bundles work nice with
fuse 4.1. When I test it, Pax Exam freeze at startup :
...
main INFO org.ops4j.pax.runner.platform.internal.ExecutionEnvironment
main INFO org.ops4j.pax.runner.platform.DefaultJavaRunner - Runner
has successfully finished his job!
main INFO org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer
main INFO org.ops4j.pax.exam.container.def.internal.PaxRunnerTestContainer
out
Welcome to Felix.
=================
org.ops4j.pax.swissbox.extender.BundleWatcher : Creating bundle
watcher with scanner
org.ops4j.pax.swissbox.extender.BundleManifestScanner at 17e6a96...
org.ops4j.pax.swissbox.extender.BundleWatcher : Scanning bundle
osgi.compendium
org.ops4j.pax.swissbox.extender.BundleWatcher : Scanning bundle
org.ops4j.pax.exam
org.ops4j.pax.swissbox.extender.BundleWatcher : Scanning bundle
org.ops4j.pax.exam.junit.extender
org.ops4j.pax.swissbox.extender.BundleWatcher : Scanning bundle
org.ops4j.pax.exam.junit.extender.impl
org.ops4j.pax.url.commons.handler.HandlerActivator : Handler for
protocols dir started
org.ops4j.pax.swissbox.extender.BundleWatcher : Scanning bundle
org.ops4j.pax.url.dir
org.ops4j.pax.swissbox.extender.BundleWatcher : Scanning bundle
com.springsource.org.junit
org.ops4j.pax.exam.rbc.internal.Activator : Starting up RMI registry
on port 1099
org.ops4j.pax.exam.rbc.internal.Activator : Binding
RemoteBundleContext to RMI registry
org.ops4j.pax.exam.rbc.internal.Activator : RMI registry started on
port 1099
org.ops4j.pax.swissbox.extender.BundleWatcher : Scanning bundle
org.ops4j.pax.exam.rbc
org.ops4j.pax.swissbox.extender.BundleWatcher : Scanning bundle
org.apache.geronimo.specs.geronimo-annotation_1.0_spec
org.ops4j.pax.swissbox.extender.BundleWatcher : Scanning bundle
org.apache.geronimo.specs.geronimo-activation_1.1_spec
org.ops4j.pax.swissbox.extender.BundleWatcher : Scanning bundle
org.apache.geronimo.specs.geronimo-javamail_1.4_spec
org.ops4j.pax.swissbox.extender.BundleWatcher : Scanning bundle
org.apache.geronimo.specs.geronimo-ws-metadata_2.0_spec
org.ops4j.pax.swissbox.extender.BundleWatcher : Scanning bundle
com.springsource.org.jdom
org.mortbay.jetty : Logging to
org.ops4j.pax.web.service.internal.util.JCLLogger at 1c92535 via
org.ops4j.pax.web.service.internal.util.JCLLogger
org.ops4j.pax.web.service.internal.Activator : Starting pax http service
org.ops4j.pax.web.service.internal.ServerControllerImpl :
configuring server: ServerControllerImpl
{state=UNCONFIGURED}
->
ConfigurationImpl
{http enabled=true,http port=8080,http secure enabled=false,http secure port=8443,ssl keystore=C:\Documents and Settings\charles-andre.martin.keystore,ssl keystoreType=null,session timeout=3600,listening addresses=[Ljava.lang.String;
@c931fc
}org.ops4j.pax.web.service.internal.ServerControllerImpl : starting
server: ServerControllerImpl
{state=STOPPED}
org.ops4j.pax.web.service.internal.JettyServerImpl : adding
connectorNIOSocketConnectorWrapper at 0.0.0.0:8080
org.mortbay.jetty : Container JettyServerWrapper at 5e179a +
NIOSocketConnectorWrapper at 0.0.0.0:8080 as connector
org.ops4j.pax.web.service.internal.JettyServerImpl : starting
JettyServerImpl{}
org.mortbay.jetty : jetty-6.1.x
org.mortbay.jetty : Container JettyServerWrapper at 5e179a +
org.mortbay.thread.QueuedThreadPool at 1ebd75b as threadpool
org.mortbay.jetty : started org.mortbay.thread.QueuedThreadPool at 1ebd75b
org.mortbay.jetty : starting JettyServerWrapper at 5e179a
org.mortbay.jetty : started
org.mortbay.jetty.nio.SelectChannelConnector$1 at b01d43
org.mortbay.jetty : Started NIOSocketConnectorWrapper at 0.0.0.0:8080
org.mortbay.jetty : started NIOSocketConnectorWrapper at 0.0.0.0:8080
org.mortbay.jetty : started JettyServerWrapper at 5e179a
org.ops4j.pax.web.service.internal.Activator : Started pax http service
org.ops4j.pax.swissbox.extender.BundleWatcher : Scanning bundle
org.ops4j.pax.web.pax-web-service
main INFO org.ops4j.pax.exam.rbc.client.RemoteBundleContextClient -
Remote bundle context found after 5219 millis
Then it hangs here indefinitly, no tests are run. The java process
using about 80% of the CPU.
Here is a sample of the code :
private BundleContext bundleContext;
@Configuration
(extend=BNewsOption.class)public static Option[] configuration()
{ return options( systemPackages("javax.xml.stream;version=1.0.0", "com.sun.org.apache.xerces.internal.dom", "javax.xml.stream.util;version=1.0.0", "com.sun.org.apache.xerces.internal.xni", "javax.xml.stream.events;version=1.0.0"), logProfile(), systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"), repositories("http://repository.ops4j.org/maven2", "..."), felix(), profile("spring"), profile("spring.dm"), webProfile(), profile("cxf.dosgi")); }
@Test
public void testCanAddNews() {
String content = "content";
HttpClient client = new HttpClient();
String url = "http://localhost:8080/cxf/bnews/portalRESTTestInt/siteRESTTestInt/topicRESTTestInt/section";
EntityEnclosingMethod method = new PutMethod(url);
InputStream inputSteam = new
ByteArrayInputStream(content.toString().getBytes());
method.setRequestEntity(new InputStreamRequestEntity(inputSteam,
content.length()));
try
{ int statusCode = client.executeMethod(method); assertEquals(201, statusCode); }
catch (HTTPException e)
{ e.printStackTrace(); fail(e.getMessage()); } catch (IOException e) { e.printStackTrace(); fail(e.getMessage()); }
finally
{ method.releaseConnection(); }
}
public class BNewsOption implements CompositeOption {
public Option[] getOptions()
{ return options( systemProperty("org.ops4j.pax.web.session.timeout").value("3600"), systemPackages("javax.xml.ws.http;version=2.1.0"), provision( mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.commons-httpclient").version("3.1_1-fuse"), mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.commons-codec").version("1.3_1-fuse"), mavenBundle().groupId("commons-lang").artifactId("commons-lang").version("2.4"), mavenBundle().groupId("com.sun.syndication").artifactId("....com.sun.syndication").version("1.0.0.BUILD-SNAPSHOT"), bundle("file:/C:/progress/fuse-esb-4.1.0.2/system/org/apache/mina/mina-core/2.0.0-M6/mina-core-2.0.0-M6.jar"), mavenBundle().groupId("....rest").artifactId("....rest.bnews"), mavenBundle().groupId("....business").artifactId("....business.bnews"), mavenBundle().groupId("....integration").artifactId("....integration.memcached"), mavenBundle().groupId("....integration").artifactId("....integration.sws"))); }
}
Here is my project POM file :
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>....test</groupId>
<artifactId>....test.integration</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
<distributionManagement>
<snapshotRepository>
<id>snapshots</id>
<name>Snapshots</name>
<url>.../snapshots</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>....rest</groupId>
<artifactId>....rest.bnews</artifactId>
<version>1.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam</artifactId>
<version>1.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-default</artifactId>
<version>1.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit</artifactId>
<version>1.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit-extender</artifactId>
<version>1.2.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<resources>
<!-- standard Maven folder -->
<resource>
<directory>src/main/java</directory>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
I'm using Windows XP with Java 6. Whatever I run the JUnit test by
Eclipse or by maven test, it freeze.
Anyone has an idea why Pax Runner hangs ? It only hangs when I include
the CXF profile. Without the CXF profile, the tests are run.
Obviously, I need CXF to test my REST services...
My REST services are using Spring :
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"/>
<import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />
<bean id="sectionResource" class="...rest.section.SectionResource"/>
<jaxrs:server address="/bnews">
<jaxrs:serviceBeans>
<ref bean="sectionResource" />
</jaxrs:serviceBeans>
</jaxrs:server>
<bean class="org.springframework.osgi.extensions.annotation.ServiceReferenceInjectionBeanPostProcessor"/>
</beans>
Thank you !
Affects: 1.2.0 Fixed in: 2.0.0-RC1, 2.0.0 Votes: 0, Watches: 1