You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Tobias Hofer (JIRA)" <ji...@apache.org> on 2012/04/26 09:48:19 UTC

[jira] [Created] (CAMEL-5223) Cannot find resource in classpath using OSGi blueprint

Tobias Hofer created CAMEL-5223:
-----------------------------------

             Summary: Cannot find resource in classpath using OSGi blueprint
                 Key: CAMEL-5223
                 URL: https://issues.apache.org/jira/browse/CAMEL-5223
             Project: Camel
          Issue Type: Bug
          Components: camel-blueprint
    Affects Versions: 2.9.2
         Environment: x86_64 GNU/Linux
Java 1.6.0_26
Apache ServiceMix 4.4.1
            Reporter: Tobias Hofer
            Priority: Blocker
             Fix For: 2.9.3


I switched from Apache Camel version 2.8.4 (in ServiceMix 4.4.1) to the most recent version 2.9.2. Resource loading in 2.8.4 worked well, but not in the named release.

Find attached a small test case that uses XSLT and String-Template Endpoints. Neither of them can load their resource from the separate bundle.

# Install Apache ServiceMix 4.4.1
# Configure ServiceMix to use Apache Camel 2.9.2 (see {{etc/org.apache.karaf.features.cfg}})
# Start up ServiceMix
# Install feature 'camel-string-template'
# Build the attached test project using maven
# Copy/Link the built artifact into the {{deploy}} folder
# Copy/Link the route {{src/test/resources/camel-route}} into the {{deploy}} folder

The XSLT Component tries to load the resource eagerly. Therefore the route will not start and throws the following exception:
{noformat}
Caused by: java.io.FileNotFoundException: Cannot find resource in classpath for URI: com/basis06/apache/camel/HelloWorld.xslt
	at org.apache.camel.util.ResourceHelper.resolveMandatoryResourceAsUrl(ResourceHelper.java:122)
	at org.apache.camel.component.xslt.XsltEndpoint.loadResource(XsltEndpoint.java:67)
{noformat}

The same problem exists with the String-Template Component. But this component will fail not until it is called in the route.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-5223) Cannot find resource in classpath using OSGi blueprint

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13262544#comment-13262544 ] 

Claus Ibsen commented on CAMEL-5223:
------------------------------------

Resource loading works fine for me.

I moved the XML file into the src/main/resources/OSGI-INF/blueprint directory, which is the standard for blueprint XML files.
I removed the string template endpoint, so the route only did the xstl.

I installed the application on Fuse ESB which supports offically Camel 2.9, and it worked fine
I copied a test file and it was processed and from the shell I can get details
{code}
FuseESB:karaf@root> camel:route-info helloWorld 
Camel Route helloWorld
	Camel Context: 165-camel-3

Properties
		id = helloWorld
		parent = 37fe883b

Statistics
	Exchanges Total: 1
	Exchanges Completed: 1
	Exchanges Failed: 0
	Min Processing Time: 62ms
	Max Processing Time: 62ms
	Mean Processing Time: 62ms
	Total Processing Time: 62ms
	Last Processing Time: 62ms
	Load Avg: 0.00, 0.00, 0.00
	First Exchange Date: 2012-04-26 14:01:03
	Last Exchange Completed Date: 2012-04-26 14:01:03

Definition
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<route id="helloWorld" xmlns="http://camel.apache.org/schema/spring">
    <from uri="file:data/in"/>
    <to uri="xslt:com/basis06/apache/camel/HelloWorld.xslt" id="to1"/>
    <to uri="file:data/out" id="to2"/>
</route>
{code}
                
> Cannot find resource in classpath using OSGi blueprint
> ------------------------------------------------------
>
>                 Key: CAMEL-5223
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5223
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-blueprint
>    Affects Versions: 2.9.2
>         Environment: x86_64 GNU/Linux
> Java 1.6.0_26
> Apache ServiceMix 4.4.1
>            Reporter: Tobias Hofer
>             Fix For: 2.9.3, 2.10.0
>
>         Attachments: test-classpath-resource.tar.gz
>
>
> I switched from Apache Camel version 2.8.4 (in ServiceMix 4.4.1) to the most recent version 2.9.2. Resource loading in 2.8.4 worked well, but not in the named release.
> Find attached a small test case that uses XSLT and String-Template Endpoints. Neither of them can load their resource from the separate bundle.
> # Install Apache ServiceMix 4.4.1
> # Configure ServiceMix to use Apache Camel 2.9.2 (see {{etc/org.apache.karaf.features.cfg}})
> # Start up ServiceMix
> # Install feature 'camel-string-template'
> # Build the attached test project using maven
> # Copy/Link the built artifact into the {{deploy}} folder
> # Copy/Link the route {{src/test/resources/camel-route}} into the {{deploy}} folder
> The XSLT Component tries to load the resource eagerly. Therefore the route will not start and throws the following exception:
> {noformat}
> Caused by: java.io.FileNotFoundException: Cannot find resource in classpath for URI: com/basis06/apache/camel/HelloWorld.xslt
> 	at org.apache.camel.util.ResourceHelper.resolveMandatoryResourceAsUrl(ResourceHelper.java:122)
> 	at org.apache.camel.component.xslt.XsltEndpoint.loadResource(XsltEndpoint.java:67)
> {noformat}
> The same problem exists with the String-Template Component. But this component will fail not until it is called in the route.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-5223) Cannot find resource in classpath using OSGi blueprint

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295729#comment-13295729 ] 

