Thanks, Harsha, that might prove useful, but the bigger question to me is
why even bother with the bundle part ...

When I worked on the 4.8.0 ESB version, I just had to put the .jar file
into <ESB-HOME>/repository/components/lib and the wso2 framework took care
of bundling it and moving it to the dropins directory (along with whatever
bundling needs are required).

The APIM also seems to do the same thing (i.e., put it in the
<APIM_HOME>/repository/components/lib directory and, again, the framework
does the bundling and putting it in the dropins directory).

There isn't much difference in the wso2-framework generated MANIFEST.MF
file between the two. And yet I get ClassNotFoundExceptions in the APIM
version.

TO COMPARE:

generated MANIFEST.MF - 4.8.0 version of ESB:
Manifest-Version: 1.0
Export-Package: edu.wisc.services.esbpoc
DynamicImport-Package: *
Bundle-ClassPath: .,esb.poc-1.0-SNAPSHOT.jar
Bundle-Version: 1.0.0
Bundle-Name: esb.poc_1.0_SNAPSHOT
Bundle-ManifestVersion: 2
Bundle-SymbolicName: esb.poc_1.0_SNAPSHOT

generated MANIFEST.MF - 2.1.0 API Manager version:
Manifest-Version: 1.0
Bundle-SymbolicName: esb.poc_1.0.0_SNAPSHOT
Export-Package: edu.wisc.services.esbpoc
Bundle-Name: esb.poc_1.0.0_SNAPSHOT
Bundle-Version: 1.0.0
Bundle-ClassPath: .,esb.poc-1.0.0-SNAPSHOT.jar
Bundle-ManifestVersion: 2
DynamicImport-Package: *

On Mon, Sep 4, 2017 at 12:12 PM Harsha Kumara <hars...@wso2.com> wrote:

> Hi Todd,
>
> Resource in [1] may be a good reference for you.
>
> [1]
> https://github.com/R-Rajkumar/samples/blob/master/message-builder-handler/pom.xml
>
> Thanks,
> Harsha
>
> On Mon, Sep 4, 2017 at 10:16 PM, Todd Hill <toddkh...@gmail.com> wrote:
>
>> meant to send it to the DEV list too.
>>
>>
>> ---------- Forwarded message ---------
>> From: Todd Hill <toddkh...@gmail.com>
>> Date: Mon, Sep 4, 2017 at 11:38 AM
>> Subject: Re: [Dev] Custom API handler gets ClassNotFoundException
>> To: Harsha Kumara <hars...@wso2.com>
>>
>>
>> The profile I'm using is 'apim' (as opposed to the 'esb' profile). The
>> <packaging>bundle</packing> is comment out because I wasn't able to get
>> that working either.
>>
>>
>> On Mon, Sep 4, 2017 at 11:35 AM Harsha Kumara <hars...@wso2.com> wrote:
>>
>>> Hi Todd,
>>>
>>> Can you attach the pom.xml of your custom handler?
>>>
>>> Thanks,
>>> Harsha
>>>
>>> On Mon, Sep 4, 2017 at 9:58 PM, Todd Hill <toddkh...@gmail.com> wrote:
>>>
>>>> Sorry if this is not the right place to send questions about writing a
>>>> custom Handler for WSO2 API Manager 2.1.0, but I don't see any other places
>>>> listed.
>>>>
>>>> I have written a custom handler that worked well with WSO2 ESB 4.8.0.
>>>> We are migrating to using the API Manager v2.1.0, so I updated the maven
>>>> dependencies, but now after I put the jar into
>>>> <APIM_HOME>/repository/components/lib and restart the API Manager, I get
>>>> this when my Handler class is invoked:
>>>>
>>>> Caused by: java.lang.ClassNotFoundException:
>>>> org.apache.synapse.core.axis2.Axis2MessageContext cannot be found by
>>>> esb.poc_1.0_SNAPSHOT_1.0.0
>>>> at
>>>> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
>>>> at
>>>> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
>>>> at
>>>> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
>>>> at
>>>> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
>>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>>>
>>>>
>>>> Here is the method in the handler:
>>>>
>>>> private void processPayload(CaosDecisionMakingData decisionMakingData,
>>>> MessageContext mc){
>>>> try {
>>>> RelayUtils.buildMessage(((Axis2MessageContext)
>>>> mc).getAxis2MessageContext());
>>>> } catch (IOException e) {
>>>> throw new RuntimeException(e);
>>>> } catch (XMLStreamException e) {
>>>> throw new RuntimeException(e);
>>>> }
>>>> OMElement restPayload = mc.getEnvelope().getBody().getFirstElement();
>>>> if (restPayload != null) {
>>>> decisionMakingData.setPostBodyElement(restPayload);
>>>> }
>>>> }
>>>>
>>>> The line with RelayUtils containing the cast is where the problem is.
>>>>
>>>>
>>>> Thanks for any help or direction you can give.
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> Dev@wso2.org
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> Harsha Kumara
>>> Software Engineer, WSO2 Inc.
>>> Mobile: +94775505618 <+94%2077%20550%205618>
>>> Blog:harshcreationz.blogspot.com
>>>
>>
>
>
> --
> Harsha Kumara
> Software Engineer, WSO2 Inc.
> Mobile: +94775505618 <+94%2077%20550%205618>
> Blog:harshcreationz.blogspot.com
>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to