skip to Main Content

I am trying to use the eBay sample application(signing redirect) that comes along with the SDK .

I have copied the application to the webapps directory and made the appropriate changes to make it run.

Now I am getting this error.

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 16 in the generated java file
Only a type can be imported. signinredirect.Global resolves to a package

An error occurred at line: 18 in the jsp file: /credentials.jsp
Global cannot be resolved
15:   String signInURL = ""; 
16:   String ApiServerUrl = "";
17:   String reqError ="";
18:   String devId = Global.getProperty("devId");
19:   String certId = Global.getProperty("certId");
20:   String appId = Global.getProperty("appId");
21:   //runame of this sample application

The jsp code:

<html>
<head>
<title>
eBay signin redirection sample with new token fetch flow
</title>
</head>
<body bgcolor="#ffffff">
<%@ page import="com.ebay.sdk.*" %>
<%@ page import="com.ebay.sdk.call.*" %>
<%@ page import="signinredirect.Global" %>
<%@ page import="java.net.URLEncoder" %>
<%@ page errorPage="errorPage.jsp" %>

<%
  String signInURL = ""; 
  String ApiServerUrl = "";
  String reqError ="";
  String devId = Global.getProperty("devId");
  String certId = Global.getProperty("certId");
  String appId = Global.getProperty("appId");
  //runame of this sample application
  String runame = Global.getProperty("runame");

  if (request.getParameter("goToSignin") != null ) {
        reqError="";

        int environment = Integer.parseInt(request.getParameter("EnvList"));
        if (environment == 1 ) {
            // Sandbox
            signInURL =Global.getProperty("sandboxSignInUrl");
            ApiServerUrl = Global.getProperty("sandboxAPIUrl");

        } else if (environment ==2) {
            // Production
            signInURL = Global.getProperty("ebaySignInUrl");
            ApiServerUrl = Global.getProperty("ebayAPIUrl");

        }

        //Get the Credentials Information 
        devId = request.getParameter("DevID");
        if(devId.length() == 0 )
         throw new SdkException("Please enter developer ID.");
        appId  = request.getParameter("AppID");
        if( appId.length() == 0 ) 
         throw new SdkException("Please enter application ID.");
        certId = request.getParameter("CertID");
        if( certId.length() == 0 ) 
         throw new SdkException("Please enter certificate ID.");
        //Get the runame
        runame = request.getParameter("RuName");
        if(runame.length() == 0)
         throw new SdkException("Please enter runame of the sample application");


        ApiContext apiContext = Global.createApiContext(devId, appId, certId, ApiServerUrl );
        ApiLogging apiLogging = new ApiLogging();
        apiContext.setApiLogging(apiLogging);
        session.setAttribute("apicontext", apiContext );

        GetSessionIDCall api = new GetSessionIDCall(apiContext);
        api.setRuName(runame);

        String ruParams="params="+runame +"-"+(environment==1?"Sandbox":"Production");

        try {

             String sessionID = api.getSessionID();
             String encodedSesssionIDString =URLEncoder.encode(sessionID,"UTF-8");           

             session.setAttribute("sessionID", sessionID);           
             response.sendRedirect(response.encodeRedirectURL(signInURL + "&RuName=" + runame + "&SessID=" + encodedSesssionIDString + "&ruparams=" + ruParams));     

        } catch(SdkHTTPException ex) {
            reqError = "Call failed: " + ex.getMessage();
        } catch(Exception ex) {
            reqError = ex.getMessage();
        } 
}
%>

The Java class Global is present. Looks like the import is failing. Can someone tell me what I could have done wrong?

2

Answers


  1. Chosen as BEST ANSWER

    I had to create a new web application project rather than copying the sample app from sdk.


  2. It means that signinredirect.Global is a package, not a class. Try this:

    <%@ page import="signinredirect.Global.*" %>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search