Claus Ibsen commented on CAMEL-5223:
------------------------------------

I tried your suggestion with Karaf 2.2.7, and Camel 2.10-SNAPSHOT, and got it working.

The route is processed and I got a hello world in the output directory.

{code}
davsclaus:/opt/apache-karaf-2.2.7$ mv sample.xml data/in
davsclaus:/opt/apache-karaf-2.2.7$ ls data/
cache/             in/                out/               tmp/               
generated-bundles/ log/               port               
davsclaus:/opt/apache-karaf-2.2.7$ ls data/in/.camel/sample.xml 
data/in/.camel/sample.xml
davsclaus:/opt/apache-karaf-2.2.7$ cat data/out/sample.xml 
"Hello World"davsclaus:/opt/apache-karaf-2.2.7$ 
{code}
                
> Cannot find resource in classpath using OSGi blueprint
> ------------------------------------------------------
>
>                 Key: CAMEL-5223
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5223
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-blueprint
>    Affects Versions: 2.9.2
>         Environment: x86_64 GNU/Linux
> Java 1.6.0_26
> Apache ServiceMix 4.4.1
>            Reporter: Tobias Hofer
>         Attachments: test-classpath-resource.tar.gz
>
>
> I switched from Apache Camel version 2.8.4 (in ServiceMix 4.4.1) to the most recent version 2.9.2. Resource loading in 2.8.4 worked well, but not in the named release.
> Find attached a small test case that uses XSLT and String-Template Endpoints. Neither of them can load their resource from the separate bundle.
> # Install Apache ServiceMix 4.4.1
> # Configure ServiceMix to use Apache Camel 2.9.2 (see {{etc/org.apache.karaf.features.cfg}})
> # Start up ServiceMix
> # Install feature 'camel-string-template'
> # Build the attached test project using maven
> # Copy/Link the built artifact into the {{deploy}} folder
> # Copy/Link the route {{src/test/resources/camel-route}} into the {{deploy}} folder
> The XSLT Component tries to load the resource eagerly. Therefore the route will not start and throws the following exception:
> {noformat}
> Caused by: java.io.FileNotFoundException: Cannot find resource in classpath for URI: com/basis06/apache/camel/HelloWorld.xslt
> 	at org.apache.camel.util.ResourceHelper.resolveMandatoryResourceAsUrl(ResourceHelper.java:122)
> 	at org.apache.camel.component.xslt.XsltEndpoint.loadResource(XsltEndpoint.java:67)
> {noformat}
> The same problem exists with the String-Template Component. But this component will fail not until it is called in the route.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CAMEL-5223) Cannot find resource in classpath using OSGi blueprint

Posted by "Hadrian Zbarcea (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hadrian Zbarcea updated CAMEL-5223:
-----------------------------------

    Fix Version/s:     (was: 2.9.3)
                       (was: 2.10.0)
    
