Hello!
I work with Axis 1.4.1 and Tomcat 5.5.
In the service there is a method which is used to upload image-data to
the server using javax.activation.DataHandler.
I generated a ClientStub using the eclipse-built-in "Create new
Webservice-Client" and communicate successfully with
other methods from the service.
When I want to upload an image i get the following Exception on the
serverside:
----
ERROR 2009-06-24 17:37:34,491 [http-8180-Processor25]
(RPCMessageReceiver.java:160) -
java.lang.IllegalArgumentException
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.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:
194)
at
org
.apache
.axis2
.rpc
.receivers
.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102)
at
org
.apache
.axis2
.receivers
.AbstractInOutMessageReceiver
.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at
org
.apache
.axis2
.receivers
.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
at
org
.apache
.axis2
.transport
.http
.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org
.apache
.catalina
.core
.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
269)
at
org
.apache
.catalina
.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
org
.apache
.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
213)
at
org
.apache
.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
172)
at
org
.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
127)
at
org
.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
117)
at
org
.apache
.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
151)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
874)
at org.apache.coyote.http11.Http11BaseProtocol
$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at
org
.apache
.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at
org
.apache
.tomcat
.util
.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:
81)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:619)
ERROR 2009-06-24 17:37:34,496 [http-8180-Processor25] (AxisEngine.java:
212) -
org.apache.axis2.AxisFault
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at
org
.apache
.axis2
.rpc
.receivers
.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:161)
at
org
.apache
.axis2
.receivers
.AbstractInOutMessageReceiver
.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at
org
.apache
.axis2
.receivers
.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
at
org
.apache
.axis2
.transport
.http
.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org
.apache
.catalina
.core
.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
269)
at
org
.apache
.catalina
.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
org
.apache
.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
213)
at
org
.apache
.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
172)
at
org
.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
127)
at
org
.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
117)
at
org
.apache
.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
151)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
874)
at org.apache.coyote.http11.Http11BaseProtocol
$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at
org
.apache
.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at
org
.apache
.tomcat
.util
.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:
81)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IllegalArgumentException
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.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:
194)
at
org
.apache
.axis2
.rpc
.receivers
.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102)
... 21 more
-------
I activated MTOM and SwA in the axis2.conf.
The serverside-method for the upload looks like this:
-----------
public static String writePicture(String path, int auctionid,
DataHandler data){
// create dirs if neccessary
File fh = new File(imagePath+path);
boolean folders = false;
if(!fh.isDirectory()){
folders = fh.mkdirs();
}else folders = true;
// get mimetype-mapping
String ext = getFileExtension(data.getContentType());
if(folders && fh.canWrite() && !ext.equals(null)){
try{
new File(imagePath+path+"/"+auctionid).mkdir();
String name =
HashGenerator.getHash(data.getName());
File outFile = new File(imagePath+path+"/"+auctionid+"/"+name
+"."+ext);
FileOutputStream fos = new
FileOutputStream(outFile);
data.writeTo(fos);
fos.flush();
fos.close();
ServiceContainer.getLogger().info("File "+imagePath+path
+"/"+auctionid+"/"+name+"."+ext+" created");
// generate Thumbnails
generateThumbnails(path, auctionid,
(name+"."+ext));
return name+"."+ext;
}catch (NoSuchAlgorithmException e) {
ServiceContainer.getLogger().error("Could not retrieve
HashAlgorithm", e);
}catch (IOException e){
ServiceContainer.getLogger().error("Could not work on file
"+imagePath+path+"/"+auctionid+"/"+data.getName(), e);
}
}
return null;
}
-------
As the Exception-Stack isn't really meaninful to me, i can't find the
origin of it.
I hope you can help me out.
Thanks alot!