Hi,

I have tried with putting a jar file as a library to the
repository/conf/lib folder. But it throws an exception when initializing
axis2.xml file with class not found exception. Maybe axis2.xml get loaded
before loading the classes in lib folder. Below is the exception which was
thrown.

[2014-07-14 16:24:48,583] FATAL
{org.wso2.carbon.core.init.CarbonServerManager} -  WSO2 Carbon
initialization Failed
org.apache.axis2.AxisFault: Exception occured while loading the Axis
configuration from
/media/rajith/Office/Wso2/team/product/wso2dss-3.2.1/repository/conf/axis2/axis2.xml
at
org.wso2.carbon.core.CarbonAxisConfigurator.getAxisConfiguration(CarbonAxisConfigurator.java:190)
at
org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64)
at
org.wso2.carbon.core.CarbonConfigurationContextFactory.createNewConfigurationContext(CarbonConfigurationContextFactory.java:65)
at
org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:398)
at
org.wso2.carbon.core.init.CarbonServerManager.start(CarbonServerManager.java:219)
at
org.wso2.carbon.core.internal.CarbonCoreServiceComponent.activate(CarbonCoreServiceComponent.java:77)
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.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
at
org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
at
org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:347)
at
org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
at
org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
at
org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
at
org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
at
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at
org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
at
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
at
org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(Activator.java:81)
at
org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(Activator.java:60)
at
org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(ProxyServlet.java:40)
at
org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(DelegationServlet.java:38)
at
org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1267)
at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1186)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1081)
at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.axis2.deployment.DeploymentException:
org/apache/axis2/json/JSONMMyFormatter
at
org.apache.axis2.deployment.AxisConfigBuilder.processMessageBuilders(AxisConfigBuilder.java:775)
at
org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:236)
at
org.wso2.carbon.core.CarbonAxisConfigurator.populateAxisConfiguration(CarbonAxisConfigurator.java:308)
at
org.wso2.carbon.core.CarbonAxisConfigurator.getAxisConfiguration(CarbonAxisConfigurator.java:188)
... 42 more
Caused by: java.lang.NoClassDefFoundError:
org/apache/axis2/json/JSONMMyFormatter
at org.wso2.training.custom.json.JSONMyBuilder.<init>(JSONMyBuilder.java:35)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:357)
at java.lang.Class.newInstance(Class.java:310)
at
org.apache.axis2.deployment.DescriptionBuilder.processMessageBuilders(DescriptionBuilder.java:230)
at
org.apache.axis2.deployment.AxisConfigBuilder.processMessageBuilders(AxisConfigBuilder.java:772)
... 45 more
Caused by: java.lang.ClassNotFoundException:
org.apache.axis2.json.JSONMMyFormatter
at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:455)
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:247)
... 54 more


Thanks,


On Mon, Jul 14, 2014 at 3:17 PM, Shameera Rathnayaka <shame...@wso2.com>
wrote:

> Hi Rajith,
>
> Why are you asking him to build the patches , can't he work on already
> released DSs pack, Here i am trying to understand which issue Yasas trying
> to address by implementing a new JSON builder and formatter, we have plenty
> of Builders and formatters for JSON :) . May i know the real use case and
> requirement ?
>
> Thanks,
> Shameera
>
>
> On Mon, Jul 14, 2014 at 2:51 PM, Rajith Vitharana <raji...@wso2.com>
> wrote:
>
>> Hi Yasas,
>>
>> Try out creating a simple jar and put it in lib folder as shameera
>> mentioned in above reply. I have tried out the scenario I have explained to
>> you, and it worked fine for me
>> As I mentioned, have you build the whole patch from the pom.xml inside
>> patch0007 folder?
>> and have you created "patch0008" folder and copied the
>> jar(axis2-json-1.6.1-wso2v10.jar) inside 
>> "patch0007/dependencies/orbit/axis2-json/target"
>> folder to the "patch0008" folder?
>>
>> Thanks,
>>
>>
>>
>> On Mon, Jul 14, 2014 at 1:50 PM, Shameera Rathnayaka <shame...@wso2.com>
>> wrote:
>>
>>> Hi Yasas,
>>>
>>> For you ClassNotFoundException, check do your axis2-json jar has
>>> required classes, BTW as i mentioned in previous reply you don't need to do
>>> any code changes to axis2 jars in order to plug your custom builders.
>>>
>>> Thanks,
>>> Shameera.
>>>
>>>
>>> On Mon, Jul 14, 2014 at 1:36 PM, Yasas Karunarathna <yasasm...@gmail.com
>>> > wrote:
>>>
>>>> Thank you for the quick responses. I checked in sources from both the
>>>> locations
>>>>
>>>> https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.2.0/patches/patch0007/dependencies/axis2/modules/json/
>>>>
>>>> https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.2.0/dependencies/axis2/1.6.1-wso2v10/modules/json
>>>>
>>>> Separately build without any modifications, and put generated jar to
>>>> patch8 folder. Once I restart the server following message shows in the
>>>> console.
>>>>
>>>> "Could not start:
>>>> null(reference:file:../plugins/axis2-json_1.6.1.wso2v10.jar:15). It's state
>>>> is uninstalled."
>>>>
>>>> After that logs the following error.
>>>>
>>>> "Caused by: java.lang.ClassNotFoundException:
>>>> org.apache.axis2.json.gson.JSONMessageHandler"
>>>>
>>>> Any work around?
>>>>
>>>>
>>>>
>>>> On Sun, Jul 13, 2014 at 11:30 PM, Shameera Rathnayaka <
>>>> shame...@wso2.com> wrote:
>>>>
>>>>> Hi Yasas,
>>>>>
>>>>> Assuming you are going to customize the JSON mapped convention
>>>>> (Standard Mapped Json support is their with Axis2),You don't need to do
>>>>> anything to axis2 jar.  Implement your new JSON builder and formatter, 
>>>>> then
>>>>> create a new jar(or osgi bundle) using those new classes
>>>>>  and copy that jar ( or osgi bundle) to
>>>>> <DSS_HOME>/repository/components/lib ( or
>>>>> <DSS_HOME>/repository/components/dropings) directory. Finally,  you need 
>>>>> to
>>>>> configure your builder and formatter in axis2.xm configuration file (like
>>>>> your 3rd step).
>>>>>
>>>>> Thanks,
>>>>> Shameera.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Sun, Jul 13, 2014 at 10:35 PM, Rajith Vitharana <raji...@wso2.com>
>>>>> wrote:
>>>>>
>>>>>> Hi Yasas,
>>>>>>
>>>>>> The points you have mentioned are correct, but there are small
>>>>>> changes I would like to point out. Below are the steps you'll need to
>>>>>> follow to achieve your goal.
>>>>>>
>>>>>> 1 - There is a patch release for the "axis2-json" so you'll need to
>>>>>> check out the source from [1] instead of the svn location you have
>>>>>> mentioned. (checkout the whole "patch0007" instead of json module, so 
>>>>>> that
>>>>>> it'll be easy for you to build the source.)
>>>>>> 2 - Add the classes you need to the source.
>>>>>>           You'll need to extend AbstractJSONMessageFormatter in your
>>>>>> custom formatter class
>>>>>>           You'll need to extend AbstractJSONOMBuilder in you custom
>>>>>> builder class
>>>>>> 3 - Build the whole patch0007. Then go to
>>>>>> "patch0007/dependencies/orbit/axis2-json/target" folder where you can 
>>>>>> find
>>>>>> the osgi bundle created from "axis2-json" module.
>>>>>> 4 - Create "patch0008" folder inside
>>>>>> "DSS_HOME/repository/components/patches" folder and copy the osgi bundle
>>>>>> you found in step 3 to that folder.
>>>>>> 5 - Add "messageFormatter" and "messageBuilder" elements to the
>>>>>> "DSS_HOME/repository/conf/axis2/axis2.xml" as you have pointed out in 
>>>>>> your
>>>>>> step 3.
>>>>>> 6 - Restart the server and invoke your service adding "Accept"
>>>>>> request header to the request with new content type you mentioned in
>>>>>> "axis2.xml", example would be "Accept:application/json/newformat".(You
>>>>>> can find sample of how to do it in [2])
>>>>>>
>>>>>> [1] -
>>>>>> https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.2.0/patches/patch0007/dependencies/axis2/modules/json/
>>>>>> [2] -
>>>>>> http://janakaranabahu.blogspot.com/2013/06/return-json-response-from-wso2-dss.html
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>>
>>>>>> On Sun, Jul 13, 2014 at 1:45 PM, Yasas Karunarathna <
>>>>>> yasasm...@gmail.com> wrote:
>>>>>>
>>>>>>> Hi there,
>>>>>>>
>>>>>>> I want to do a small change to the json response returned from DSS
>>>>>>> 3.2.1. I'm using JSONMessageFormatter & JSONOMBuilder in
>>>>>>> org.apache.axis2.json package.(not gson implementations)
>>>>>>> My requirements are as follows
>>>>>>>
>>>>>>> 1) Implement new JSONMessageFormatter, JSONOMBuilder etc.
>>>>>>>  And additional method accepting the Mapped json response and
>>>>>>> format it accordingly, call it at the end of mapped json conversion.
>>>>>>>  2) Build axis2-json-1.6.1-wso2v10.jar adding new classes.
>>>>>>>  I think this is the source used in DSS 3.2.1 :
>>>>>>> https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.2.0/dependencies/axis2/1.6.1-wso2v10/modules/json
>>>>>>>
>>>>>>> 3) State new Formatter and Builder in axis2.xml & call it with new
>>>>>>> header
>>>>>>> <messageFormatter contentType="application/json/newformat"
>>>>>>>
>>>>>>> class="org.apache.axis2.json.newJSONMessageFormatter"/>
>>>>>>>
>>>>>>>  <messageBuilder contentType="application/json/newformat"
>>>>>>>
>>>>>>> class="org.apache.axis2.json.newJSONOMBuilder"/>
>>>>>>>  Can anybody advice me on achieving the above requirements?
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> *Yasas Karunarathna*
>>>>>>> yasasblog.wordpress.com
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Dev mailing list
>>>>>>> Dev@wso2.org
>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Rajith Vitharana
>>>>>>
>>>>>> Software Engineer,
>>>>>> WSO2 Inc. : wso2.com
>>>>>> Mobile : +94715883223
>>>>>> Blog : http://lankavitharana.blogspot.com/
>>>>>>
>>>>>> _______________________________________________
>>>>>> Dev mailing list
>>>>>> Dev@wso2.org
>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Software Engineer - WSO2 Inc.*
>>>>> *email: shameera AT wso2.com <shame...@wso2.com> , shameera AT
>>>>> apache.org <shame...@apache.org>*
>>>>> *phone:  +9471 922 1454 <%2B9471%20922%201454>*
>>>>>
>>>>> *Linked in : *
>>>>> http://lk.linkedin.com/pub/shameera-rathnayaka/1a/661/561
>>>>> *Twitter     : *https://twitter.com/Shameera_R
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> Thanks
>>>>
>>>>
>>>>
>>>> *Yasas Karunarathna*
>>>> yasasblog.wordpress.com
>>>>
>>>
>>>
>>>
>>> --
>>> *Software Engineer - WSO2 Inc.*
>>> *email: shameera AT wso2.com <shame...@wso2.com> , shameera AT
>>> apache.org <shame...@apache.org>*
>>> *phone:  +9471 922 1454 <%2B9471%20922%201454>*
>>>
>>> *Linked in : *http://lk.linkedin.com/pub/shameera-rathnayaka/1a/661/561
>>> *Twitter     : *https://twitter.com/Shameera_R
>>>
>>
>>
>>
>> --
>> Rajith Vitharana
>>
>> Software Engineer,
>> WSO2 Inc. : wso2.com
>> Mobile : +94715883223
>> Blog : http://lankavitharana.blogspot.com/
>>
>
>
>
> --
> *Software Engineer - WSO2 Inc.*
> *email: shameera AT wso2.com <shame...@wso2.com> , shameera AT apache.org
> <shame...@apache.org>*
> *phone:  +9471 922 1454 <%2B9471%20922%201454>*
>
> *Linked in : *http://lk.linkedin.com/pub/shameera-rathnayaka/1a/661/561
> *Twitter     : *https://twitter.com/Shameera_R
>



-- 
Rajith Vitharana

Software Engineer,
WSO2 Inc. : wso2.com
Mobile : +94715883223
Blog : http://lankavitharana.blogspot.com/
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to