Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts
GLIBCXX_3.4.9 Could Not Be Found with Apache Spark
Saliya Ekanayake
If you encounter an error similar to the following, which complains that
GLIBCXX_3.4.9
could not be found, while running an application with Apache Spark you can avoid this by switching Spark's compression method from snappy
to something such aslzf
....
Caused by: java.lang.UnsatisfiedLinkError: .../snappy-1.0.5.3-1e2f59f6-8ea3-4c03-87fe-dcf4fa75ba6c-libsnappyjava.so: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by.../snappy-1.0.5.3-1e2f59f6-8ea3-4c03-87fe-dcf4fa75ba6c-libsnappyjava.so)
There are a few ways how one can pass configuration options to Spark. The naive way seems to be through command line as,
--conf "spark.io.compression.codec=lzf"
On a side note, you can find what GLIBC versions are available by running
strings /usr/lib/libstdc++.so.6 | grep GLIBC
References
- A mail thread on this
- Spark configuration options
Apache TCP Monitor - How To?
Saliya Ekanayake
If you are searching for a tool to monitor messages that are exchanged between a client and a server, then Apache TCPMon is one of the best easy-to-use utilities available at zero cost. You can download three different flavors of this utility, i.e. standalone, IntelliJIDEA plug-in, and Eclipse plug-in. To get an in depth knowledge on how to use this nice tool see my blog post at wso2.org.
The following blog posts too give an insight into this tool.
http://charithaka.blogspot.com/2008/08/how-to-use-tcpmon-inside-eclipse.html
http://www.keith-chapman.org/2008/07/using-tcp-monitor-to-debug-web-service.html
The following blog posts too give an insight into this tool.
http://charithaka.blogspot.com/2008/08/how-to-use-tcpmon-inside-eclipse.html
http://www.keith-chapman.org/2008/07/using-tcp-monitor-to-debug-web-service.html
XPath with Axiom
Saliya Ekanayake
Apache Axiom, which is the popular open source StAX based XML infoset model, supports XPath out of the box. If you ever want to know how to use this feature, WSO2 Oxygentank has a very nice tutorial.
The tricky part is, how to work with Namespaces? To get an idea on to the matter consider the following XML document.

The following code fragment will retrieve the ns1:c1 element and the two ns2:color attributes of each element.
// root is the document
OMElement root = builder.getDocumentElement();
AXIOMXPath xpath = new AXIOMXPath("//a:c1");
xpath.addNamespace("a", "http://namespace1.com");
OMElement c1 = (OMElement)xpath.selectSingleNode(root);
System.out.println(c1);
xpath = new AXIOMXPath("//@b:color");
xpath.addNamespace("b", "http://namespace2.com");
List colors = xpath.selectNodes(root);
System.out.println(colors.get(0).getAttributeValue());
System.out.println(colors.get(1).getAttributeValue());
The important line in this code is the xpath.addNamespace(prefix, uri) method. This prefix doesn't have to be the exact prefix used in the actual document (which in fact is not known in most cases).
That's it, have fun with Axiom :)
The tricky part is, how to work with Namespaces? To get an idea on to the matter consider the following XML document.

The following code fragment will retrieve the ns1:c1 element and the two ns2:color attributes of each element.
// root is the document
OMElement root = builder.getDocumentElement();
AXIOMXPath xpath = new AXIOMXPath("//a:c1");
xpath.addNamespace("a", "http://namespace1.com");
OMElement c1 = (OMElement)xpath.selectSingleNode(root);
System.out.println(c1);
xpath = new AXIOMXPath("//@b:color");
xpath.addNamespace("b", "http://namespace2.com");
List
System.out.println(colors.get(0).getAttributeValue());
System.out.println(colors.get(1).getAttributeValue());
The important line in this code is the xpath.addNamespace(prefix, uri) method. This prefix doesn't have to be the exact prefix used in the actual document (which in fact is not known in most cases).
That's it, have fun with Axiom :)
Subscribe to:
Posts
(
Atom
)