Results 1 to 4 of 4

Thread: How to get Data Source in Zimlet

  1. #1
    saimohang is offline Junior Member
    Join Date
    May 2012
    Posts
    8
    Rep Power
    3

    Default How to get Data Source in Zimlet

    Hi All,

    Can any one give me a way to get Data Source in Zimlet JSP file. Actually in source I found one file 'DbPool.java' there getConnection method I found. Using this method can I get the data source reference to connect database. And I found another issue, while trying to get current user-id using Account and Provisioning classes.

    Even I tried to import pages with both ways as I found in previous threads like,
    <&#37;%@ page import="com.zimbra.cs.db.*" %> and
    %@ page import="com.zimbra.cs.account.Account" %>.

    Do I need to change or add anything to access the mentioned classes. While trying access the mentioned classes I'm getting below errors. Please give me an answer to come out from this problem.

    HTTP ERROR 500

    Problem accessing /service/zimlet/com_ktree_jspzim/KTreeJSP39.jsp. Reason:

    PWC6033: Unable to compile class for JSP

    PWC6197: An error occurred at line: 7 in the jsp file: /com_ktree_jspzim/KTreeJSP39.jsp
    PWC6199: Generated servlet error:
    cookies cannot be resolved

    PWC6197: An error occurred at line: 7 in the jsp file: /com_ktree_jspzim/KTreeJSP39.jsp
    PWC6199: Generated servlet error:
    AuthToken cannot be resolved to a type

    PWC6197: An error occurred at line: 7 in the jsp file: /com_ktree_jspzim/KTreeJSP39.jsp
    PWC6199: Generated servlet error:
    AuthToken cannot be resolved

    PWC6197: An error occurred at line: 7 in the jsp file: /com_ktree_jspzim/KTreeJSP39.jsp
    PWC6199: Generated servlet error:
    Account cannot be resolved to a type

    PWC6197: An error occurred at line: 7 in the jsp file: /com_ktree_jspzim/KTreeJSP39.jsp
    PWC6199: Generated servlet error:
    Provisioning cannot be resolved

    PWC6197: An error occurred at line: 7 in the jsp file: /com_ktree_jspzim/KTreeJSP39.jsp
    PWC6199: Generated servlet error:
    AccountBy.id cannot be resolved to a type


    Thanks and Regards

    Sai Mohan

  2. #2
    saimohang is offline Junior Member
    Join Date
    May 2012
    Posts
    8
    Rep Power
    3

    Default

    Hi All,

    Please any one help me for the issue, please let me know any thing I missed to configure in the application...

  3. #3
    yutaka is offline Project Contributor
    Join Date
    Oct 2009
    Location
    Tokyo
    Posts
    113
    Rep Power
    5

    Default

    It might help us to figure out what happens if you paste here your snipet of your source code, maybe jsp and js?

  4. #4
    saimohang is offline Junior Member
    Join Date
    May 2012
    Posts
    8
    Rep Power
    3

    Default

    Hi Yutaka,

    Please find the below code which I found in the forum to bring current user-id using JSP,



    <%@ page import="com.zimbra.cs.account.*, com.zimbra.cs.zimlet.*" %>

    <%

    String name = null;
    Provisioning prov = Provisioning.getInstance();
    javax.servlet.http.Cookie[] cookies = request.getCookies();
    String authTokenString = "";
    Account acct = null;

    for (javax.servlet.http.Cookie cookie : cookies) {
    if (cookie.getName().equals("ZM_AUTH_TOKEN")) {
    authTokenString = cookie.getValue();
    }
    }

    if (!authTokenString.equals("")) {
    AuthToken authToken = AuthToken.getAuthToken(authTokenString);
    acct = prov.get(Provisioning.AccountBy.id, authToken.getAccountId());
    }

    if (acct != null) {
    name = acct.getName();
    }

    %>


    Current User! <b><%=name%></b>

    in JavaScript I'm trying to open this in new window, but I'm getting the below error

    HTTP ERROR 500

    Problem accessing /service/zimlet/com_zimbra_example_javajar/jspfile1.jsp. Reason:

    PWC6033: Unable to compile class for JSP

    PWC6197: An error occurred at line: 19 in the jsp file: /com_zimbra_example_javajar/jspfile1.jsp
    PWC6199: Generated servlet error:
    Provisioning cannot be resolved to a type

    PWC6197: An error occurred at line: 19 in the jsp file: /com_zimbra_example_javajar/jspfile1.jsp
    PWC6199: Generated servlet error:
    Provisioning cannot be resolved

    PWC6197: An error occurred at line: 19 in the jsp file: /com_zimbra_example_javajar/jspfile1.jsp
    PWC6199: Generated servlet error:
    Account cannot be resolved to a type

    PWC6197: An error occurred at line: 19 in the jsp file: /com_zimbra_example_javajar/jspfile1.jsp
    PWC6199: Generated servlet error:
    AuthToken cannot be resolved to a type

    PWC6197: An error occurred at line: 19 in the jsp file: /com_zimbra_example_javajar/jspfile1.jsp
    PWC6199: Generated servlet error:
    AuthToken cannot be resolved

    PWC6197: An error occurred at line: 19 in the jsp file: /com_zimbra_example_javajar/jspfile1.jsp
    PWC6199: Generated servlet error:
    Provisioning.AccountBy.id cannot be resolved to a type


    I'm really unable find the solution for this problem, I'm trying this since 4 days but not getting result. Is there any I missed to include, please let me know.

    Thanks & Regards

    Sai Mohan

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. ERROR: account.NO_SUCH_DATA_SOURCE (no such data source:
    By righteousjester in forum Administrators
    Replies: 0
    Last Post: 02-15-2012, 05:13 AM
  2. Replies: 0
    Last Post: 07-07-2011, 11:45 AM
  3. Getting user authentication data in zimlet JSP
    By bogdan.mocanu in forum Zimlets
    Replies: 13
    Last Post: 01-19-2010, 11:33 AM
  4. Zimbra Data Source
    By bonoboslr in forum Administrators
    Replies: 7
    Last Post: 03-23-2009, 04:11 AM
  5. Zimbra Data Source (again)
    By bonoboslr in forum Administrators
    Replies: 0
    Last Post: 11-03-2008, 12:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •