Unable to locate ListOrderedMap? - java

I have included all the 6 jars (beanutils, lang, logging, collections, ezmorph, json-lib). Its working fine in simple struts application. But in my struts application, although I have included all jar files, its shows a NoClassDefFoundError about ListOrderedMap.
I don't know how to make my app know that class. But I have included like other required jars for different functionality.
Please help me to resolve this issue.

Class ListOrderedMap is part of Apache Commons Collections (since version 3.0).
To be able to use it, you must have the JAR file that contains it on the classpath. The JAR file is most likely named commons-collections-3.2.1.jar (or something similar).
If you are creating a web application packaged in a WAR file, then you should put the library in the WEB-INF/lib folder inside the WAR file.

Yes, even tho there is NOW a newer v4.x for commons-collections, the 4.x do NOT work!
So, get the older highest version from v3.x, namely: v3.2.1
If you're using maven, like I am, here's my complete working dependencies list:
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<!-- <classifier>jdk15</classifier> -->
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>net.sf.ezmorph</groupId>
<artifactId>ezmorph</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>1.2.5</version>
</dependency>

Related

How to fix ClassCastException when using jaxb dependency

I am developing jira server plugin which uses a 3rd party library which contains jaxb as a runtime dependency. Following is the pom xml file of that 3rd party library
<dependencies>
<dependency>
<groupId>org.threeten</groupId>
<artifactId>threetenbp</artifactId>
<version>1.3.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.gsonfire</groupId>
<artifactId>gson-fire</artifactId>
<version>1.8.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.12</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.20</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
<scope>compile</scope>
</dependency>
And also a jaxb version (v2.3.0) is available in the jira server runtime. I am getting the following error
ClassCastException: attempting to cast jar:file:/C:/JiraServer/Jira%20Software/Atlassian/Jira/atlassian-jira/WEB-INF/lib/jaxb-api-2.3.0.jar!/javax/xml/bind/JAXBContext.class to
bundle://252.0:18/javax/xml/bind/JAXBContext.class. Please make sure that you are specifying the proper ClassLoader.
I tried to exclude the jaxb from the 3rd party library that I am using, but it did not worked for me. Can someone please advice how to resolve this issue.
Thanks!
Mifraz

Maven is behaving differently on diffrent system with same pom configuration