> Cannot find resource in classpath using OSGi blueprint
> ------------------------------------------------------
>
>                 Key: CAMEL-5223
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5223
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-blueprint
>    Affects Versions: 2.9.2
>         Environment: x86_64 GNU/Linux
> Java 1.6.0_26
> Apache ServiceMix 4.4.1
>            Reporter: Tobias Hofer
>         Attachments: test-classpath-resource.tar.gz
>
>
> I switched from Apache Camel version 2.8.4 (in ServiceMix 4.4.1) to the most recent version 2.9.2. Resource loading in 2.8.4 worked well, but not in the named release.
> Find attached a small test case that uses XSLT and String-Template Endpoints. Neither of them can load their resource from the separate bundle.
> # Install Apache ServiceMix 4.4.1
> # Configure ServiceMix to use Apache Camel 2.9.2 (see {{etc/org.apache.karaf.features.cfg}})
> # Start up ServiceMix
> # Install feature 'camel-string-template'
> # Build the attached test project using maven
> # Copy/Link the built artifact into the {{deploy}} folder
> # Copy/Link the route {{src/test/resources/camel-route}} into the {{deploy}} folder
> The XSLT Component tries to load the resource eagerly. Therefore the route will not start and throws the following exception:
> {noformat}
> Caused by: java.io.FileNotFoundException: Cannot find resource in classpath for URI: com/basis06/apache/camel/HelloWorld.xslt
> 	at org.apache.camel.util.ResourceHelper.resolveMandatoryResourceAsUrl(ResourceHelper.java:122)
> 	at org.apache.camel.component.xslt.XsltEndpoint.loadResource(XsltEndpoint.java:67)
> {noformat}
> The same problem exists with the String-Template Component. But this component will fail not until it is called in the route.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-5223) Cannot find resource in classpath using OSGi blueprint

Posted by "Hadrian Zbarcea (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295699#comment-13295699 ] 

Hadrian Zbarcea commented on CAMEL-5223:
----------------------------------------

This is not really a Camel issue but an Aries/Karaf one. I think it's already fixed, but we're not gonna block the 2.10.0 and wait for new releases. I unset the fix version for now.
                
> Cannot find resource in classpath using OSGi blueprint
> ------------------------------------------------------
>
>                 Key: CAMEL-5223
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5223
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-blueprint
>    Affects Versions: 2.9.2
>         Environment: x86_64 GNU/Linux
> Java 1.6.0_26
> Apache ServiceMix 4.4.1
>            Reporter: Tobias Hofer
>         Attachments: test-classpath-resource.tar.gz
>
>
> I switched from Apache Camel version 2.8.4 (in ServiceMix 4.4.1) to the most recent version 2.9.2. Resource loading in 2.8.4 worked well, but not in the named release.
> Find attached a small test case that uses XSLT and String-Template Endpoints. Neither of them can load their resource from the separate bundle.
> # Install Apache ServiceMix 4.4.1
> # Configure ServiceMix to use Apache Camel 2.9.2 (see {{etc/org.apache.karaf.features.cfg}})
> # Start up ServiceMix
> # Install feature 'camel-string-template'
> # Build the attached test project using maven
> # Copy/Link the built artifact into the {{deploy}} folder
> # Copy/Link the route {{src/test/resources/camel-route}} into the {{deploy}} folder
> The XSLT Component tries to load the resource eagerly. Therefore the route will not start and throws the following exception:
> {noformat}
> Caused by: java.io.FileNotFoundException: Cannot find resource in classpath for URI: com/basis06/apache/camel/HelloWorld.xslt
> 	at org.apache.camel.util.ResourceHelper.resolveMandatoryResourceAsUrl(ResourceHelper.java:122)
> 	at org.apache.camel.component.xslt.XsltEndpoint.loadResource(XsltEndpoint.java:67)
> {noformat}
> The same problem exists with the String-Template Component. But this component will fail not until it is called in the route.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-5223) Cannot find resource in classpath using OSGi blueprint

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13262547#comment-13262547 ] 

Claus Ibsen commented on CAMEL-5223:
------------------------------------

I did get puzzled by the code that loads the resource in camel-core-osgi, so I have asked for the OSGi experts to chim in.
I posted on Camel @dev so keep an eye there.
                
> Cannot find resource in classpath using OSGi blueprint
> ------------------------------------------------------
>
>                 Key: CAMEL-5223
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5223
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-blueprint
>    Affects Versions: 2.9.2
>         Environment: x86_64 GNU/Linux
> Java 1.6.0_26
> Apache ServiceMix 4.4.1
>            Reporter: Tobias Hofer
>             Fix For: 2.9.3, 2.10.0
>
>         Attachments: test-classpath-resource.tar.gz
>
>
> I switched from Apache Camel version 2.8.4 (in ServiceMix 4.4.1) to the most recent version 2.9.2. Resource loading in 2.8.4 worked well, but not in the named release.
> Find attached a small test case that uses XSLT and String-Template Endpoints. Neither of them can load their resource from the separate bundle.
> # Install Apache ServiceMix 4.4.1
> # Configure ServiceMix to use Apache Camel 2.9.2 (see {{etc/org.apache.karaf.features.cfg}})
> # Start up ServiceMix
> # Install feature 'camel-string-template'
> # Build the attached test project using maven
> # Copy/Link the built artifact into the {{deploy}} folder
> # Copy/Link the route {{src/test/resources/camel-route}} into the {{deploy}} folder
> The XSLT Component tries to load the resource eagerly. Therefore the route will not start and throws the following exception:
> {noformat}
> Caused by: java.io.FileNotFoundException: Cannot find resource in classpath for URI: com/basis06/apache/camel/HelloWorld.xslt
> 	at org.apache.camel.util.ResourceHelper.resolveMandatoryResourceAsUrl(ResourceHelper.java:122)
> 	at org.apache.camel.component.xslt.XsltEndpoint.loadResource(XsltEndpoint.java:67)
> {noformat}
> The same problem exists with the String-Template Component. But this component will fail not until it is called in the route.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Comment Edited] (CAMEL-5223) Cannot find resource in classpath using OSGi blueprint

