I'm using Axis2 v1.6.3 to consume https://advertising.criteo.com/API/v201010/AdvertiserService.asmx?WSDL .
Everything works ok for many of the requests, but when trying to call getAccount, an exception is risen in the generated client.
The exception propagated is a NullPointerException caused when calling (in the generated stub) _messageContext.getTransportOut().
However, digging further, the problem seems to be due to an IllegalStateException thrown by XMLStreamReader.next when executing toOM for the envelope.
The (slightly modified) stack trace is:
java.lang.IllegalStateException
at org.apache.xmlbeans.impl.store.Jsr173$XMLStreamReaderForString.next(Jsr173.java:1110)
at org.apache.xmlbeans.impl.store.Jsr173$SyncedJsr173.next(Jsr173.java:1138)
at ----.CriteoStub.toOM(CriteoStub.java:2390)
at ----.CriteoStub.toOM(CriteoStub.java:2379)
at ----.CriteoStub.toEnvelope(CriteoStub.java:3657)
at ----.CriteoStub.getAccount(CriteoStub.java:703)
The generated code is:
private org.apache.axiom.om.OMElement toOM(final com.criteo.advertising.api.v201010.GetAccountDocument param)
throws org.apache.axis2.AxisFault {
final javax.xml.stream.XMLStreamReader xmlReader = param.newXMLStreamReader();
while (!xmlReader.isStartElement()) {
try {
xmlReader.next(); //<---------- here is the exception risen
} catch (javax.xml.stream.XMLStreamException e) {
throw org.apache.axis2.AxisFault.makeFault(e);
}
}
//...
And, in my case, param content is:
<xml-fragment/>
Google shows related issues in the past, but nothing current and no solution.
Any clue on how to solve this issue?
In my case the problem was caused by the fact that we were using a version for axis2-wsdl2code-maven-plugin different from the axis2 library.
Changing the axis2-wsdl2code-maven-plugin version to 1.6.3 solved the issue.
Related
I am working on a Java library with some services based on xmpp. For XMPP communication, I use Smack version 4.3.4. The development has so far been without problems and I have also created some test routines that can all be run without errors. After I migrated to a Maven project to generate a FatJar, I wanted to convert the executable test cases into JUnit tests. Unexpectedly, an error occurs, the reason of which I cannot explain. As I said, the code can be run outside of JUnit without any problems.
Below is the simplified test code (establishing a connection to the xmpp server):
#Test
public void connect()
{
Builder builder = XMPPTCPConnectionConfiguration.builder();
builder.setSecurityMode(SecurityMode.disabled);
builder.setUsernameAndPassword("iec61850client", "iec61850client");
builder.setPort(5222);
builder.setSendPresence(true);
try
{
builder.setXmppDomain("127.0.0.1");
builder.setHostAddress(InetAddress.getByName("127.0.0.1"));
}
catch (Exception e)
{
e.printStackTrace();
}
XMPPTCPConnectionConfiguration config = builder.build();
XMPPTCPConnection c = new XMPPTCPConnection(config);
c.setReplyTimeout(5000);
try
{
c.connect().login();
}
catch (Exception e)
{
e.printStackTrace();
}
}
And here is the error message I get:
Exception in thread "Smack Reader (0)" java.lang.AssertionError
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1154)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$1000(XMPPTCPConnection.java:1092)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:1112)
In Smack it boils down to this 'assert' instruction:
assert (config.getXMPPServiceDomain().equals(reportedServerDomain));
Any idea what the problem might be or similar problems? I'm grateful for any help!
Thanks a lot,
Markus
If you look at the source code you will find that reportedServerDomain is extracted from the server's stream open tag. In this case the xmpp domain reported by the server does not match the one that is configured. This should usually not happen, but I assume it is related to the way you run the unit tests. Or more precisely, related to the remote server or mocked server that is used in the tests. If you enable smack's debug output, you will see the stream open tag and the 'from' attribute and its value. Compare this with the configured XMPP service domain in the ConnectionConfiguration.
I'm having problems migrating my application form spring-integration 4.0.4 to the recent 4.1.0 release.
Once replacing the jars, my integration context throws an exception for each <recipient-list-router/> tag.
The thrown exception is a java.lang.ClassCastException the message is:
Caused by: java.lang.ClassCastException: com.sun.proxy.$Proxy62 cannot be cast to org.springframework.integration.context.IntegrationObjectSupport
at org.springframework.config.AbstractSimpleMessageHandlerFactoryBean.createHandlerInternal(AbstractSimpleMessageHandlerFactoryBean.java:130)
at org.springframework.integration.config.AbstractSimpleMessageHandlerFactoryBean.getObject(AbstractSimpleMessageHandlerFactoryBean.java:102)
at org.springframework.integration.config.AbstractSimpleMessageHandlerFactoryBean.getObject(AbstractSimpleMessageHandlerFactoryBean.java:44)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanReagistrySupport.java:168)
... 20 more
I am using Spring-Integration 4.1.0.RELEASE, spring-core 4.1.2.RELEASE, and running on jdk1.8.0_05.
My Integration beans context contains two <recipient-list-router/> tags, which upon removal, do not throw this error.
The code from AbstractSimpleMessageHandlerFactoryBean says:
else if(!(this.handler instanceof AbstractReplyProducingMessageHandler)) {
if (logger.isDebugEnabled()) {
logger.debug("adviceChain can only be set to AbstractReplyProducingMessageHandler or its subclass, "
+ ((IntegrationObjectSupport) this.handler).getComponentName() + " doesn't support it.");
}
}
So, let's switch of debug for the org.springframework.integration category!
From other side I agree that it is a bug, because if our messageHandler is a Proxy we can't simply cast it to the IntegrationObjectSupport.
So, feel free to raise a JIRA ticket on the matter.
From other side it isn't clear why removal of <recipient-list-router/> evict an issue...
Because <recipient-list-router/> doesn't support <request-handler-advice-chain>.
I agree that we have introduced in the 4.1 the RecipientListRouterManagement and if you use JMX the special MBean will be registered for the RecipientListRouter and the last one becomes Proxy, but it isn't clrear how that proxying relates to the request-handler-advice-chain log message...
Would be great if you can debug for that line from AbstractSimpleMessageHandlerFactoryBean and show us the real object for that Proxy.
And show, please, more StackTrace . Maybe we can see more context to figure out the root of cause.
Thank you!
I have the method below in AppEngine:
#ApiMethod(name = "authed", path = "greeting/authed")
public HelloGreeting authedGreeting(User user) {
...
}
My doInBackground method in Android AsyncTask:
HelloGreeting hg = null;
try {
hg = service.authed().execute();
} catch (IOException e) {
Log.d("error", e.getMessage(), e);
}
return hg;
I encountered the ff error:
/_ah/api/.../v1/greeting/authed: java.io.EOFException
In logcat:
Problem accessing /_ah/api/.../v1/greeting/authed. Reason: INTERNAL_SERVER_ERROR
at java.util.zip.GZIPInputStream.readUByte
at java.util.zip.GZIPInputStream.readUShort
at java.util.zip.GZIPInputStream.readUShort
It only work when calling non-auth method. How to fix it?
Im using the local server.
I was running into a similar problem with when making a call for inserting values. Mine differs slightly because I am not using authentication, however I was getting the same exception. I am using appengine-java-sdk-1.8.8. I was able to make other endpoint calls having this error. I looked at the generated code and the difference that I saw with the working calls versus the non-working calls, was the HttpMethod. The failing call was defined as "POST". I was able to change this using the annotation attribute httpMethod=ApiMethod.HttpMethod.GET in the #ApiMethod annotation.
#ApiMethod(httpMethod = ApiMethod.HttpMethod.GET, name = "insertUserArtist", path = "insertUserArtist")
I then regenerated the client code and I was able to make the call without getting the dreaded EOFException. I am not sure why POST doesn't work properly but changing it to GET worked. This does possibly present some questions on how much data can be sent across and should be addressed (possibly a library issue). I am going to look into creating a demonstration app to submit to Google.
If you passed an "entity" object, then the POST will work. If you are passing primitive data type, you'll be stuck with using HttpMethod.GET.
If you are running on the local dev server,
then add the following snippet in MyApi.Builder to set it up properly after setting root url.
.setGoogleClientRequestInitializer(new GoogleClientRequestInitializer() {
#Override
public void initialize(AbstractGoogleClientRequest<?> abstractGoogleClientRequest) throws IOException {
abstractGoogleClientRequest.setDisableGZipContent(true);
}
})
Source: https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/HelloEndpoints
my web-app based on GWT uses scala-compiler.jar (2.10.3) on its server-side to provide on the fly compiling and executing of Scala code which a user inputs in his/her browser.
It's working fine locally uder GAE SDK 1.8.4 -- when I call service method and pass some trivial script it compiles, executes and logs the resulting string "Hello, Adeal!":
final Object o = AdalModuleEval.eval("class C { override def toString = \"Hello, Adeal!\" }; new C()");
log.warning(o.toString());
But after deploying to Google App Engine server the same code throws me:
exception: java.lang.VerifyError: Bad type on operand stack in method sun.reflect.generics.repository.ClassRepository.getSuperclass()Ljava/lang/reflect/Type; at offset 1
Full stack trace you can see here
It's really disappointing and I'd very appreciate any suggestions about how to resolve this issue.
Thanks in advance,
Alex
You probably solved that or this below is not your case, but for me it was a method catching exceptions like this:
try {
...
} catch (ServiceException | IOException e) {
e.printStackTrace();
}
Once I put a single Exception in every catch everything worked properly
I'm trying to call a web service with a Java client. The WSDL looks like this: http://pastebin.com/m13124ba
My client:
public class Client{
public static void main(java.lang.String args[]){
try{
CompileAndExecuteServiceInterfaceStub stub =
new CompileAndExecuteServiceInterfaceStub
("http://192.168.1.3:8080/axis2/services/CompileAndExecuteServiceInterface");
Compile comp = new Compile();
comp.setArgs0("Test");
comp.setArgs1("public class Test { public static void main(String[] args) { System.out.println(\"Hello\");}}");
String[] classpath = {};
comp.setArgs2(classpath);
stub.compile(comp);
} catch(Exception e){
e.printStackTrace();
}
}
}
When I run the client now the following error occurs:
org.apache.axis2.AxisFault: unknown
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:517)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:371)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at de.dax.compileandexecuteclient.CompileAndExecuteServiceInterfaceStub.compile(CompileAndExecuteServiceInterfaceStub.java:184)
at de.dax.compileandexecuteclient.Client.main(Client.java:17)</blockquote>
I tried out the business logic of the server on my local machine and there it works. The service creates files and folders. Are web services allowed to do that? I also wrote a simple "Hello World" web service and deployed it to the server. This worked fine.
When you get one of these "unknown" AxisFaults, definitely check the server log! The client-side stack trace most likely will not be detailed enough for you to track down the error.
I believe dax is indicating above that he found the NullPointerException in the more-detailed server side stack trace. It would look something like:
org.apache.axis2.AxisFault
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
[....]
Caused by: java.lang.NullPointerException
[....]
From the provided logs, I cannot determine what's wrong. Try to set the log-level of Axis2 to "debug" (see the two log-configurations in the root directory of your Axis2 installation) and check the details for the exact cause. Axis2 tends to be a bit sparse in propagating the errors coming from webservices.
The problem was that there was an NullPointerException in my service.