Based on what does spring defines its search path? I don't know what I
could possibly done wrong while writing the framework which could invoke
such errors. Basically pax exam karaf does almost the same as u do when you
start it via the shell.

Kind regards,
Andreas
On Jun 10, 2013 7:04 PM, "Charles Moulliard" <[email protected]> wrote:

> How can we this issue where the schema is searched at the root of where
> pax exam has unpack the project and not inside org.kie/kie-spring bundle ?
>
> java.io.FileNotFoundException:
> /Users/chmoulli/JBoss/Code/droolsjbpm-oss/droolsjbpm-integration/drools-osgi/drools-karaf-itest/target/exam/unpack/69bbc140-6a26-4c31-a694-6e9c0987556f/org/kie/spring/kie-spring-2.0.0.xsd
> (No such file or directory)
>  at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)[:1.7.0_04]
> at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:99)[:1.7.0_04]
>  at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:433)[:1.7.0_04]
>
> <?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:kie="http://drools.org/schema/kie-spring";
>        xsi:schemaLocation="
>        http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>        http://drools.org/schema/kie-spring
> org/kie/spring/kie-spring-2.0.0.xsd">
>
>
>
>
> On Mon, Jun 10, 2013 at 6:54 PM, Charles Moulliard <[email protected]>wrote:
>
>> Thx for the trick JB. Work now.
>>
>> Here is what I did
>>
>> @RunWith(JUnit4TestRunner.class)
>> public class KieSpringOnKarafTest {
>>
>>     protected static final transient Logger LOG =
>> LoggerFactory.getLogger(KieSpringOnKarafTest.class);
>>     protected static final String DroolsVersion = "6.0.0-SNAPSHOT";
>>
>>     protected OsgiBundleXmlApplicationContext applicationContext;
>>
>>     @Inject
>>     protected BundleContext bc;
>>
>>     @Before
>>     public void init() {
>>          applicationContext = createApplicationContext();
>>         assertNotNull("Should have created a valid spring context",
>> applicationContext);
>>     }
>>
>>     protected void refresh() {
>>         applicationContext.setBundleContext(bc);
>>         applicationContext.refresh();
>>     }
>>
>>     protected OsgiBundleXmlApplicationContext createApplicationContext() {
>>         return new OsgiBundleXmlApplicationContext(new
>> String[]{"org/kie/spring/kie-beans.xml"});
>>     }
>>
>>     @Test
>>     public void testKContainer() throws Exception {
>>         refresh();
>>         KieContainer kieContainer = (KieContainer)
>> applicationContext.getBean("defaultContainer");
>>         assertNotNull(kieContainer);
>>         System.out.println("kieContainer.getReleaseId() ==
>> "+kieContainer.getReleaseId());
>>     }
>>
>>
>> On Mon, Jun 10, 2013 at 6:39 PM, Jean-Baptiste Onofré 
>> <[email protected]>wrote:
>>
>>> Try to put @Before to init and call the method before the test.
>>>
>>> Regards
>>> JB
>>>
>>>
>>> On 06/10/2013 06:30 PM, Charles Moulliard wrote:
>>>
>>>> Been able to figure out the issue. Thx for your help.
>>>>
>>>> I get now another exception with this code. The BundleContext object is
>>>> null when I tried to add it to the applicationContext. According to Pax
>>>> Exam, it should be injected automatically. Is it process after calling
>>>> the constructor of the class ?
>>>> I use pax exam 2.6.0
>>>>
>>>> @RunWith(JUnit4TestRunner.**class)
>>>> public class KieSpringOnKarafTest extends KieSpringIntegrationTestSuppor
>>>> **t {
>>>>
>>>>      protected static final transient Logger LOG =
>>>> LoggerFactory.getLogger(**KieSpringOnKarafTest.class);
>>>>      protected OsgiBundleXmlApplicationContex**t applicationContext;
>>>>
>>>>      @Inject
>>>>      protected BundleContext bc;
>>>>
>>>>      public KieSpringOnKarafTest () {
>>>>          applicationContext = createApplicationContext();
>>>>          assertNotNull("Should have created a valid spring context",
>>>> applicationContext);
>>>>          // applicationContext.**setBundleContext(bc); //
>>>> BundleContext is
>>>> NULL
>>>>          applicationContext.refresh();
>>>>      }
>>>>
>>>>      protected OsgiBundleXmlApplicationContex**t
>>>> createApplicationContext() {
>>>>          return new OsgiBundleXmlApplicationContex**t(new
>>>> String[]{"org/kie/spring/kie-**beans.xml"});
>>>>      }
>>>>
>>>>
>>>>
>>>> On Sun, Jun 9, 2013 at 9:20 PM, Andreas Pieber <[email protected]
>>>> <mailto:[email protected]>> wrote:
>>>>
>>>>     to use "versionAsInProject"  you need to add
>>>>
>>>>     <build>
>>>>        <plugins>
>>>>          <plugin>
>>>>            <groupId>org.apache.**servicemix.tooling</groupId>
>>>>            <artifactId>depends-maven-**plugin</artifactId>
>>>>            <version>1.2</version>
>>>>            <executions>
>>>>              <execution>
>>>>                <id>generate-depends-file</id>
>>>>                <goals>
>>>>                  <goal>generate-depends-file</**goal>
>>>>                </goals>
>>>>              </execution>
>>>>            </executions>
>>>>          </plugin>
>>>>        </plugins>
>>>>     </build>
>>>>
>>>>
>>>>
>>>>     On Sun, Jun 9, 2013 at 3:56 PM, Charles Moulliard <[email protected]
>>>>     <mailto:[email protected]>> wrote:
>>>>
>>>>         What do you mean by "extracted" the versions ? SMX doc is not
>>>>         really verbose
>>>>         (http://servicemix.apache.org/**docs/4.5.x/developers-guide/**
>>>> writing-tests.html<http://servicemix.apache.org/docs/4.5.x/developers-guide/writing-tests.html>
>>>> )
>>>>         but my code looks like what we do with camel, karaf, ....
>>>>
>>>>
>>>>         On Sun, Jun 9, 2013 at 12:59 PM, Andreas Pieber
>>>>         <[email protected] <mailto:[email protected]>> wrote:
>>>>
>>>>             Have you extracted the versions using the service mix plugin
>>>>             as described in the documentation? Is the version.
>>>>             Properties generated correctly?
>>>>
>>>>             Kind regards, Andreas
>>>>
>>>>             On 9 Jun 2013 12:46, "Charles Moulliard" <[email protected]
>>>>             <mailto:[email protected]>> wrote:
>>>>              >
>>>>              > Hi,
>>>>              >
>>>>              > I get this pax exam (maven error) in an unit test which
>>>>             was working previously. Here is also the pom file. What
>>>>             should I do in the pom file definition to avoid this error
>>>>             (https://gist.github.com/**cmoulliard/**
>>>> 49e4ef4c871d48bba550<https://gist.github.com/cmoulliard/49e4ef4c871d48bba550>
>>>> )
>>>>              >
>>>>              > java.lang.RuntimeException: Could not resolve version for
>>>>             groupId:org.apache.karaf artifactId:apache-karaf by reading
>>>>             the dependency information generated by maven.
>>>>              > at
>>>>             org.ops4j.pax.exam.MavenUtils.**
>>>> getArtifactVersion(MavenUtils.**java:78)
>>>>              > at
>>>>             org.ops4j.pax.exam.MavenUtils$**
>>>> 1.getVersion(MavenUtils.java:**100)
>>>>              > at
>>>>             org.ops4j.pax.exam.options.**MavenArtifactUrlReference.**
>>>> version(**MavenArtifactUrlReference.**java:110)
>>>>              > at
>>>>             org.ops4j.pax.exam.options.**MavenArtifactUrlReference.**
>>>> versionAsInProject(**MavenArtifactUrlReference.**java:118)
>>>>              >
>>>>              > Class
>>>>              >
>>>>              > import static
>>>>             org.apache.karaf.tooling.exam.**options.**
>>>> KarafDistributionOption.*;
>>>>              >
>>>>              > ...
>>>>              >
>>>>              >     @Configuration
>>>>              >     public static Option[] configure() {
>>>>              >         return new Option[]{
>>>>              >
>>>>             karafDistributionConfiguration**().frameworkUrl(
>>>>              >
>>>>             maven().groupId("org.apache.**karaf").artifactId("apache-**
>>>> karaf").type("tar.gz").**versionAsInProject())
>>>>              >
>>>>             .karafVersion(MavenUtils.**getArtifactVersion("org.**
>>>> apache.karaf",
>>>>             "apache-karaf")).name("Apache Karaf")
>>>>              >                         .unpackDirectory(new
>>>>             File("target/exam/unpack/")),
>>>>              >
>>>>              >                 keepRuntimeFolder(),
>>>>              >
>>>>              > ...
>>>>              >
>>>>              > Pom file
>>>>              >
>>>>              > Regards,
>>>>              >
>>>>              > --
>>>>              > Charles Moulliard
>>>>              > Apache Committer / Architect (RedHat)
>>>>              > Twitter : @cmoulliard | Blog :
>>>> http://cmoulliard.blogspot.com
>>>>              >
>>>>
>>>>
>>>>
>>>>
>>>>         --
>>>>         Charles Moulliard
>>>>         Apache Committer / Sr. Enterprise Architect (RedHat)
>>>>         Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Charles Moulliard
>>>> Apache Committer / Sr. Enterprise Architect (RedHat)
>>>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>>>
>>>>
>>> --
>>> Jean-Baptiste Onofré
>>> [email protected]
>>> http://blog.nanthrax.net
>>> Talend - http://www.talend.com
>>>
>>
>>
>>
>> --
>> Charles Moulliard
>> Apache Committer / Sr. Enterprise Architect (RedHat)
>> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>>
>>
>
>
> --
> Charles Moulliard
> Apache Committer / Sr. Enterprise Architect (RedHat)
> Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
>
>

Reply via email to