472,355 Members | 1,739 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,355 software developers and data experts.

"Selection does not contain a main type" error help me out to resolve the issue

Hi,
I am trying to run the JAVA pgm, but it is giving error as "selection does not contain a main type".
The filename is "ScoreLeadSummary.java" when i try to run it or debug,it gives the pop up as "selection does not contain a main type"

Please help me out in resolving the above issue to run the .java file.
I am facing same issue with other .java files inside the project
The code is as shown below:
Expand|Select|Wrap|Line Numbers
  1. package com.trilogy.dealerportal.web.component.dealer;
  2.  
  3. import com.trilogy.dealerportal.domain.Disposition;
  4. import com.trilogy.dealerportal.domain.ScoredLead;
  5. import com.trilogy.dealerportal.domain.ScoreCategory;
  6. import com.trilogy.dealerportal.security.AuthenticationService;
  7. import com.trilogy.dealerportal.service.DealerService;
  8. import com.trilogy.dealerportal.service.ScoreCategoryService;
  9. import org.apache.tapestry.BaseComponent;
  10. import org.apache.tapestry.IRequestCycle;
  11. import org.apache.tapestry.annotations.ComponentClass;
  12. import org.apache.tapestry.annotations.EventListener;
  13. import org.apache.tapestry.annotations.InjectObject;
  14. import org.apache.tapestry.annotations.Parameter;
  15. import org.apache.tapestry.components.IPrimaryKeyConverter;
  16. import org.apache.tapestry.event.BrowserEvent;
  17. import org.apache.tapestry.form.IPropertySelectionModel;
  18. import org.apache.tapestry.form.StringPropertySelectionModel;
  19. import org.json.JSONException;
  20. import org.json.JSONObject;
  21.  
  22. import java.text.DateFormat;
  23. import java.text.DecimalFormat;
  24. import java.text.Format;
  25. import java.util.ArrayList;
  26. import java.util.Collections;
  27. import java.util.Comparator;
  28. import java.util.List;
  29. import java.util.Map;
  30.  
  31. /**
  32.  * Scored lead summary component
  33.  *
  34.  * @author SoftServe
  35.  */
  36. @ComponentClass(allowBody = true, allowInformalParameters = false)
  37. public abstract class ScoredLeadSummary extends BaseComponent {
  38.     private static final IPropertySelectionModel DISPOSITION_MODEL;
  39.     private static final Format SCORE_FORMAT = new DecimalFormat("#");
  40.  
  41.     @InjectObject(value = "spring:dealerService")
  42.     public abstract DealerService getDealerService();
  43.  
  44.     @InjectObject("spring:authenticationService")
  45.     public abstract AuthenticationService getAuthenticationService();
  46.  
  47.     @Parameter(required = true)
  48.     public abstract DateFormat getDateFormat();
  49.  
  50.     @Parameter(required = true)
  51.     public abstract List<ScoredLead> getScoredLeads();
  52.  
  53.     @InjectObject("spring:scoreCategoryService")
  54.     public abstract ScoreCategoryService getScoreCategoryService();
  55.  
  56.     @Parameter(required = true)
  57.     public abstract int getItemsPerPage();
  58.  
  59.     @Parameter(required = true)
  60.     public abstract int getCurrentPage();
  61.  
  62.     public abstract ScoredLead getLead();
  63.     public abstract void setLead(ScoredLead lead);
  64.  
  65.     public abstract String getCurrent();
  66.     public abstract void setCurrent(String current);
  67.  
  68.     public abstract int getOrder();
  69.     public abstract void setOrder(int order);
  70.  
  71.  
  72.     private List<ScoredLead> scoredLeads = new ArrayList<ScoredLead>();
  73.  
  74.     static {
  75.         // initialize disposition model
  76.         Disposition dispositions[] = Disposition.values();
  77.         String strings[] = new String[dispositions.length];
  78.         for (int i = 0; i < dispositions.length; i++) {
  79.             strings[i] = dispositions[i].getDescription();
  80.         }
  81.         DISPOSITION_MODEL = new StringPropertySelectionModel(strings);
  82.     }
  83.  
  84.     public List<ScoredLead> getSortedLeads() {
  85.         int startIndex = getCurrentPage() * getItemsPerPage();
  86.         if (startIndex >= scoredLeads.size() - getItemsPerPage()) {
  87.             startIndex = scoredLeads.size() - getItemsPerPage();
  88.         }
  89.         if (startIndex < 0) {
  90.             startIndex = 0;
  91.         }
  92.         int endIndex = startIndex + getItemsPerPage();
  93.         if (endIndex > scoredLeads.size()) {
  94.             endIndex = scoredLeads.size();
  95.         }
  96.         if (getCurrent() != null) {
  97.             SortElement element = ((SortElement) getComponent(getCurrent()));
  98.             Comparator<Object> comparator = element.getComparator(getOrder());
  99.             if (comparator != null) {
  100.                 Collections.sort(scoredLeads, comparator);
  101.             }
  102.         }
  103.         return scoredLeads.subList(startIndex, endIndex);
  104.     }
  105.  
  106.     public boolean isCredit() {
  107.         return getDealerService().getDealerById(getAuthenticationService().getUserId()).getCredit();
  108.     }
  109.  
  110.     public Format getScoreFormat() {
  111.         return SCORE_FORMAT;
  112.     }
  113.  
  114.     public String getJson() throws JSONException {
  115.         ScoredLead lead = getLead();
  116.         ScoreCategoryService scoreCategoryService = getScoreCategoryService();
  117.         JSONObject json = new JSONObject();
  118.         json.append("firstName", lead.getFirstName());
  119.         json.append("lastName", lead.getLastName());
  120.         json.append("address", lead.getAddress());
  121.         json.append("zip", lead.getZip());
  122.         json.append("phone", lead.getPhone());
  123.         json.append("email", lead.getEmail());
  124.         json.append("year", lead.getYear());
  125.         // make sure this is compatible with {@link #SCORE_FORMAT}
  126.         ScoreCategory category = scoreCategoryService.getScoreCategoryByScore(Math.round(lead.getScore()));
  127.         json.append("score", category.getName());
  128.         json.append("make", lead.getMake());
  129.         json.append("model", lead.getModel());
  130.         json.append("autoFICO", lead.getAutoFICO());
  131.         json.append("house", lead.getHouse());
  132.         json.append("age", lead.getAge());
  133.         json.append("incomeRange", lead.getIncomeRange());
  134.         json.append("providerName", lead.getProviderName());
  135.         json.append("requestDate", lead.getRequestDate() != null ? getDateFormat().format(lead.getRequestDate()) : "");
  136.         json.append("autoLoans", lead.getAutoLoans());
  137.         json.append("autoLeases", lead.getAutoLeases());
  138.         json.append("scoreColor", category.getColor());
  139.         return json.toString();
  140.     }
  141.  
  142.     /**
  143.      * Get map string representation. Displays string which consists of two components - map size and maximum map value.
  144.      *
  145.      * @param map map of values. Usually either {@link com.trilogy.dealerportal.domain.Lead#autoLoans} or
  146.      * {@link com.trilogy.dealerportal.domain.Lead#autoLeases}
  147.      * @return map string representation. Returns null if map either empty or has no values which are not nulls
  148.      */
  149.     public String toString(Map<String, Integer> map) {
  150.         if (map == null || map.size() == 0) {
  151.             return "";
  152.         }
  153.         Integer maxValue = null;
  154.         for (Integer value: map.values()) {
  155.             maxValue = (maxValue == null || value != null && value > maxValue ? value : maxValue);
  156.         }
  157.         return map.size() + "-$" + (maxValue == null ? 0 : maxValue);
  158.     }
  159.  
  160.     public IPropertySelectionModel getDispositionModel() {
  161.         return DISPOSITION_MODEL;
  162.     }
  163.  
  164.     /**
  165.      * Credit infor change event listener. {@link #setDisposition(String)} does actual work
  166.      *
  167.      * @param event event
  168.      */
  169.     @EventListener(targets = "dispositionSelect", events = "onchange")
  170.     public void dispositionChange(BrowserEvent event) {
  171.         // do nothing here
  172.     }
  173.  
  174.     /**
  175.      * Converter method to convert <code>ScoredLead</code> into <code>long</code> and vice versa
  176.      *
  177.      * @return converter
  178.      */
  179.     public IPrimaryKeyConverter getConverter() {
  180.         return new IPrimaryKeyConverter() {
  181.             public Object getPrimaryKey(Object o) {
  182.                 return getScoredLeads().indexOf(o);
  183.             }
  184.  
  185.             public Object getValue(Object o) {
  186.                 return getScoredLeads().get((Integer) o);
  187.             }
  188.         };
  189.     }
  190.  
  191.     public String getDisposition() {
  192.         return getLead().getDisposition().getDescription();
  193.     }
  194.  
  195.     public void setDisposition(String disposition) {
  196.         // leads are read-only, at least for now
  197.     }
  198.  
  199.     public void sort(String id, int order) {
  200.         setCurrent(id);
  201.         setOrder(order);
  202.     }
  203.  
  204.     @Override
  205.     protected void cleanupAfterRender(IRequestCycle cycle) {
  206.         scoredLeads = null;
  207.         super.cleanupAfterRender(cycle);
  208.     }
  209.  
  210.     @Override
  211.     protected void prepareForRender(IRequestCycle cycle) {
  212.         scoredLeads = getScoredLeads();
  213.         super.prepareForRender(cycle);
  214.     }
  215. }