Posted by "Tobias Hofer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295710#comment-13295710 ] 

Tobias Hofer edited comment on CAMEL-5223 at 6/15/12 3:02 PM:
--------------------------------------------------------------

The 'OsgiClassResolver' in the camel-spring bundle contains the bug.
{code}
public URL loadResourceAsURL(String uri) {
    ObjectHelper.notEmpty(uri, "uri");
    return bundleContext.getBundle().getEntry(uri);
}
{code}

The call to {{getEntry}} does only look in the classpath of the bundle. Imported packages are not considered. {{getResource}} is the correct method to call.

See http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/Bundle.html#getEntry(java.lang.String)
See also http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/Bundle.html#getResource(java.lang.String)

                
      was (Author: tsh):
    The 'OsgiClassResolver' contains in the camel-spring bundle contains the bug.
{code}
public URL loadResourceAsURL(String uri) {
    ObjectHelper.notEmpty(uri, "uri");
    return bundleContext.getBundle().getEntry(uri);
}
{code}

The call to {{getEntry}} does only look in the classpath of the bundle. Imported packages are not considered. {{getResource}} is the correct method to call.

See http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/Bundle.html#getEntry(java.lang.String)
See also http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/Bundle.html#getResource(java.lang.String)

                  
> Cannot find resource in classpath using OSGi blueprint
> ------------------------------------------------------
>
>                 Key: CAMEL-5223
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5223
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-blueprint
>    Affects Versions: 2.9.2
>         Environment: x86_64 GNU/Linux
> Java 1.6.0_26
> Apache ServiceMix 4.4.1
>            Reporter: Tobias Hofer
>         Attachments: test-classpath-resource.tar.gz
>
>
> I switched from Apache Camel version 2.8.4 (in ServiceMix 4.4.1) to the most recent version 2.9.2. Resource loading in 2.8.4 worked well, but not in the named release.
> Find attached a small test case that uses XSLT and String-Template Endpoints. Neither of them can load their resource from the separate bundle.
> # Install Apache ServiceMix 4.4.1
> # Configure ServiceMix to use Apache Camel 2.9.2 (see {{etc/org.apache.karaf.features.cfg}})
> # Start up ServiceMix
> # Install feature 'camel-string-template'
> # Build the attached test project using maven
> # Copy/Link the built artifact into the {{deploy}} folder
> # Copy/Link the route {{src/test/resources/camel-route}} into the {{deploy}} folder
> The XSLT Component tries to load the resource eagerly. Therefore the route will not start and throws the following exception:
> {noformat}
> Caused by: java.io.FileNotFoundException: Cannot find resource in classpath for URI: com/basis06/apache/camel/HelloWorld.xslt
> 	at org.apache.camel.util.ResourceHelper.resolveMandatoryResourceAsUrl(ResourceHelper.java:122)
> 	at org.apache.camel.component.xslt.XsltEndpoint.loadResource(XsltEndpoint.java:67)
> {noformat}
> The same problem exists with the String-Template Component. But this component will fail not until it is called in the route.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-5223) Cannot find resource in classpath using OSGi blueprint

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295730#comment-13295730 ] 

Claus Ibsen commented on CAMEL-5223:
------------------------------------

karaf@root> camel:route-info helloWorld 
Camel Route helloWorld
	Camel Context: 79-camel-3

Properties
		id = helloWorld
		parent = 6c4f7b4c

Statistics
	Exchanges Total: 1
	Exchanges Completed: 1
	Exchanges Failed: 0
	Min Processing Time: 177ms
	Max Processing Time: 177ms
	Mean Processing Time: 177ms
	Total Processing Time: 177ms
	Last Processing Time: 177ms
	Load Avg: 0.00, 0.00, 0.00
	First Exchange Date: 2012-06-15 17:43:41
	Last Exchange Completed Date: 2012-06-15 17:43:41

Definition
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<route id="helloWorld" xmlns="http://camel.apache.org/schema/spring">
    <from uri="file:data/in"/>
    <to uri="xslt:com/basis06/apache/camel/HelloWorld.xslt" id="to1"/>
    <to uri="string-template:com/basis06/apache/camel/Quote.txt" id="to2"/>
    <to uri="file:data/out" id="to3"/>
</route>
                
> Cannot find resource in classpath using OSGi blueprint
> ------------------------------------------------------
>
>                 Key: CAMEL-5223
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5223
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-blueprint
>    Affects Versions: 2.9.2
>         Environment: x86_64 GNU/Linux
> Java 1.6.0_26
> Apache ServiceMix 4.4.1
>            Reporter: Tobias Hofer
>         Attachments: test-classpath-resource.tar.gz
>
>
> I switched from Apache Camel version 2.8.4 (in ServiceMix 4.4.1) to the most recent version 2.9.2. Resource loading in 2.8.4 worked well, but not in the named release.
> Find attached a small test case that uses XSLT and String-Template Endpoints. Neither of them can load their resource from the separate bundle.
> # Install Apache ServiceMix 4.4.1
> # Configure ServiceMix to use Apache Camel 2.9.2 (see {{etc/org.apache.karaf.features.cfg}})
> # Start up ServiceMix
> # Install feature 'camel-string-template'
> # Build the attached test project using maven
> # Copy/Link the built artifact into the {{deploy}} folder
> # Copy/Link the route {{src/test/resources/camel-route}} into the {{deploy}} folder
> The XSLT Component tries to load the resource eagerly. Therefore the route will not start and throws the following exception:
> {noformat}
> Caused by: java.io.FileNotFoundException: Cannot find resource in classpath for URI: com/basis06/apache/camel/HelloWorld.xslt
> 	at org.apache.camel.util.ResourceHelper.resolveMandatoryResourceAsUrl(ResourceHelper.java:122)
> 	at org.apache.camel.component.xslt.XsltEndpoint.loadResource(XsltEndpoint.java:67)
> {noformat}
> The same problem exists with the String-Template Component. But this component will fail not until it is called in the route.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CAMEL-5223) Cannot find resource in classpath using OSGi blueprint

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-5223.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 2.10.0
                   2.9.3
         Assignee: Claus Ibsen
    
> Cannot find resource in classpath using OSGi blueprint
> ------------------------------------------------------
>
>                 Key: CAMEL-5223
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5223
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-blueprint
>    Affects Versions: 2.9.2
>         Environment: x86_64 GNU/Linux
> Java 1.6.0_26
> Apache ServiceMix 4.4.1
>            Reporter: Tobias Hofer
>            Assignee: Claus Ibsen
>             Fix For: 2.9.3, 2.10.0
>
>         Attachments: test-classpath-resource.tar.gz
>
>
> I switched from Apache Camel version 2.8.4 (in ServiceMix 4.4.1) to the most recent version 2.9.2. Resource loading in 2.8.4 worked well, but not in the named release.
> Find attached a small test case that uses XSLT and String-Template Endpoints. Neither of them can load their resource from the separate bundle.
> # Install Apache ServiceMix 4.4.1
> # Configure ServiceMix to use Apache Camel 2.9.2 (see {{etc/org.apache.karaf.features.cfg}})
> # Start up ServiceMix
> # Install feature 'camel-string-template'
> # Build the attached test project using maven
> # Copy/Link the built artifact into the {{deploy}} folder
> # Copy/Link the route {{src/test/resources/camel-route}} into the {{deploy}} folder
> The XSLT Component tries to load the resource eagerly. Therefore the route will not start and throws the following exception:
> {noformat}
> Caused by: java.io.FileNotFoundException: Cannot find resource in classpath for URI: com/basis06/apache/camel/HelloWorld.xslt
> 	at org.apache.camel.util.ResourceHelper.resolveMandatoryResourceAsUrl(ResourceHelper.java:122)
> 	at org.apache.camel.component.xslt.XsltEndpoint.loadResource(XsltEndpoint.java:67)
> {noformat}
> The same problem exists with the String-Template Component. But this component will fail not until it is called in the route.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-5223) Cannot find resource in classpath using OSGi blueprint

Posted by "Tobias Hofer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295710#comment-13295710 ] 