I am working on project with my friends in which there are lot of dependencies which are required by lot of modules.
Scenario is like this :-
i am using datastax drivers for apache_cassandra and spark_cassandra_connector which requires different versions of io.netty modules.
spark_cassandra_connector requires cassandra-driver-core which i am already using in my project.
First problem arrived on my friend's laptop which was some netty-epoll error that it didn't find some method although mine was working fine without any error.(same pom.xml)
After working on error we found out there were different versions of io.netty which was used by project dependencies which may be causing the error.
so we used global version of io.netty modules that is :-
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>${netty.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>${netty.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
That Problem was fixed .
Now same method not found error is happening in my friends laptop with cassandra-driver-core . so we decided to use cassandra drivers globally
that is :-
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>${netty.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-</artifactId>
<version>${netty.version}</version>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>${cassandra-driver.version}</version>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-extras</artifactId>
<version>${cassandra-driver.version}</version>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-mapping</artifactId>
<version>${cassandra-driver.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
which is not working.
i have tried excluding cassandra-driver-core from spark connectors
<dependency>
<groupId>com.datastax.spark</groupId>
<artifactId>spark-cassandra-connector-java_2.10</artifactId>
<version>${spark.version}</version>
<exclusions>
<exclusion>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-mapping</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.datastax.spark</groupId>
<artifactId>spark-cassandra-connector_2.10</artifactId>
<version>${spark.version}</version>
<exclusions>
<exclusion>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
</exclusion>
</exclusions>
</dependency>
which also didn't work and this problem is happening on friends system not mine.
is there any thing i need to know about maven or does any body knows why it is happening version i am using has that method.
why other system is not picking up that version or overriding other version which is used by spark module.
i have checked dependency tree on both systems in verbose which shows the same output (in case maven is picking up another version on other system but which is not case also)
i have tried cleaning the .m2 folder on other system which also didn't work.
what can be the solution ??

How do I resolve org.apache.http.ssl with AEM?

Ultimately, I'm trying to use AWS S3 libraries in Java code to enable server-side S3 uploads with AEM, but I'm running into problems just getting the dependencies installed and/or recognized by AEM. Every time I add a new dependency, five more issues pop up.
In this bundle I'm attempting to build, This is the error I'm seeing:
The instructions in my pom.xml are this:
<instructions>
<Embed-Transitive>true</Embed-Transitive>
<Export-Package>
com.amazonaws.HttpMethod,
com.amazonaws.services.s3.*
</Export-Package>
<Embed-Dependency>
gson,
aws-java-sdk-s3,
aws-java-sdk-core,
aws-java-sdk-kms,
jackson-core,
jackson-databind,
jackson-annotations,
jackson-dataformat-cbor,
ion-java,
httpclient,
brooklyn-karaf-httpcomponents-extension
</Embed-Dependency>
</instructions>
I did some googling and found this:
https://mvnrepository.com/artifact/org.apache.brooklyn/brooklyn-karaf-httpcomponents-extension/0.11.0-20170403.1534
I thought that this dependency would fix my problem, so I put it into my list of dependencies, but the package still shows up in red.
All of my dependencies:
<dependencies>
<!-- OSGi Dependencies -->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr</artifactId>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
</dependency>
<dependency>
<groupId>biz.aQute</groupId>
<artifactId>bndlib</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
</dependency>
<!-- Other Dependencies -->
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>aem-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.models.api</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-s3 -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>1.11.115</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-core -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<version>1.11.115</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-kms -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-kms</artifactId>
<version>1.11.115</version>
</dependency>
<!-- https://mvnrepository.com/artifact/joda-time/joda-time -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit-addons</groupId>
<artifactId>junit-addons</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.6.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.6.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-cbor -->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-cbor</artifactId>
<version>2.6.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/software.amazon.ion/ion-java -->
<dependency>
<groupId>software.amazon.ion</groupId>
<artifactId>ion-java</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.brooklyn/brooklyn-karaf-httpcomponents-extension -->
<dependency>
<groupId>org.apache.brooklyn</groupId>
<artifactId>brooklyn-karaf-httpcomponents-extension</artifactId>
<version>0.11.0-20170403.1534</version>
</dependency>
</dependencies>
The easiest way to install AWS dependencies in your AEM instance is to use the official AEM Oak S3 connector which is available from Adobe's public repository. This is also assuming that you are not using S3 datastore in your instance otherwise all of these files and Jars would already be there. For the sake of this answer, I'll refer to v1.4.8. You can see more details on installing and configuring S3 datastore over here however, this answer is not focusing on S3 data store configuration, it's just there to provide all the libraries in your instance.
This approach is recommended as it keeps your AEM instance compatible with Adobe's AEM official hotfixes and service packs which normally use older versions of AWS SDK as compared to ones available from AWS Developer site.
To install the AWS S3 libraries, do the following steps:
Download the latest com.adobe.granite.oak.s3connector-.zip from the repository.
Unpack the zip into a temporary folder.
From your temporary folder, copy all the files under jcr_root/libs/system/install to `crx-quickstart/install' folder. You should see some folders named as 1,5,15. If you examine these, they contain several jar files including the AWS SDK.
DO NOT copy the config files as they will setup your AEM instance to connect to S3 data store which is NOT what you want at this stage.
Start/restart your instance and wait for it to complete.
To verify that you have all the files:
Goto /system/console/bundles.
Check that AWS SDK For Java for OSGicom.amazonaws.aws-java-sdk-osgi is active.
Click on this bundle and see all the imports and exports which will include the libraries you need for your code to work.
Following this approach ensures that your existing datastore is preserved and AEM compatible AWS SDK is properly installed in your system.
it is dependency issue with your "httpclient" dependency.. you should try lower version of httpclient.
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
use : 4.5.2 or below, and do not use any beta or redhat version

from java objects to parquet file

I have a json file and want to convert it to parquet file.
I know how to convert from json file to java objects but still need the conversion from java objects to parquet file.
I don't want to convert using AVRO/ Protocol Buffers/Thrift/etc.. and also, don't want to use the Apache drill- just a java code.
Im using Java project with maven, my pom.xml look like this:
<dependencies>
<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-common</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-encoding</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-column</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-hadoop</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>0.20.2</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.2.0</version>
</dependency>
</dependencies>
Means I don't have a problem using hadoop.
So I found this link (the last comment):
https://groups.google.com/forum/#!topic/parquet-dev/lfWanFOc040
The above link has what I want, but I have a problem with 2 imports there and can't find the correct dependencies for them.
Those are the 2 imports I can't find:
import org.apache.hadoop.hive.ql.io.parquet.writable.BinaryWritable;
import org.apache.hadoop.hive.ql.io.parquet.write.DataWritableWriteSupport;
will appreciate your help for finding the dependencies.
THANX:)
OK I found the answer:
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-exec</artifactId>
<version>0.13.0</version>
</dependency>
enjoy!

Replacing JWSDP jar files with up-to-date equivalents from Maven repo

I inherited an old project that uses JWSDP, and would like to upgrade it to Maven 2 and Java 6.
The project uses the following JWSDP jar files:
jwsdp-jax-qname-1.5.jar
jwsdp-jaxrpc-api-1.5.jar
jwsdp-jaxrpc-impl-1.5-patched-1.10.jar
jwsdp-jaxrpc-spi-1.5.jar
jwsdp-namespace-1.5.jar
jwsdp-relaxngDatatype-1.5.jar
jwsdp-saaj-api-1.5.jar
jwsdp-saaj-impl-1.5.jar
jwsdp-xalan-1.5.jar
jwsdp-xercesImpl-1.5.jar
jwsdp-xsdlib-1.5.jar
As far as I understand, the up-to-date equivalents for these jars should be part of Glassfish , but which ones exactly do I need, and are they available in a Maven 2 repository?
If you just want to upgrade to the JWSPD 1.6 versions of the given artifacts, you'll need the following dependencies (that you can find in http://mvnrepository.com/):
<dependencies>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jax-qname</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxrpc-api</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxb-impl</artifactId>
<version>1.0.5</version>
</dependency>
<dependency>
<groupId>com.sun.xml.rpc</groupId>
<artifactId>jaxrpc-spi</artifactId>
<version>1.1.3_01</version>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>namespace</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml</groupId>
<artifactId>relaxngDatatype</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>saaj-api</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>com.sun.xml</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml</groupId>
<artifactId>xsdlib</artifactId>
<version>20050614</version>
</dependency>
But note that there is no further development of JWSPD 1.6. The replacement stack is Metro which is part of GlassFish v3.

Categories

Resources