Hi,

I am currently in the process of learning the Axis2 framework. I want to use
MTOM but I have been having problems getting it to work correctly. When I
try the MTOM sample that comes with Axis 2.1.2, it works great if I use the
Axis2 server. I want to get it to work with Eclipse 3.3 and Weblogic 9.2(java
1.5) and have not been successful. These are the steps I have tried:

1. I created a "Dynamic Web" project in Eclipse and use the Axis2 project
facet and Target Runtime and Configurations is set for Weblogic 9.2 . After
it has been created, I change the axis2.xml file under
WebContent/WEB-INF/conf so enableMTOM is set to true.
2. I create a Web Service via the project wizard. I used the "Top down Java
bean Web Service" and browse for the "MTOMSample.wsdl" file included in the
MTOMSample (which I copied to my web project under WebContent plus xmime.xsd)
and I change the Java proxy to "Develop Client". Then I click on "Finish",
and start the server and it generates all the necessary files for me.
3. I create appropriate packages for the service and for the client and
copy/paste the code for the service and client from the MTOM sample that
comes with Axis2. All service code deploys to weblogic successfully.
4. I start my client and when the client code gets into the transferFile
method it blows up on the following line:

base64Binary.setContentType(dataHandler.getContentType());

The stacktrace looks like this:

Exception in thread "Main Thread" java.lang.NoClassDefFoundError:
com/sun/activation/registries/MimeTypeFile
    at javax.activation.MimetypesFileTypeMap.loadFile(
MimetypesFileTypeMap.java:240)
    at javax.activation.MimetypesFileTypeMap.<init>(
MimetypesFileTypeMap.java:89)
    at javax.activation.FileTypeMap.getDefaultFileTypeMap(FileTypeMap.java
:98)
    at javax.activation.FileDataSource.getContentType(FileDataSource.java
:109)
    at javax.activation.DataHandler.getContentType(DataHandler.java:187)
    at sample.mtom.client.Client.transferFile(Client.java:99)
    at sample.mtom.client.Client.main(Client.java:54)

I saw somewhere online that if you get this error when using
javax.activation, then you should include activation.jar and mailapi.jar. I
tried to add those to my client project but it does not help.

If I try to comment out that line then I get a related exception in the
service instead:

Exception in thread "Main Thread" java.lang.RuntimeException: required
attribute localContentType is null
    at
org.apache.ws.axis2.mtomsample.MTOMSampleMTOMSampleSOAP11Port_httpStub$Base64Binary.serialize
(MTOMSampleMTOMSampleSOAP11Port_httpStub.java:484)
    at
org.apache.ws.axis2.mtomsample.MTOMSampleMTOMSampleSOAP11Port_httpStub$AttachmentType.serialize
(MTOMSampleMTOMSampleSOAP11Port_httpStub.java:1349)
    at
org.apache.ws.axis2.mtomsample.MTOMSampleMTOMSampleSOAP11Port_httpStub$AttachmentRequest.serialize
(MTOMSampleMTOMSampleSOAP11Port_httpStub.java:1716)
    at
org.apache.ws.axis2.mtomsample.MTOMSampleMTOMSampleSOAP11Port_httpStub$AttachmentRequest$1.serialize
(MTOMSampleMTOMSampleSOAP11Port_httpStub.java:1696)
    at
org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerializeAndConsume
(OMSourcedElementImpl.java:583)
<snip>

Am I doing something wrong here? What should I do to be able to use Axis2
from Eclipse and Weblogic? Any ideas why I am getting the
NoClassDefFoundError exception when I try to get the content type from the
dataHandler?

TIA,
Magnus Lassi

Reply via email to