Tobias Hofer commented on CAMEL-5223:
-------------------------------------

The 'OsgiClassResolver' contains in the camel-spring bundle contains the bug.
{code}
public URL loadResourceAsURL(String uri) {
    ObjectHelper.notEmpty(uri, "uri");
    return bundleContext.getBundle().getEntry(uri);
}
{code}

The call to {{getEntry}} does only look in the classpath of the bundle. Imported packages are not considered. {{getResource}} is the correct method to call.

See http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/Bundle.html#getEntry(java.lang.String)
See also http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/Bundle.html#getResource(java.lang.String)

                
> Cannot find resource in classpath using OSGi blueprint
> ------------------------------------------------------
>
>                 Key: CAMEL-5223
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5223
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-blueprint
>    Affects Versions: 2.9.2
>         Environment: x86_64 GNU/Linux
> Java 1.6.0_26
> Apache ServiceMix 4.4.1
>            Reporter: Tobias Hofer
>         Attachments: test-classpath-resource.tar.gz
>
>
> I switched from Apache Camel version 2.8.4 (in ServiceMix 4.4.1) to the most recent version 2.9.2. Resource loading in 2.8.4 worked well, but not in the named release.
> Find attached a small test case that uses XSLT and String-Template Endpoints. Neither of them can load their resource from the separate bundle.
> # Install Apache ServiceMix 4.4.1
> # Configure ServiceMix to use Apache Camel 2.9.2 (see {{etc/org.apache.karaf.features.cfg}})
> # Start up ServiceMix
> # Install feature 'camel-string-template'
> # Build the attached test project using maven
> # Copy/Link the built artifact into the {{deploy}} folder
> # Copy/Link the route {{src/test/resources/camel-route}} into the {{deploy}} folder
> The XSLT Component tries to load the resource eagerly. Therefore the route will not start and throws the following exception:
> {noformat}
> Caused by: java.io.FileNotFoundException: Cannot find resource in classpath for URI: com/basis06/apache/camel/HelloWorld.xslt
> 	at org.apache.camel.util.ResourceHelper.resolveMandatoryResourceAsUrl(ResourceHelper.java:122)
> 	at org.apache.camel.component.xslt.XsltEndpoint.loadResource(XsltEndpoint.java:67)
> {noformat}
> The same problem exists with the String-Template Component. But this component will fail not until it is called in the route.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-5223) Cannot find resource in classpath using OSGi blueprint

Posted by "Tobias Hofer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13262586#comment-13262586 ] 

Tobias Hofer commented on CAMEL-5223:
-------------------------------------

Putting the blueprint xml into the bundle works, because they share the same bundle context then.

But my test case tries to use a classpath resource from another bundle. This works fine for classes exported by the bundle but not for resources.

Putting the blueprint xml into the deploy folder deploys that in its own bundle context that will dynamically import required packages (from other bundles).

You can extend the test case and successfully invoke the HelloWorld class inside the route. But you cannot access any resource from the bundle that provides the HelloWorld class.


                
> Cannot find resource in classpath using OSGi blueprint
> ------------------------------------------------------
>
>                 Key: CAMEL-5223
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5223
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-blueprint
>    Affects Versions: 2.9.2
>         Environment: x86_64 GNU/Linux
> Java 1.6.0_26
> Apache ServiceMix 4.4.1
>            Reporter: Tobias Hofer
>             Fix For: 2.9.3, 2.10.0
>
>         Attachments: test-classpath-resource.tar.gz
>
>
> I switched from Apache Camel version 2.8.4 (in ServiceMix 4.4.1) to the most recent version 2.9.2. Resource loading in 2.8.4 worked well, but not in the named release.
> Find attached a small test case that uses XSLT and String-Template Endpoints. Neither of them can load their resource from the separate bundle.
> # Install Apache ServiceMix 4.4.1
> # Configure ServiceMix to use Apache Camel 2.9.2 (see {{etc/org.apache.karaf.features.cfg}})
> # Start up ServiceMix
> # Install feature 'camel-string-template'
> # Build the attached test project using maven
> # Copy/Link the built artifact into the {{deploy}} folder
> # Copy/Link the route {{src/test/resources/camel-route}} into the {{deploy}} folder
> The XSLT Component tries to load the resource eagerly. Therefore the route will not start and throws the following exception:
> {noformat}
> Caused by: java.io.FileNotFoundException: Cannot find resource in classpath for URI: com/basis06/apache/camel/HelloWorld.xslt
> 	at org.apache.camel.util.ResourceHelper.resolveMandatoryResourceAsUrl(ResourceHelper.java:122)
> 	at org.apache.camel.component.xslt.XsltEndpoint.loadResource(XsltEndpoint.java:67)
> {noformat}
> The same problem exists with the String-Template Component. But this component will fail not until it is called in the route.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CAMEL-5223) Cannot find resource in classpath using OSGi blueprint

