473,881 Members | 1,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

1 New Member
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 "ScoreLeadSumma ry.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 13310
Nepomuk
3,112 Recognized Expert Specialist
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
33787
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 cinstance(binstance); The compiler gives the error,
9
6231
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
4008
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. This would allow for other plugins and the main application to be free to do other work. I have written a little TestDriver for the plugin and am having some difficulty. If I don't use threads everything works just fine. If I do use threads, upon...
5
3973
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: COMException (0x80020008): Bad Variable Type
0
1753
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 base class (which itself is derived from System.Web.UI.Page). This custom base class has been used in other projects successfully. The Inherits attribute of the @Page directive is properly assigned and the application root is properly...
2
2055
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 type" error. If I give full trust at the .net config tool it is working fine. Is there any way to avoid this client .net confoguration?
3
12607
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 WinSQL, Windows XP SP2 Japanese Version, PostgreSQL 8.x. I want to alter my machi field from varchar(30) to varchar(100) TYPE. This is my CREATE TABLE script:
5
3192
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), "ctx->statemachine != NULL", TRUE); backend_sm_check_globals(check);
3
2026
by: Yansky | last post by:
If I have the following code: var abc; if(!abc){ alert('test'); }
0
9776
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11105
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10724
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10403
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7954
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7113
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5978
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3226
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.