473,416 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 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 13279
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.