Posted by "Tobias Hofer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tobias Hofer updated CAMEL-5223:
--------------------------------

    Attachment: test-classpath-resource.tar.gz
    
> Cannot find resource in classpath using OSGi blueprint
> ------------------------------------------------------
>
>                 Key: CAMEL-5223
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5223
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-blueprint
>    Affects Versions: 2.9.2
>         Environment: x86_64 GNU/Linux
> Java 1.6.0_26
> Apache ServiceMix 4.4.1
>            Reporter: Tobias Hofer
>            Priority: Blocker
>             Fix For: 2.9.3
>
>         Attachments: test-classpath-resource.tar.gz
>
>
> I switched from Apache Camel version 2.8.4 (in ServiceMix 4.4.1) to the most recent version 2.9.2. Resource loading in 2.8.4 worked well, but not in the named release.
> Find attached a small test case that uses XSLT and String-Template Endpoints. Neither of them can load their resource from the separate bundle.
> # Install Apache ServiceMix 4.4.1
> # Configure ServiceMix to use Apache Camel 2.9.2 (see {{etc/org.apache.karaf.features.cfg}})
> # Start up ServiceMix
> # Install feature 'camel-string-template'
> # Build the attached test project using maven
> # Copy/Link the built artifact into the {{deploy}} folder
> # Copy/Link the route {{src/test/resources/camel-route}} into the {{deploy}} folder
> The XSLT Component tries to load the resource eagerly. Therefore the route will not start and throws the following exception:
> {noformat}
> Caused by: java.io.FileNotFoundException: Cannot find resource in classpath for URI: com/basis06/apache/camel/HelloWorld.xslt
> 	at org.apache.camel.util.ResourceHelper.resolveMandatoryResourceAsUrl(ResourceHelper.java:122)
> 	at org.apache.camel.component.xslt.XsltEndpoint.loadResource(XsltEndpoint.java:67)
> {noformat}
> The same problem exists with the String-Template Component. But this component will fail not until it is called in the route.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-5223) Cannot find resource in classpath using OSGi blueprint

Posted by "Tobias Hofer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295716#comment-13295716 ] 

Tobias Hofer commented on CAMEL-5223:
-------------------------------------

The {{OsgiClassResolver}} is now (in the trunk) located in {{camel-core-osgi}}. Same code, same problem.

                
> Cannot find resource in classpath using OSGi blueprint
> ------------------------------------------------------
>
>                 Key: CAMEL-5223
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5223
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-blueprint
>    Affects Versions: 2.9.2
>         Environment: x86_64 GNU/Linux
> Java 1.6.0_26
> Apache ServiceMix 4.4.1
>            Reporter: Tobias Hofer
>         Attachments: test-classpath-resource.tar.gz
>
>
> I switched from Apache Camel version 2.8.4 (in ServiceMix 4.4.1) to the most recent version 2.9.2. Resource loading in 2.8.4 worked well, but not in the named release.
> Find attached a small test case that uses XSLT and String-Template Endpoints. Neither of them can load their resource from the separate bundle.
> # Install Apache ServiceMix 4.4.1
> # Configure ServiceMix to use Apache Camel 2.9.2 (see {{etc/org.apache.karaf.features.cfg}})
> # Start up ServiceMix
> # Install feature 'camel-string-template'
> # Build the attached test project using maven
> # Copy/Link the built artifact into the {{deploy}} folder
> # Copy/Link the route {{src/test/resources/camel-route}} into the {{deploy}} folder
> The XSLT Component tries to load the resource eagerly. Therefore the route will not start and throws the following exception:
> {noformat}
> Caused by: java.io.FileNotFoundException: Cannot find resource in classpath for URI: com/basis06/apache/camel/HelloWorld.xslt
> 	at org.apache.camel.util.ResourceHelper.resolveMandatoryResourceAsUrl(ResourceHelper.java:122)
> 	at org.apache.camel.component.xslt.XsltEndpoint.loadResource(XsltEndpoint.java:67)
> {noformat}
> The same problem exists with the String-Template Component. But this component will fail not until it is called in the route.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-5223) Cannot find resource in classpath using OSGi blueprint

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-5223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13262624#comment-13262624 ] 

