Thanks for the response Mark,

In the end the problem seems to be how the home directories on this server are mapped.

I created a subdirectory, moved the jar and properties file inside there. Ran it again and it worked.

I'm guessing the property file "existed" enough that the check for it passed but when Spring tried to load the properties it failed and skipped it.

Thanks for the help.

cheers,
jared

On 2021-03-18 9:13 a.m., Mark Nuttall wrote:
Based on what you've said, this is a Spring Boot related (ish) issue only
because it is loading the properties. I suggest doing this the Spring Boot
way and letting the Spring Boot/Apache Camel integration just work. If
you've not see how Spring Boot resolves properties -
https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-external-config

On Wed, Mar 17, 2021 at 3:33 PM Jared Whiklo <jwhi...@gmail.com> wrote:

I apologize if this is either a) obvious or b) un-diagnosable because
it's my local setup.

I am working on converting an OSGI camel route to work in a deployable jar.

I am using spring-boot and decided to also switch to use java config.

My configuration class basically looks like.

@PropertySources({
          @PropertySource(value = "file:${indexer.config.file}",
ignoreResourceNotFound = true),
          @PropertySource(value = "classpath:default.yml")
})
@Configuration
public class IndexerProps { }

This seems to work for any variables injected using @PropertyInject but
not necessarily for the {{property.name}} replacement.

But what is really confused me is that I am able to compile and run the
jar on my (Mac) laptop but when I move it to a development environment
it no longer resolves any of the properties.

So when I run the jar locally (using java 11.0.3) I get

-------
  > java -Dfc3indexer.config.file=local.properties
-Dfc3indexer.log.indexer=DEBUG -Dfc3indexer.log.camel=DEBUG -jar
build/libs/islandora-1x-solr-indexer-0.0.1.jar

    .   ____          _            __ _ _
   /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
   \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
    '  |____| .__|_| |_|_| |_\__, | / / / /
   =========|_|==============|___/=/_/_/_/
   :: Spring Boot ::        (v2.3.3.RELEASE)

INFO 12:35:39.404 (FedoraSolrIndexer) Starting FedoraSolrIndexer on
whiklojlib-2.local with PID 89898
(/Users/whikloj/www/DAM/islandora-1x-solr-indexer/build/libs/islandora-1x-solr-indexer-0.0.1.jar

started by whikloj in /Users/whikloj/www/DAM/islandora-1x-solr-indexer)
DEBUG 12:35:39.407 (FedoraSolrIndexer) Running with Spring Boot
v2.3.3.RELEASE, Spring v5.2.8.RELEASE
INFO 12:35:39.408 (FedoraSolrIndexer) No active profile set, falling
back to default profiles: default
DEBUG 12:35:41.190 (BeanConfig) brokerUrl is tcp://localhost:61616
DEBUG 12:35:41.192 (BeanConfig) jms username/password is  /
DEBUG 12:35:41.214 (BeanConfig) brokerUrl is tcp://localhost:61616
DEBUG 12:35:41.214 (BeanConfig) jms username/password is  /
DEBUG 12:35:41.252 (BeanConfig) brokerUrl is tcp://localhost:61616
DEBUG 12:35:41.253 (BeanConfig) jms username/password is  /
DEBUG 12:35:41.960 (FedoraSolrIndexer) Properyy injected xslt.path is
file:///Users/whikloj/www/DAM/UofM_gsearch_config
WARN 12:35:43.329 (JettyHttpComponent) You use localhost interface! It
means that no external connections will be available. Don't you want to
use 0.0.0.0 instead (all network interfaces)?
jetty:
http://localhost:8888/fedora3-solr-indexer/reindex/%7Bpid%7D?httpMethodRestrict=GET
INFO 12:35:43.481 (FedoraSolrIndexer) Started FedoraSolrIndexer in 9.79
seconds (JVM running for 11.033)
^C%
--------

Which is good, but when I move the same jar to a (Linux RHEL)
development server and run it (with java 11.0.10) I get

--------
[whikloj@niobe]~% java -Dfc3indexer.log.islandora=DEBUG
-Dfc3indexer.log.camel=DEBUG -Dfc3indexer.config.file=local.properties
-jar islandora-1x-solr-indexer-0.0.1.jar

    .   ____          _            __ _ _
   /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
   \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
    '  |____| .__|_| |_|_| |_\__, | / / / /
   =========|_|==============|___/=/_/_/_/
   :: Spring Boot ::        (v2.3.3.RELEASE)

INFO 08:36:11.885 (FedoraSolrIndexer) Starting FedoraSolrIndexer on
niobe with PID 14896
(/home/u5/whikloj/islandora-1x-solr-indexer-0.0.1.jar started by whikloj
in /home/u5/whikloj)
INFO 08:36:11.888 (FedoraSolrIndexer) No active profile set, falling
back to default profiles: default
ERROR 08:36:15.557 (SpringApplication) Application run failed
org.apache.camel.FailedToCreateRouteException: Failed to create route
fedora-foxml-properties at: >>>
To[xslt:{{xslt.path}}/FOXML.xslt?transformerFactory=#xsltTransformer]
<<< in route:
Route(fedora-foxml-properties)[From[direct:fedora.properties... because
of Failed to resolve endpoint:
xslt:///FOXML.xslt?transformerFactory=#xsltTransformer due to:
javax.xml.transform.TransformerException: java.io.FileNotFoundException:
Cannot find resource: classpath:/FOXML.xslt in classpath for URI:
classpath:/FOXML.xslt
      at
org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:385)
      at
org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:112)

... stacktrace ...

Caused by: java.io.FileNotFoundException: Cannot find resource:
classpath:/FOXML.xslt in classpath for URI: classpath:/FOXML.xslt
      at

org.apache.camel.support.ResourceHelper.resolveMandatoryResourceAsInputStream(ResourceHelper.java:144)
      at

org.apache.camel.component.xslt.XsltUriResolver.resolve(XsltUriResolver.java:90)
      ... 49 common frames omitted
--------

The error makes sense, what doesn't is that the property xslt.path
(which does exist in the provided file) is not resolved.

Am I missing something really obvious?

cheers,
jared

--
Jared Whiklo
jwhi...@gmail.com



--
Jared Whiklo
jwhi...@gmail.com


Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to