Cannot get Axis example to run - java

I am trying to run the Axis "getting started" example code from here:
http://ws.apache.org/axis/java/user-guide.html#BasicsGettingStarted
Other than adding a missing quote on line 15 it is the same code with some added logging. I get this error:
Transport is org.apache.axis.transport.http.HTTPTransport#4c6aacbf
Set target endpoint address
Set operation name
Enter: Call::invoke(ns, meth, args)
operation=null
Failed to set EntityResolver to null on DocumentBuilder
java.lang.NullPointerException
at weblogic.xml.jaxp.ChainingEntityResolver.popEntityResolver(ChainingEntityResolver.java:75)
at weblogic.xml.jaxp.RegistryDocumentBuilder.setEntityResolver(RegistryDocumentBuilder.java:179)
Any ideas? I saw that there was a similar question but without an answer. I am using Axis 1.3 and Weblogic 9.2.3.
Thanks

The first thing that strikes me is that the URL:
http://ws.apache.org:5049/axis/services/echo
does not seem to be available. Can you try another?

Related

Mule ESB - SMTP Subject from a variable

I'm working on a flow to send an attached file to a mail.
<smtp:outbound-endpoint host="${instance.smtp.host}" port="${instance.smtp.port}" user="${instance.smtp.user}" password="${instance.smtp.password}" responseTimeout="10000" doc:name="SMTP" connector-ref="SMTP" from="${instance.smtp.account}" to="${instance.smtp.user}" subject="Transaction ID #[flowVars.transactionId]"/>
Everything is working well, I already have tested my flow and the mails are arriving to the specified mail address, however, I'm trying to modify the subject dynamically, using a value stored in a variable, and then the problem appears, seems like it's not possible to use my expression to set the subject's mail.
subject="Transaction ID #[flowVars.transactionId]"
This is the error I'm getting.
Root Exception stack trace:
[Error: unresolvable property or identifier: Transaction]
[Near : {... Transaction ID #[flowVars.tran ....}]
^
Do you have any clue about this problem or how can I fix it?
Thanks in advance.
You need to rearrange the expression so all of it is within the #[....]
subject="#['Transaction ID ' + flowVars.transactionId]"
Some fields get parsed as MEL expressions and some are more like templated strings that allow expression substitutions.
(One of Mule's annoyances)
Please debug the application and test if your flow variable for "transactionId" is being set before reaching to the SMTP message source.

GCM Topic messaging error

I want to let my application to register for topic messaging, but each time I try to call Topic registration it is returning the error below
java.lang.IllegalArgumentException: Invalid topic name:
Using the method bellow
GcmPubSub.getInstance(context).subscribe(regToken, "/topics/testTopic", null);
I am using the tutorial on this link https://developers.google.com/cloud-messaging/topic-messaging. I will greatly appreciate your help on this error.
Please try this with the sample app. "/topics/testTopic" should be fine. As mentioned in the documentation, any topic name matching this regex should be fine: /topics/[a-zA-Z0-9-_.~%]+
For anyone running into this error: double check that you conform to the specification on the topic name: /topics/[a-zA-Z0-9-_.~%]+.
The original question actually does conform to the spec and I have no answer for why the error occurs. However another way to trigger the error is not conforming to the spec. In my case I mistakenly assumed path separator characters are allowed and used a topic like /topics/users/123 to mimic my REST API. The last slash is not allowed.

How to change Jetty settings through SparkJava? / Form too Large Exception / org.eclipse.jetty.server.Request.maxFormContentSize

I'm using SparkJava 2.2 which is using Jetty 9.0.2.
I'm getting "Form too large" exception which is thrown by Jetty. I already know how to solve this problem if I was using Jetty directly:
Form too Large Exception
http://www.eclipse.org/jetty/documentation/current/setting-form-size.html
PROBLEM :
Now I need to find a way to change org.eclipse.jetty.server.Request.maxFormContentSize setting through SparkJava. Is there a way to do this?
I must note that other methods (JVM_OPTS, System.setProperty) do not work for me for some reason. I'm still getting the same exception.
Stacktrace:
[qtp1858644635-27] ERROR spark.webserver.MatcherFilter -
java.lang.IllegalStateException: Form too large 308913>200000
at org.eclipse.jetty.server.Request.extractParameters(Request.java:334)
at org.eclipse.jetty.server.Request.getParameterMap(Request.java:765)
at javax.servlet.ServletRequestWrapper.getParameterMap(ServletRequestWrapper.java:193)
at spark.QueryParamsMap.<init>(QueryParamsMap.java:59)
at spark.Request.initQueryMap(Request.java:364)
at spark.Request.queryMap(Request.java:349)
at spark.webserver.RequestWrapper.queryMap(RequestWrapper.java:213)
at com.xyz.analytics.webservice.RequestTools.getRequestQueryMap(RequestTools.java:27)
at com.xyz.analytics.webservice.RequestTools.getMandrillQueryParams(RequestTools.java:22)
at com.xyz.analytics.webservice.Endpoints.lambda$initiateEndpointsAndExceptionHandlers$2(Endpoints.java:61)
at com.xyz.analytics.webservice.Endpoints$$Lambda$3/1485697819.handle(Unknown Source)
at spark.SparkBase$1.handle(SparkBase.java:311)
at spark.webserver.MatcherFilter.doFilter(MatcherFilter.java:159)
at spark.webserver.JettyHandler.doHandle(JettyHandler.java:60)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:179)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:451)
at org.eclipse.jetty.server.HttpChannel.run(HttpChannel.java:252)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:266)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:240)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:596)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:527)
at java.lang.Thread.run(Thread.java:745)
Edit:
I must note that other methods (JVM_OPTS, System.setProperty) do not work for me.
Well, debugger doesn't even stop at any breakpoint set within org.eclipse.jetty.server.handlerContextHandler... Plus when it stops at org.eclipse.jetty.server.Request breakpoints, _context property is null. Seems that SparkJava is handling it differently. Dead end.
Request does one more thing before setting maxFormContentSize = 200000;. It checks _channel.getServer().getAttribute("org.eclipse.jetty.server.Request.maxFormContentSize").
Except Server's attribute collection is empty... And I don't see any way to add any attribute. Jetty Server is created by SparkBase.init() which calls SparkServer.ignite().
But it doesn't help us much. It's not easy to "break in" to make our own adjustments. It seems pretty hopeless.
Not possible with Spark 2.2
The creation of the ServerConnector is hardcoded in the SparkServer, you cannot change those values after the fact, they have to be passed into the ServerConnector before server start.
Would recommend filing a bug with Spark to make that configurable.
https://github.com/perwendel/spark/issues
Good news everyone :)
In Spark 2.6 (released April 2017) embedded Jetty is fully configurable!
Release notes: http://sparkjava.com/news#spark-26-released
See the original future request for more details here: https://github.com/perwendel/spark/issues/314
and related pull request here:
https://github.com/perwendel/spark/pull/813
NOTE that it is also possible to run Spark on another web server instead of the embedded Jetty server:
http://sparkjava.com/documentation#other-web-server
Well, having access to the server object, you can always do something like:
server.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", 1024 * 1024);
Hope this helps!