Sep 2 '08 #1
1 13156
Nepomuk
3,112 Expert 2GB
Hi HarishAdea! Welcome to bytes.com!

It's great to have you here!

When you post, please always keep to the Posting Guidelines and when you post code, please post it in [code] ... [/code] tags (which, in this post, I have added for you).

About your problem:
Correct me if I'm wrong, but I can't see a main method (which you need) in that class. And if it isn't there, of course the JRE can't find it. I'm sure, you were planning for your code to start operating in a certain method - which one is it?

Otherwise, I'll just wish you the best and hope you enjoy being part of bytes.com!

Greetings,
Nepomuk (Moderator)
Sep 2 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Lou Pecora | last post by:
g++ compiler error question. I have a container C whose constructor takes a class B that is inherited from an abstract class A. So I have the line of code: B binstance; C ...
9
by: Xiangliang Meng | last post by:
Hi, all. I see a very strange fragment code today. Uint32 enum { a = 100; b = 200; }; NOTE: Uint32 is defined to be 'unsigned' in other source files.
7
by: David Elliott | last post by:
I have created an application that will dynamically load other DLLs (plugins). The new plugin is a winform with an embedded IE Browser. I am wanting to have the form to run in its own thread....
5
by: Alfredo Magallón Arbizu | last post by:
Hi, I have an ASP.NET app that works perfectly in Windows Server 2003, but fails in Windows 2000. It fails when trying to read the data in an Excel Workbook (range.value)... The error is: ...
0
by: hamstak | last post by:
While attempting to perform a build on an .aspx page from within VS 2005 I receive the "Could not load type" error pertaining to the class representing the page. The class is derived from a custom...
2
by: magyar.laszlo | last post by:
Hi ! I have an activex .net dll in a webpage. This activeX is trying to connect to an LDAP server using System.DirectoryServices. Unfortunatelly it gets always "request for the permission of...
3
by: eros | last post by:
ALTER TABLE public.postcodes ALTER COLUMN machi TYPE varchar(100); Error: ERROR: syntax error at or near "TYPE"; Error while executing the query (State:42601, Native Code: 7) I am using...
5
by: tejesh | last post by:
I am trying to compile the following code int backend_sm_run(struct interface_data *ctx) { xsup_assert((ctx != NULL), "ctx != NULL", TRUE); xsup_assert((ctx->statemachine != NULL),...
3
by: Yansky | last post by:
If I have the following code: var abc; if(!abc){ alert('test'); }
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.