Daniel Kulp commented on CAMEL-5223:
------------------------------------


I ran into this same issue with CXF's WS-N server on Tuesday.   The xsd's are in the cxf-wsn-api bundle, but the cxf-wsn-core bundle could not load them even if importing the package.   The ONLY solutions I found were:

1) Make cxf-wsn-core use a Dynamic-Import for the package that contains the resources.  A normal import did not work, just the Dynamic-Import

2) Make cxf-wsn-core use a Require-Bundle: cxf-wsn-api

I'm not sure yet if this is a bug in the OSGi stuff.  (I also only checked with Felix, I need to also check to see if Equinox exhibits the same issue)



                
> Cannot find resource in classpath using OSGi blueprint
> ------------------------------------------------------
>
>                 Key: CAMEL-5223
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5223
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-blueprint
>    Affects Versions: 2.9.2
>         Environment: x86_64 GNU/Linux
> Java 1.6.0_26
> Apache ServiceMix 4.4.1
>            Reporter: Tobias Hofer
>             Fix For: 2.9.3, 2.10.0
>
>         Attachments: test-classpath-resource.tar.gz
>
>
> I switched from Apache Camel version 2.8.4 (in ServiceMix 4.4.1) to the most recent version 2.9.2. Resource loading in 2.8.4 worked well, but not in the named release.
> Find attached a small test case that uses XSLT and String-Template Endpoints. Neither of them can load their resource from the separate bundle.
> # Install Apache ServiceMix 4.4.1
> # Configure ServiceMix to use Apache Camel 2.9.2 (see {{etc/org.apache.karaf.features.cfg}})
> # Start up ServiceMix
> # Install feature 'camel-string-template'
> # Build the attached test project using maven
> # Copy/Link the built artifact into the {{deploy}} folder
> # Copy/Link the route {{src/test/resources/camel-route}} into the {{deploy}} folder
> The XSLT Component tries to load the resource eagerly. Therefore the route will not start and throws the following exception:
> {noformat}
> Caused by: java.io.FileNotFoundException: Cannot find resource in classpath for URI: com/basis06/apache/camel/HelloWorld.xslt
> 	at org.apache.camel.util.ResourceHelper.resolveMandatoryResourceAsUrl(ResourceHelper.java:122)
> 	at org.apache.camel.component.xslt.XsltEndpoint.loadResource(XsltEndpoint.java:67)
> {noformat}
> The same problem exists with the String-Template Component. But this component will fail not until it is called in the route.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CAMEL-5223) Cannot find resource in classpath using OSGi blueprint

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-5223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-5223:
-------------------------------

         Priority: Major  (was: Blocker)
    Fix Version/s: 2.10.0
    
> Cannot find resource in classpath using OSGi blueprint
> ------------------------------------------------------
>
>                 Key: CAMEL-5223
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5223
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-blueprint
>    Affects Versions: 2.9.2
>         Environment: x86_64 GNU/Linux
> Java 1.6.0_26
> Apache ServiceMix 4.4.1
>            Reporter: Tobias Hofer
>             Fix For: 2.9.3, 2.10.0
>
>         Attachments: test-classpath-resource.tar.gz
>
>
> I switched from Apache Camel version 2.8.4 (in ServiceMix 4.4.1) to the most recent version 2.9.2. Resource loading in 2.8.4 worked well, but not in the named release.
> Find attached a small test case that uses XSLT and String-Template Endpoints. Neither of them can load their resource from the separate bundle.
> # Install Apache ServiceMix 4.4.1
> # Configure ServiceMix to use Apache Camel 2.9.2 (see {{etc/org.apache.karaf.features.cfg}})
> # Start up ServiceMix
> # Install feature 'camel-string-template'
> # Build the attached test project using maven
> # Copy/Link the built artifact into the {{deploy}} folder
> # Copy/Link the route {{src/test/resources/camel-route}} into the {{deploy}} folder
> The XSLT Component tries to load the resource eagerly. Therefore the route will not start and throws the following exception:
> {noformat}
> Caused by: java.io.FileNotFoundException: Cannot find resource in classpath for URI: com/basis06/apache/camel/HelloWorld.xslt
> 	at org.apache.camel.util.ResourceHelper.resolveMandatoryResourceAsUrl(ResourceHelper.java:122)
> 	at org.apache.camel.component.xslt.XsltEndpoint.loadResource(XsltEndpoint.java:67)
> {noformat}
> The same problem exists with the String-Template Component. But this component will fail not until it is called in the route.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira