Hi,

On Tue, Oct 22, 2013 at 1:07 PM, Lasantha Fernando <[email protected]>wrote:

> Hi all,
>
> This is seemingly working in today's CEP pack with 4.2.0 version of the
> feature.
>
> However, when analyzing the code where the exception was thrown, the
> following code was seen.
>
>     public boolean isValidTenant(String domain) {
>         int tenantId;
>         if(domain == null || domain.equals("")) {
> *            tenantId = CarbonContext.getCurrentContext().getTenantId();*
>         }
>         try {
>              tenantId = LoggingUtil.getTenantIdForDomain(domain);
>         } catch (LogViewerException e) {
>             log.error("error while getting tennat id from tenant domain",
> e);
>             return false;
>         }
>
>         if(tenantId == MultitenantConstants.INVALID_TENANT_ID) {
>             return false;
>         }
>         return true;
>     }
>
> which calls CC.getCurrentContext() method which is discouraged AFAIK.
>
Yes. CarbonContext.getCurrentContext() method is deprecated and therefore
we should avoid using that. This is noticed in 4.2.0 [1] and it is fixed in
4.2.1 [2] component. I have created a feature for this new version as well
[3]. As mentioned in other thread [4], I did not continue fixing the code
in 4.2.1 as we would need a Stratos Deployment to test those.

>
> Since we are using the managment console log viewer with CEP, I think it
> is better if the CC refactored 4.2.1 feature is used. However, a dependency
> issue comes up when including 4.2.1 feature as mentioned in previous mail.
> So I think it is better to fix the 4.2.1 feature and use that instead of
> the 4.2.0.
>
Yes. The product should use 4.2.1 feature if there are issues due to
CarbonContext. I'm not sure about the installation failure during
p2-profile-gen.

>
> @IsuruP, would it be possible for you to look into this since you did the
> original refactoring for logging-mgt feature?
>
I will further check on this.

I'm sorry for the inconvenience.

[1]
https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/components/logging/org.wso2.carbon.logging.service/4.2.0/src/main/java/org/wso2/carbon/logging/service/LogViewer.java
[2]
https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/components/logging/org.wso2.carbon.logging.service/4.2.1/src/main/java/org/wso2/carbon/logging/service/LogViewer.java
[3]
https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/features/logging-mgt/org.wso2.carbon.logging.mgt.server.feature/4.2.1/
[4]
http://wso2.markmail.org/search/list:org.wso2.dev#query:list%3Aorg.wso2.dev+page:1+mid:kutdhle5bfy43o22+state:results

>
> Thanks,
> Lasantha
>
>
> On 21 October 2013 22:54, Lasantha Fernando <[email protected]> wrote:
>
>> Hi all,
>>
>> We are getting the following error when browsing application logs/system
>> logs via management console UI.
>>
>> [2013-10-21 22:35:29,530] ERROR - {RPCMessageReceiver}  Could not
>> initialize class org.wso2.carbon.logging.util.LoggingUtil
>> java.lang.reflect.InvocationTargetException
>> 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
>> 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: java.lang.NoClassDefFoundError: Could not initialize class
>> org.wso2.carbon.logging.util.LoggingUtil
>>  at
>> org.wso2.carbon.logging.service.LogViewer.isValidTenant(LogViewer.java:109)
>> ... 120 more
>>
>> which is reported at [1]. We are using
>> org.wso2.carbon.logging.mgt.feature:4.2.0.
>>
>> A 4.2.1 version of the feature is also available which was created after
>> CC refactoring. However, am getting the following error at p2-profile-gen
>> stage when this version is included to the pack.
>>
>> Installation failed.
>> Cannot complete the install because one or more required items could not
>> be found.
>>  Software being installed: WSO2 Carbon - Logging Management Feature 4.2.1
>> (org.wso2.carbon.logging.mgt.feature.group 4.2.1)
>>  Missing requirement: org.wso2.carbon.logging.service 4.2.1
>> (org.wso2.carbon.logging.service 4.2.1) requires 'package
>> org.springframework.util [3.1.0.wso2v1,3.2.0)' but it could not be found
>>  Cannot satisfy dependency:
>>   From: WSO2 Carbon - Logging Management Feature 4.2.1
>> (org.wso2.carbon.logging.mgt.feature.group 4.2.1)
>>   To: org.wso2.carbon.logging.mgt.server.feature.group [4.2.1]
>>  Cannot satisfy dependency:
>>   From: WSO2 Carbon - Logging Management Core Feature 4.2.1
>> (org.wso2.carbon.logging.mgt.server.feature.group 4.2.1)
>>   To: org.wso2.carbon.logging.service [4.2.1]
>> Application failed, log file location:
>> /home/lasantha/.m2/repository/org/eclipse/tycho/tycho-p2-runtime/0.13.0/eclipse/configuration/1382372488588.log
>>
>> Any idea why this exception is occurring? Would appreciate much if
>> someone can give a pointer regarding the exception...
>>
>> Thanks!
>> Lasantha
>>
>> [1] https://wso2.org/jira/browse/CEP-581
>>
>> --
>> *Lasantha Fernando*
>> Software Engineer - Data Technologies Team
>> WSO2 Inc. http://wso2.com
>>
>> email: [email protected]
>> mobile: (+94) 71 5247551
>>
>
>
>
> --
> *Lasantha Fernando*
> Software Engineer - Data Technologies Team
> WSO2 Inc. http://wso2.com
>
> email: [email protected]
> mobile: (+94) 71 5247551
>



-- 
Isuru Perera
Senior Software Engineer | WSO2, Inc. | http://wso2.com/
Lean . Enterprise . Middleware

about.me/chrishantha
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to