How to handle client side exceptions in GWT/GXT?

I am using GWT. if any server side exception is generated, we are sending an email with error details(have used log4j SMTPAppender). Based on the line number, we can fix the issue..
My scenario is, if any exception is generated in the client package code, as of now, we are giving generic message saying "Some Exception has Occured". But is it possible to display error stack trace along with the exception cause and line number? my code is as below:
GWT.setUncaughtExceptionHandler(new
GWT.UncaughtExceptionHandler() {
public void onUncaughtException(Throwable e) {
Window.alert("Some Exception has Occured");
}
});
I dont think it is possible as client package is converted into Javascript in web mode. Please suggest me if there is any approach to display exception cause and line number where it has occured.
You can read this page
Basically, you have to use JUL to do your logging, and it's client logging : firebug, JS console, etc... You may do some smarter things with the RemoteLogging but i can't help you on that.
The main problem is that log4j is not supported. Maybe with a bridge between JUL and log4j you will be able to achieve everything you want
I would recommend using gwt-log:
Project Page
gwt-log has support for an 'UncaughtExceptionHandler' and a RemoteLogger to send messages/exception to the server.
in gwt-log, you can also turn on the "emulated stack", which is exactly what you want to do:
Wiki Page - Emulated Stack
please note however that this adds a LOT of code to the compiled JS-script

Problem initiating SIP session/ getClientTransaction(request) throws NullPointerException

I have a small issue, I had my SIP client working, and I changed the structure of the code. I kept the creation process of the SIP objects as it was before, but now it does not work.
I keep getting:
java.lang.NullPointerException at gov.nist.javax.sip.SipProviderImpl.getNewClientTransaction(SipProviderImpl.java:285)
and there is no reference to such error in the documentation... what does it mean?
here is the instantiation code for the sip:
sipFactory.setPathName(host);
sipFactory.resetFactory();
sipStack = sipFactory.createSipStack(getProperties());
String address = Inet4Address.getLocalHost().getHostAddress();
sipFactory.createHeaderFactory();
sipFactory.createAddressFactory();
sipFactory.createMessageFactory();
udpPoint = sipStack.createListeningPoint(address, SIPPort, SIPConstants.UDP);
udpSipProvider = sipStack.createSipProvider(udpPoint);
udpSipProvider.addSipListener(this);
tcpPoint = sipStack.createListeningPoint(address, SIPPort, SIPConstants.TCP);
tcpSipProvider = sipStack.createSipProvider(tcpPoint);
tcpSipProvider.addSipListener(this);
sipStack.start();
setSessionState(SipSessionState.Connected);
Any Help please??
Adam.
WWWWWWWWWWWOOOOOOOOOOOWWWWWWWWWWWWW
If anyone would had ever guessed this, I'll eat my LapTop....
in the first project I was using the Jain-Sip 1.2
and in the new one I use the 1.2.1
BIG issue that in the 1.2, as far as I can tell, request.getMethod() returns the method of the CSeq header in case I don't use the request.setMethod(method).
While in the 1.2.1, if not setting the request.setMethod(method), the request.getMethod() method returns null.
that was my error...
now if you read this please commend or something... I'm so frustrated, I was sitting on this bugger for 4 hours now. Damn.
Adam.

Categories