Friday, March 13, 2009

InterruptedException, URISyntaxException: Illegal character in path ... at Axis2 Codegen Wizard

Problem: Such exception is thrown during code gen(under Windows).


Solution: move the wsdl file to a path without special character(i.e. Document and Settings, Program Files).

Thursday, March 12, 2009

java.lang.reflect.InvocationTargetException at Axis2 Codegen Wizard

Problem: java.lang.reflect.InvocationTargetException

1. An exception is thrown:




2. Identify the errors by
2.1 workspace/.metadata/.log OR
2.2 turn the console log on if there is no file at the above path by running "eclipse -consoleLog"

3. in my case, one of many exceptions is:
Caused by: java.lang.ClassNotFoundException: edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap
...
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 60 more

4. Find the missing jars at Axis2_Codegen_Wizard_1.3.0\plugin.xml

5. Mines include:
backport-util-concurrent-3.1.jar
jibx-bind-1.1.5.jar
jibx-run-1.1.5.jar
neethi-2.0.4.jar

woden-1.0M8.jar can't be found anywhere, needs to download the interface and implementations separately and add them to the plugin.xml.

woden-api-1.0M8.jar
woden-impl-dom-1.0M8.jar
woden-impl-om-1.0M8.jar


6. run "eclipse -clean"

7. Voila!

Tuesday, March 10, 2009

A fatal error has occurred while upgrading your device's software. Device communications error encountered.

Problem:

Upgrading the handset OS with Desktop Manager via USB connection, and it crashed.



Then it became unusable: Reload software: 507



Solution(for my case): Don't run anything on the serial/communication ports while upgrading, seems like the RIM software wants to talk to these ports and because they are occupeid, it threw exception.

P.S.: It takes more than 20 minutes for my OS to reboot afterward, be patient!

Friday, February 27, 2009

HTTP Header Field: BlackBerry Browser VS Opera Mini

BlackBerry:

GET / HTTP/1.0
Host: (host ip:port)
User-Agent: BlackBerry8830/4.5.0.77 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/126
Accept: application/vnd.rim.html,text/html,application/xhtml+xml,application/vnd.wap.xhtml+xml,text/vnd.sun.j2me.app-descriptor,image/vnd.rim.png,image/jpeg,application/x-vnd.rim.pme.b,image/gif;anim=1,application/vnd.wap.wmlc;q=0.9,application/vnd.wap.wmlscriptc;q=0.7,text/vnd.wap.wml;q=0.7,*/*;q=0.5
Accept-Language: en-US,en;q=0.5
Accept-Charset: ISO-8859-1,UTF-8,US-ASCII,UTF-16BE,windows-1252,UTF-16LE,windows-1250
Connection: keep-alive
profile: http://www.blackberry.net/go/mobile/profiles/uaprof/8830/4.5.0.rdf
Via: BISB_3.4.0.45, 1.1 pmds67.bisb1.blackberry:3128 (squid/2.5.STABLE12)
Cache-Control: max-age=259200
x-wap-profile: "http://www.blackberry.net/go/mobile/profiles/uaprof/8830/4.5.0.rdf"
X-Forwarded-For: unknown


Opera Mini:

GET / HTTP/1.1
Host: (host ip:port)
User-Agent: Opera/9.60 (J2ME/MIDP; Opera Mini/4.2.13337/670; U; en) Presto/2.2.0
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Accept-Language: en,en;q=0.9
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0
Connection: Keep-Alive
X-OperaMini-Features: advanced, file_system, folding
X-OperaMini-Phone-UA: BlackBerry
X-OperaMini-Phone: RIM #
x-forwarded-for: (some ip)

Tuesday, February 17, 2009

Java Serial Port Communication(javacomm) in 4 steps

These steps apply to Windows environment only:
1.) download javacomm20-win32.zip
2.) extract comm.jar to ..\jre\lib\ext
3.) extract javax.comm.properties to ..\jre\lib folder
4.) extract win32comm.dll to c:\windows


import java.util.Enumeration;
import javax.comm.CommPortIdentifier;

public class JavaCommTest {
public static void main(String[] ap) {
Enumeration pList = CommPortIdentifier.getPortIdentifiers();

while (pList.hasMoreElements()) {
CommPortIdentifier cpi = (CommPortIdentifier) pList.nextElement();
System.out.print("Port " + cpi.getName() + " ");
if (cpi.getPortType() == CommPortIdentifier.PORT_SERIAL) {
System.out.println("is a Serial Port: " + cpi);
} else if (cpi.getPortType() == CommPortIdentifier.PORT_PARALLEL) {
System.out.println("is a Parallel Port: " + cpi);
} else {
System.out.println("is an Unknown Port: " + cpi);
}
}
}
}



Here are the outputs of the above snippet if missing:

win32comm.dll - Error loading win32com: java.lang.UnsatisfiedLinkError: no win32com in java.library.path

javax.comm.properties - pList would return false at hasMoreElements()

Friday, January 23, 2009

DeploymentException, ArrayIndexOutOfBoundsException, OutOfMemoryError casued by Parlay X with Axis2

Problem:Using Axis2 client to make a webservice call to Parlay X service, might cause the following exceptions, eventually OutOfMemoryError.


2009-01-15 07:32:18,947 ERROR [org.apache.axis2.deployment.ModuleDeployer]
The mex-1.4.jar module, which is not valid, caused null
org.apache.axis2.deployment.DeploymentException
at org.apache.axis2.deployment.repository.util.ArchiveReader.readModuleArchive(ArchiveReader.java:531)
at org.apache.axis2.deployment.ModuleDeployer.deploy(ModuleDeployer.java:71)
at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:597)
at org.apache.axis2.deployment.RepositoryListener.loadClassPathModules(RepositoryListener.java:195)
at org.apache.axis2.deployment.RepositoryListener.init2(RepositoryListener.java:70)
at org.apache.axis2.deployment.RepositoryListener.(RepositoryListener.java:63)
at org.apache.axis2.deployment.DeploymentEngine.loadFromClassPath(DeploymentEngine.java:164)
at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:135)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:68)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:184)
at org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.java:150)
at org.apache.axis2.client.ServiceClient.(ServiceClient.java:143)
at org.csapi.www.wsdl.parlayx.terminal_location.v2_0.service.TerminalLocationServiceStub.(TerminalLocationServiceStub.java:139)
at org.csapi.www.wsdl.parlayx.terminal_location.v2_0.service.TerminalLocationServiceStub.(TerminalLocationServiceStub.java:125)
at org.csapi.www.wsdl.parlayx.terminal_location.v2_0.service.TerminalLocationServiceStub.(TerminalLocationServiceStub.java:173)
at org.csapi.www.wsdl.parlayx.terminal_location.v2_0.service.TerminalLocationServiceStub.(TerminalLocationServiceStub.java:165)
.
.
.
Caused by: org.apache.axiom.om.OMException
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:243)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:132)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:411)
at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:602)
at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:581)
at org.apache.axis2.deployment.DescriptionBuilder.buildOM(DescriptionBuilder.java:97)
at org.apache.axis2.deployment.ModuleBuilder.populateModule(ModuleBuilder.java:90)
at org.apache.axis2.deployment.repository.util.ArchiveReader.readModuleArchive(ArchiveReader.java:518)
... 26 more



2009-01-05 00:57:01,845 ERROR [org.apache.axis2.deployment.ModuleDeployer]
The mex-1.4.jar module, which is not valid, caused java.lang.ArrayIndexOutOfBoundsException: -1
org.apache.axis2.deployment.DeploymentException: java.lang.ArrayIndexOutOfBoundsException: -1
at org.apache.axis2.deployment.repository.util.ArchiveReader.readModuleArchive(ArchiveReader.java:531)
at org.apache.axis2.deployment.ModuleDeployer.deploy(ModuleDeployer.java:71)
at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:597)
at org.apache.axis2.deployment.RepositoryListener.loadClassPathModules(RepositoryListener.java:195)
at org.apache.axis2.deployment.RepositoryListener.init2(RepositoryListener.java:70)
at org.apache.axis2.deployment.RepositoryListener.(RepositoryListener.java:63)
at org.apache.axis2.deployment.DeploymentEngine.loadFromClassPath(DeploymentEngine.java:164)
at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:135)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:68)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:184)
at org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.java:150)
at org.apache.axis2.client.ServiceClient.(ServiceClient.java:143)
at org.csapi.www.wsdl.parlayx.terminal_location.v2_0.service.TerminalLocationServiceStub.(TerminalLocationServiceStub.java:139)
at org.csapi.www.wsdl.parlayx.terminal_location.v2_0.service.TerminalLocationServiceStub.(TerminalLocationServiceStub.java:125)
at org.csapi.www.wsdl.parlayx.terminal_location.v2_0.service.TerminalLocationServiceStub.(TerminalLocationServiceStub.java:173)
at org.csapi.www.wsdl.parlayx.terminal_location.v2_0.service.TerminalLocationServiceStub.(TerminalLocationServiceStub.java:165)
.
.
.
Caused by: org.apache.axiom.om.OMException: java.lang.ArrayIndexOutOfBoundsException: -1
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:132)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:411)
at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:602)
at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:581)
at org.apache.axis2.deployment.DescriptionBuilder.buildOM(DescriptionBuilder.java:97)
at org.apache.axis2.deployment.ModuleBuilder.populateModule(ModuleBuilder.java:90)
at org.apache.axis2.deployment.repository.util.ArchiveReader.readModuleArchive(ArchiveReader.java:518)
... 26 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
at com.sun.xml.stream.xerces.util.NamespaceSupport.pushContext(NamespaceSupport.java:178)
at com.sun.xml.stream.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:240)
at com.sun.xml.stream.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2599)
at com.sun.xml.stream.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:857)
at com.sun.xml.stream.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:330)
at com.sun.xml.stream.XMLReaderImpl.next(XMLReaderImpl.java:502)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:506)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:161)
... 33 more

Solution:

Do not instantiate the object of the class that extends org.apache.axis2.client.Stub more than once per application, else it will keep loading the class mex-1.4.jar.

If it needs to be instantiated more than once, then make sure the instantiation method is synchronized. Beware that whenever the mex-1.4.jar is loaded, it will make a copy at the /tmp/ folder, make sure there is enough space to hold all those temp mex-1.4.jar

p.s. possibly related to this

http://issues.apache.org/jira/browse/AXIS2-1927

Friday, January 16, 2009

Axis2 connection retry setting

problem: Axis2 retries 3 times before giving up connection, and want to disable this retry feature.


- I/O exception (java.net.ConnectException) caught when processing request: Connection refused
- Retrying request
- I/O exception (java.net.ConnectException) caught when processing request: Connection refused
- Retrying request
- I/O exception (java.net.ConnectException) caught when processing request: Connection refused
- Retrying request
- Unable to sendViaPost to url[http://somehost.com:80/someservice]
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:140)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:125)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:542)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:189)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:364)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:208)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:401)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
.
.
.
at java.lang.Thread.run(Thread.java:619)
Connection refused



solution: Customize a HttpClient that disable the retry for the Axis2 stub.


MultiThreadedHttpConnectionManager manager = new MultiThreadedHttpConnectionManager();
HttpMethodRetryHandler retry_handler = new DefaultHttpMethodRetryHandler(0, false);
HttpClientParams params = new HttpClientParams();
params.setParameter(HttpMethodParams.RETRY_HANDLER, retry_handler);
options.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, new HttpClient(params, manager));
options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, true);