I'm trying to upgrade from xmlbeans 3.1.0 to 5.0.0 using saxon HE 9.9.1-7. Previously, instead of saxon we configured Jaxen for xpath using src/main/resources/META-INF/services/org.apache.xmlbeans.impl.store.PathDelegate.SelectPathInterface.
I've encountered a couple of problems:
5.0.0 removed PathDelegate.SelectPathInterface. It now uses org.apache.xmlbeans.impl.xpath.Path. I've tried to configure a different xpath engine by making appropriate changes in META-INF/services but it didn't work (i.e. xmlbeans still uses saxon). How can I replace saxon?
How do can I configure the namespace-to-URI mappings? In the call stack below, the namespaceMap passed to the constructor is null or empty:
SaxonXPath(String path, String contextVar, Map<String, String> namespaceMap)
getCompiledPathSaxon(String, String, Map<String, String>)
execute(Cur, XmlOptions)
getCompiledPath(String, XmlOptions, String)
As a result:
net.sf.saxon.trans.XPathException: Namespace prefix 'table' has not been declared
at net.sf.saxon.expr.parser.XPathParser.grumble(XPathParser.java:315)
at net.sf.saxon.expr.parser.XPathParser.grumble(XPathParser.java:272)
at net.sf.saxon.expr.parser.XPathParser.makeStructuredQName(XPathParser.java:3796)
at net.sf.saxon.expr.parser.XPathParser.makeNameTest(XPathParser.java:3848)
at net.sf.saxon.expr.parser.XPathParser.parseNodeTest(XPathParser.java:2757)
at net.sf.saxon.expr.parser.XPathParser.parseBasicStep(XPathParser.java:2253)
at net.sf.saxon.expr.parser.XPathParser.parseStepExpression(XPathParser.java:2076)
at net.sf.saxon.expr.parser.XPathParser.parseRemainingPath(XPathParser.java:2035)
at net.sf.saxon.expr.parser.XPathParser.parsePathExpression(XPathParser.java:1940)
at net.sf.saxon.expr.parser.XPathParser.parseSimpleMappingExpression(XPathParser.java:1971)
at net.sf.saxon.expr.parser.XPathParser.parseUnaryExpression(XPathParser.java:1824)
at net.sf.saxon.expr.parser.XPathParser.parseExprSingle(XPathParser.java:753)
at net.sf.saxon.expr.parser.XPathParser.parseExpression(XPathParser.java:660)
at net.sf.saxon.expr.parser.XPathParser.parse(XPathParser.java:522)
at net.sf.saxon.expr.parser.ExpressionTool.make(ExpressionTool.java:107)
at net.sf.saxon.sxpath.XPathEvaluator.createExpression(XPathEvaluator.java:134)
at org.apache.xmlbeans.impl.xpath.saxon.SaxonXPath.selectNodes(SaxonXPath.java:109)
...
Related
Im using the spring-websocket dependency with spring-boot-starter-parent version 2.7.5
This is my endpoint configuration.
#Override
public void registerStompEndpoints(final StompEndpointRegistry stompEndpointRegistry) {
stompEndpointRegistry.addEndpoint("/some_ws/{token}").withSockJS();
}
The {token} part should work als a url parameter. This configuration works fine with the spring-boot-starter-parent version 2.7.5 but after the upgrade to version 3.0.2 spring throws the following error.
o.s.w.s.s.t.h.DefaultSockJsService : "Invalid SockJS path '/socc17Z3uf3PuG/info' - required to have 3 path segments"
I tried to the change the endpoint url to /some_ws/:token and /some_ws/* but nothing changed.
It works only without using the token parameter at all.
Websphere version 9.0 is installed in our RHEL 8.3 OS .
Now in that i have deployed one web app - .war file which contains multiple modules - webservice, web module etc.
This war is successfully deployed and i am able to start it also going to Websphere Enterprise Applications - AppName - START.
The app gets started with a success message.
Now the problem lies ahead. Our application requires a certain file bootstrap.properties.
This file has several configurations like jdbc params, jmx ports, jms configurations, jvm arguments, logging paths etc.
Once the web module of this app is run on <SERVER_IP>:9080/Context url, it throws error on GUI saying Unable to locate bootstrap.properties.
Analysing at the code level , found out that below code is throwing this error:
private static Properties config;
private static final String CONFIG_ROOT = System.getProperty("bootstrap.system.propertiespath");
private static final String configFile = "bootstrap.properties";
private JMXConfig() {
}
public static String getConfigRoot() {
if (CONFIG_ROOT == null) {
System.err.println("Not able to locate bootstrap.properties. Please configure bootstrap.system.propertiespath property.");
throw new ConfigException("Unable to locate bootstrap.properties.");
} else {
return CONFIG_ROOT + File.separator;
}
}
I wanted to know where can we specify the absolute paths in the websphere console where our property file can be read as a system argument once the application is loaded.
Since you're using System.getProperty() to read the property, it needs to be specified as a Java system property passed into the JVM. You can do that from the JVM config panel, adding it as either a custom property on the JVM or as a -D option in the server's generic JVM arguments.
Custom property: https://www.ibm.com/docs/en/was/9.0.5?topic=jvm-java-virtual-machine-custom-properties
Generic JVM argument: https://www.ibm.com/docs/en/was/9.0.5?topic=jvm-java-virtual-machine-settings (search for "Generic JVM arguments")
Note that if you use a custom property, you would simply set the "name" field to "bootstrap.system.propertiespath" and the "value" to the path you need; if you use a generic JVM argument, you'd add an argument with the structure "-Dbootstrap.system.propertiespath=/path/to/file".
I'm building a Play! Framework (2.5) Java application and I want to connect it to ElasticSearch using Ebean.
First, I followed the steps here and successfully connected to a dummy jdbc (Added plugin, modified build.sbt, added ebean.default="models.*", default.driver = org.h2.Driver, and default.url = "jdbc:h2:mem:play" to application.conf). So far so good.
Now, I want to switch my connection to ElasticSearch instead of jdbc, so I'm following the steps here, but I can't figure it out for the life of me. What I've done so far:
Added to build.sbt:
libraryDependencies ++= Seq( "org.avaje.ebeanorm" % "avaje-ebeanorm-elastic" % "1.3.1" )
Added to application.conf:
ebean.docstore.url="http://localhost:9200"
ebean.docstore.active=true
ebean.docstore.generateMapping=true
ebean.docstore.dropCreate=true`
Removed from application.conf
default.driver = org.h2.Driver
default.url = "jdbc:h2:mem:play"
I cannot get this code to run, because I keep getting this error:
RuntimeException: com.typesafe.config.ConfigException$WrongType: application.conf # file:/C:/Users/../conf/application.conf: 357-360: docstore has type OBJECT rather than LIST
I would greatly appreciate any pointers in the right direction. Thanks!
You can either :
Override your ebean configuration programmaticaly
Add your configuration in a ebean property file
1 - Programmatically
package models;
import com.avaje.ebean.config.ServerConfig;
import com.avaje.ebean.event.ServerConfigStartup;
public class ConfigOverride implements ServerConfigStartup {
public void onStart(ServerConfig serverConfig) {
serverConfig.getDocStoreConfig().setUrl("http://localhost:9200");
serverConfig.getDocStoreConfig().setActive(true);
serverConfig.getDocStoreConfig().setGenerateMapping(false);
serverConfig.getDocStoreConfig().setDropCreate(false);
serverConfig.getDocStoreConfig().setCreate(false);
serverConfig.getDocStoreConfig().setPathToResources("conf");
}
}
2 - Configuration
You have to put your ebean.docstore properties in a ebean.properties in conf directory. But unfortunatly, I didn't manage to make the application work in stage mode
Source: https://raw.githubusercontent.com/playframework/play-ebean/master/docs/manual/working/javaGuide/main/sql/JavaEbean.md
FYI : I opened an issue here :
https://github.com/playframework/play-ebean/issues/104
Issue: Trying to build the correct XPATH using SpEL xpath to correlate on a the "Name" tag value where the root tag has a namespace but no prefix.
Error: Unexpected token. Expected 'rparen())' but was 'identifier'
It's complaining about & #39; where I am trying to make a single quote for the xpath evaluation.
XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root xmlns="http://www.foo.com">
<id></id>
<Name>test</Name>
</root>
Spring Config
<aggregator
id="agg1"
input-channel="requestChannel"
output-channel="outputChannel"
discard-channel="garbageCanChannel"
ref="blah"
method="combine"
expire-groups-upon-completion="true"
correlation-strategy-expression="#xpath(payload, '//*[local-name()]='Name'/text()')"
release-strategy="blah"
release-strategy-method="timeToRelease"
send-partial-result-on-expiry="false"
send-timeout="60000"
group-timeout="60000"
/>
Update:
So after downloading spring source and tracing the issue. It's seem that during the tokenization execution in the method below, Spring is treating the "Name" as a identifier instead of as part of the string literal. At least this is the difference between a working instance and a failing instance.Most likely i'm not escaping it correctly.
Class:InternalSpelExpressionParser.java
Method:doParseExpression
this.expressionString = "#xpath(payload, '//*[local-name()=Name]')"//This works
[[HASH(#)](0,1), [IDENTIFIER:xpath](1,6), [LPAREN(()](6,7), [IDENTIFIER:payload](7,14), [COMMA(,)](14,15), [LITERAL_STRING:'//*[local-name()=Name]'](16,45), [RPAREN())](45,46)]
this.expressionString = "#xpath(payload, '//*[local-name()='Name']')"//Thisfails
[[HASH(#)](0,1), [IDENTIFIER:xpath](1,6), [LPAREN(()](6,7), [IDENTIFIER:payload](7,14), [COMMA(,)](14,15), [LITERAL_STRING:'//*[local-name()='](16,35), [IDENTIFIER:Name](35,44), [LITERAL_STRING:']'](44,47), [RPAREN())](47,48)]
Solution:
...
correlation-strategy-expression="#xpath(payload, '//*[local-name()=''Name'']/text()')"
Correct String Literal:
-You can see that it is now correct because the tokenization process is putting everything within the string literal token.
[[HASH(#)](0,1), [IDENTIFIER:xpath](1,6), [LPAREN(()](6,7), [IDENTIFIER:payload](7,14), [COMMA(,)](14,15), [LITERAL_STRING:'//*[local-name()=''Name'']/text()'](16,56), [RPAREN())](56,57)]
Additional Debug Notes:
When pulling out the spring git here:
https://github.com/spring-projects/spring-framework
Take all of the projects.
At the root is "import=into-eclipse.bat" or "import-into-idea" that I did not see. You can execute that to fully build and check-out everything you need locally and import the projects so you can trace a issue.
Your expression as posted will produces invalid XPath. It should have closing square bracket just before /text() instead :
'//*[local-name()='Name']/text()'
Or maybe using double single-quotes to escape, as suggested here :
'//*[local-name()=''Name'']/text()'
I'm trying to create a Vagrant setup using CentOS 6.4 and Apache 1.3 (this is for a legacy application). I am using Puppet (though if an answer in Chef is easier, I'd be happy to use it) and the Puppetlabs Apache class. The issue I'm having is that it installs Apache 2.2, but I don't see how to make it install Apache 1.3 instead.
What am I doing wrong and how can I do it right? (Answers of "Upgrade your app" will be downvoted - I don't have the authority to make that decision.)
The module you're using doesn't explicitly expose a parameter to specify which version of the httpd package you want to install.
Instead of using Puppetlabs module, you could use the Apache module from Alessandro Franceschi (source here - also on the forge)). If the package you need to install has a different name than httpd, the module exposes a package parameter which you can override like this:
class { 'apache':
package => 'apache13',
}
If, instead, Apache 1.3 is provided by the same httpd package by declaring the specific version you want, you can rely on the version parameter:
class { 'apache':
version => '1.3.39',
}
Clearly, you can also combine the two parameters together.
using those modules return the following error on Redhat:
Error 400 on SERVER: Illegal expression.
A Type-Name is unacceptable as function name in a Function Call at /etc/puppet/modules/apache/man.