Locally working web-app throws VerifyError on GAE - java

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

Related

Use of Java Smack 4.3.4 in a JUnit Testcase in Maven

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.

Java Axis2 IllegalStateException in generated client stub

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.

QuickBooks Enterprise Desktop Integration with Java

I am facing issue related to connecting with Quickbooks Desktop version(Intuit QuickBooks Enterprise Solutions 14.0) using Quickbooks SDK.
I need to develop a java application to post the data of Invoices in Quickbooks Desktop version. I have installed Quickbooks SDK (https://developer.intuit.com/docs/0250_ … _downloads) but not able to connect with SDK using java program.
Please let me know how to get the available libraries for java and QBFC com. Also the document for those library.
We are using QBFC and not able to find QBFC library in the SDK which can be used in the java code but we found QBFC installer. How can it be used.
We have also written a code to call the methods that are available in SDK. Initially, we are trying to call authenticate method. The code is as following :
public static void main(String[] args) throws ServiceException, MalformedURLException {
qbConnector m = new qbConnector();
com.intuit.developer.QBWebConnectorSvcSoap a = m.callQB();
try {
System.out.println(a);
a.authenticate("qbadmin","123456");
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public com.intuit.developer.QBWebConnectorSvcSoap callQB() throws ServiceException, MalformedURLException{
URL url = new URL("https://sandbox-qbsoapserver.cs21.force.com/services/Soap/class/QBSoapServer");
return getQBWebConnectorSvcSoap(url);
}
We are getting the following error :
null
Exception in thread "main" java.lang.NullPointerException
at com.intuit.developer.qbConnector.main(qbConnector.java:42)
Line 42 in the code - a.authenticate("qbadmin","123456")
Thanks in advance.
I'd look into using QODBC to interface with Quickbooks. It allows you to treat QB's XML data like database tables. I used it with VB and it was so much easier than trying to figure out the QBs documentation. One caveat, however, you may have to have an instance of QBs running in order to connect to it.
Java & QODBC

Google Cloud Endpoints EOFException

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

"org.apache.axis2.AxisFault: unknown" when calling web service with Java

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.

Categories

Resources