LocalTransportSender not found when using web services - java

I am not a big fan of web services, but sometimes you have to conform with a client interface. I have successfully generated code from the the provided WSDLs, but when I try and run the application which actually uses the generated classes, I get the following:
java.lang.ClassNotFoundException: org.apache.axis2.transport.local.LocalTransportSender
I am keeping the generated code in a separate project and have the following dependencies in my pom:
<dependencies>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
As stated, the jar gets generated without any issues, but when it is includes in the application that makes use of it, I get the said exception.
Any ideas?

Adding below dependency would probably should solve this problem.
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>1.6.2</version>
</dependency>

Use next dependencies , and you should not have any problem
For api axis 2
axis2-adb
For runtime
axis2-transport-local
Laxis2-transport-http

Related

No Such Method Error exception thrown while using OK Http 3 with IPinfo?

I'm running the Java client library from IP Info. When I try to executing the code:
IPinfo ipInfo = new IPinfo.Builder().setToken(apiKey).build();
IPResponse response = ipInfo.lookupIP(ipAddress);
I get a java.lang.NoSuchMethodError: okhttp3.Response.close()V exception.
I tried explicitly changing the version of OK Http 3 from 5.0.0-alpha.2 to 5.0.0-alpha.1 to 4.9.0 (tried many other versions too) but they all yield the same error.
What is causing this error? Which version should I use to gain access to the said method?
My POM file has the following dependencies:
<dependencies>
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>8.40.14</version>
</dependency>
<dependency>
<groupId>co.ipdata.client</groupId>
<artifactId>ipdata-java-client</artifactId>
<version>0.2.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
</dependency>
<dependency>
<groupId>io.ipinfo</groupId>
<artifactId>ipinfo-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
</dependency>
UPDATE:
Perhaps more intriguing, I noticed that when I open the said line with error in Eclipse
at io.ipinfo.api.request.IPRequest.handle(IPRequest.java:34)
It points to Line 34 in io.ipinfo.api.request; but there's absolutely no code on that line at all. The line simply contains the end of a curly brackets. See screenshot below:
Thanks to everyone for all the suggestions and input! I finally found the answer myself..
It turns out that this project dependent on a different project which included the following maven dependencies:
<dependency>
<groupId>com.squareup.retrofit</groupId>
<artifactId>retrofit</artifactId>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>okhttp</artifactId>
<version>2.7.5</version>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>retrofit</artifactId>
<version>2.0.2</version>
</dependency>
I deleted those Maven dependencies and now everything works as expected.

NoSuchMethodError: What version of Apache Xml Security do I need?

I was getting this exception
java.lang.NoSuchMethodError: org.apache.xml.security.utils.XMLUtils.decode
Then I updated my dependencies and moved on to another similar exception which I am unable to resolve for quite a while:
I am getting NoSuchMethodError when my module receives the request upon calling this method
WebServiceTemplate client = ...;
client.marshalSendAndReceive(req, new ActionCallback("http://samples/RequestOrder"));
it throws
java.lang.NoSuchMethodError: org.apache.xml.security.encryption.AbstractSerializer: method <init>()V not found
at org.apache.cxf.ws.security.wss4j.StaxSerializer.<init>(StaxSerializer.java:62)
the (at least I think) relevant part of my dependencies
<dependency>
<groupId>org.apache.ws.security</groupId>
<artifactId>wss4j</artifactId>
<version>1.6.15</version>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-security</artifactId>
<version>3.0.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>3.3.6</version>
</dependency>
I was looking at multiple versions of org.apache.xml.security.encryption and it doesn't look like any of those versions have such method. Any idea what would be the correct combination of versions?
as a sidenote I also found this library and thought that would be helpful , but it seems it is somewhat different than aforementioned <groupId>org.apache.ws.security</groupId>
<dependency>
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j</artifactId>
<version>2.3.0</version>
<type>pom</type>
</dependency>
I had similar issue and tried possible solutions online but to no avail.
Some of the documents suggested that dependency mismatch with other dependencies is key, like here.
In relation to this exact reported error, I kept on changing the version of the below dependency and finally reached this, which was the latest version as at the time this answer was posted.
<dependency>
<groupId>org.apache.santuario</groupId>
<artifactId>xmlsec</artifactId>
<version>2.1.4</version>
</dependency>
But remember to ensure that if you have the below dependency, exclude that of xmlsec :
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-security</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.santuario</groupId>
<artifactId>xmlsec</artifactId>
</exclusion>
</exclusions>
</dependency>

Integrate Swagger with Dropwizard, not able to produce the swagger.json file

I have done the following steps:
I have a existing drop-wizard project setup [0.8 version].
Added dependence
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-jaxrs_2.10</artifactId>
<version>1.3.12</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-core</artifactId>
<version>1.5.1-M2</version>
</dependency>
I have added the #Api annotations to my resource file.
I have added the following code to the application run class:
environment.jersey().register(new ApiListingResource());
BeanConfig config = new BeanConfig();
config.setTitle("default Application");
config.setVersion("1.0.0");
config.setResourcePackage("com.class.where.the.api.annotation.are");
config.setScan(true);
The problem is when I run the application I can't get the swagger.json by going to http://localhost:8080/swagger.json.
pretty much follow the example here: https://github.com/swagger-api/swagger-core/tree/master/samples/java-dropwizard
Does anyone know what the problem is? What else do I need to setup? [The application runs and start up fine, I just can't get to that swagger.json file]
You're using conflicting and incomplete dependencies. If you take a look at the https://github.com/swagger-api/swagger-samples/tree/master/java/java-dropwizard sample, you'll see that you actually need to include:
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-jersey2-jaxrs</artifactId>
<version>1.5.1-M1</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>com.sun.jersey</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
and only that (no swagger-core directly). If you do follow that with a similar configuration to what you have, it should work fine.

difference between org.apache.hbase -hbase and -hbase-client

I'm working with project that uses HBase and need to use some API for both working with data (Put and other classes) and schema(HTable, HColumn etc). I found two maven dependencies to work with it:
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
</dependency>
and
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase</artifactId>
</dependency>
They both have similar classes, so what library should I use and what is difference between them?

Writing Maven Dependency for javax.persistence

Can someone help me write the dependency for javax.persistence. I have googled it but nothing worked.
I bumped into this page that gives some details on how to write the dependency, but yet i am unable to write it. Can someone help me out?
This is the one for javax.persistence:
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
and this is for the whole Java EE 6 stack:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
Edit
Note that I specified a provided scope here, which means that your dependency is available at compile- and test-time, but will not be packaged into your artifacts. This is usually needed if you want to deploy your artifacts in an application server, since they provide their own implementation of the api.
And add this dependency in your pom.xml:
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
</dependency>
That "Coping with Sun JARs" page might be a little outdated, this JAR is available in the Maven Central Repository
Updated link:
https://mvnrepository.com/artifact/javax.persistence/javax.persistence-api/2.2 is here.
and the maven dependency is as below:
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
For the latest versions javax.persistance is not working instead of that we can use jakarta.persistence to create an entity or resolve the error Cannot resolve symbol 'Entity'. For that need to add the dependency
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>6.1.6.Final</version>
<type>pom</type>
</dependency>

Categories

Resources