Incompatible Type?

Trouble at the end of this code involving incompatible types within word = listEasy.get(wordArrayLocation); along with the other two in that method. Says it needs a java.lang.String.
import java.util.Random;
import java.util.Scanner;
import java.util.ArrayList;
import java.io.FileReader;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.lang.String;
public class WordArray
   public WordArray() throws FileNotFoundException
      Creation of 3 word arrays based off of the desired level of game difficulty
      ArrayList<String> listEasy = new ArrayList<String>();
      ArrayList<String> listIntermediate = new ArrayList<String>();
      ArrayList<String> listHard = new ArrayList<String>();
      //open the physical files (words*.txt) for use in the corresponding ArrayList
      FileReader readerEasy = new FileReader("wordsEasy.txt");
      FileReader readerIntermediate = new FileReader("wordsIntermediate.txt");
      FileReader readerHard = new FileReader("wordsHard.txt");
      use a Scanner object called "in*" to access the respective file handle.  
      Scanner inEasy = new Scanner(readerEasy);
      Scanner inIntermediate = new Scanner(readerIntermediate);
      Scanner inHard = new Scanner(readerHard);
   Use a loop to walk through the input file WordsEasy.txt reading one line at a time. 
   while (inEasy.hasNext())
      String record = inEasy.next();
      listEasy.add(record);
   Use a loop to walk through the input file WordsIntermediate.txt reading one line at a time. 
   while (inIntermediate.hasNext())
      String record = inIntermediate.next();
      listIntermediate.add(record);
   Use a loop to walk through the input file WordsHard.txt reading one line at a time. 
   while (inHard.hasNext())
      String record = inHard.next();
      listHard.add(record);
   inEasy.close();
   inIntermediate.close();
   inHard.close();
   set ListEasy's size
   public int setListEasySize()
      listEasySize = listEasy.size();
   set ListIntermediate's size
   public int setListIntermediateSize()
      listIntermediateSize = listIntermediate.size();
   set ListHard's size
   public int setListHardSize()
      listHardSize = listHard.size();
   public int setGeneratorLength(int difficultyLevel)
      if (difficultyLevel == 3)
         generatorLength = listHardSize - 1;
      else if(difficultyLevel == 2)
         generatorLength = listIntermediateSize - 1;
      else
         generatorLength = listEasySize - 1;
      Picks a random word
      @return
   public int randWord()
      Random generator = new Random();
      wordArrayLocation = generator.nextInt(generatorLength);
   public String getWord(int difficultyLevel)
      if (difficultyLevel == 3)
         word = listHard.get(wordArrayLocation);
      else if(difficultyLevel == 2)
         word = listIntermediate.get(wordArrayLocation);
      else
         word = listEasy.get(wordArrayLocation);
      return word;
   private String word;
   private int wordArrayLocation;
   private int generatorLength;
   private int listEasySize;
   private int listIntermediateSize;
   private int listHardSize;
   private ArrayList<WordArray> listEasy;  
   private ArrayList<WordArray> listIntermediate;
   private ArrayList<WordArray> listHard;
}

Here is what I have changed things to...
import java.util.Random;
import java.util.Scanner;
import java.util.ArrayList;
import java.io.FileReader;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.lang.String;
public class WordArray
   public WordArray() throws FileNotFoundException
      Creation of 3 word arrays based off of the desired level of game difficulty
      //open the physical files (words*.txt) for use in the corresponding ArrayList
      FileReader readerEasy = new FileReader("wordsEasy.txt");
      FileReader readerIntermediate = new FileReader("wordsIntermediate.txt");
      FileReader readerHard = new FileReader("wordsHard.txt");
      use a Scanner object called "in*" to access the respective file handle.  
      Scanner inEasy = new Scanner(readerEasy);
      Scanner inIntermediate = new Scanner(readerIntermediate);
      Scanner inHard = new Scanner(readerHard);
   Use loops to walk through the input file reading one line at a time. 
      while (inEasy.hasNext())
         String record = inEasy.next();
         listEasy.add(record);
      while (inIntermediate.hasNext())
         String record = inIntermediate.next();
         listIntermediate.add(record);
      while (inHard.hasNext())
         String record = inHard.next();
         listHard.add(record);
   inEasy.close();
   inIntermediate.close();
   inHard.close();
   set the size of of the arraylists to a variable.
   public void setListEasySize()
      listEasySize = listEasy.size();
   public void setListIntermediateSize()
      listIntermediateSize = listIntermediate.size();
   public void setListHardSize()
      listHardSize = listHard.size();
   //Set the difficulty level from user input  
   public void setDifficultyLevel(int difficulty)
      difficultyLevel = difficulty;
   //Calculate the wanted randomm generator length depending on the difficulty level
   public void setGeneratorLength()
      if (difficultyLevel == 3)
         generatorLength = listHardSize - 1;
      else if(difficultyLevel == 2)
         generatorLength = listIntermediateSize - 1;
      else
         generatorLength = listEasySize - 1;
   // Calculates what random arraylist location to pull an object from
   public void randWord()
      Random generator = new Random();
      wordArrayLocation = generator.nextInt(generatorLength);
      Sets the selected arraylist object to another object
   public void setWordObject()
      if (difficultyLevel == 3)
         wordObject = (listHard.get(wordArrayLocation));
      else if(difficultyLevel == 2)
         wordObject = listIntermediate.get(wordArrayLocation);
      else
         wordObject = listEasy.get(wordArrayLocation);
      returns the word
      @return
   public String getWord()
      word = wordObject.toString();
      return word;
   private ArrayList<String> listEasy = new ArrayList<String>();
   private ArrayList<String> listIntermediate = new ArrayList<String>();
   private ArrayList<String> listHard = new ArrayList<String>();
   private String word;
   private Object wordObject;
   private int difficultyLevel;
   private int wordArrayLocation;
   private int generatorLength;
   private int listEasySize;
   private int listIntermediateSize;
   private int listHardSize;
}Edited by: jojavawuz on Nov 19, 2008 8:34 AM

Similar Messages

  • Incompatible types - found java.lang.String but expected int

    This is an extremely small simple program but i keep getting an "incompatible types - found java.lang.String but expected int" error and dont understand why. Im still pretty new to Java so it might just be something stupid im over looking...
    import java.io.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class Lab
    public static void main(String []args)
    int input = JOptionPane.showInputDialog("Input Decimal ");
    String bin = Integer.toBinaryString(input);
    String hex = Integer.toHexString(input);
    System.out.println("Decimal= " + input + '\n' + "Binary= " + bin + '\n' + "Hexadecimal " + hex);
    }

    You should always post the full, exact error message.
    Your error message probably says that the error occurred on something like line #10, the JOptionPane line. The error is telling you that the compiler found a String value, but an int value was expected.
    If you go to the API docs for JOptionPane, it will tell you what value type is returned for showInputDialog(). The value type is String. But you are trying to assign that value to an int. You can't do that.
    You will need to assign the showInputDialog() value to a String variable. Then use Integer.parseInt(the_string) to convert to an int value.

  • Incompatible types with generics problem

    Hi,
    I get a mysterious compiler error:
    C:\Documents and Settings\Eigenaar\Mijn documenten\NetBeansProjects\Tests\src\tests\genericstest.java:26: incompatible types
    found : tests.Store<T>
    required: tests.Store<T>
    return store;
    1 error
    BUILD FAILED (total time: 0 seconds)
    in the following code:
    class Supply<T extends Supply<T>>{}
    class Store<T extends Supply<T>>{ }
    class A<T extends Supply<T>>{
        private Store<T> store;
        class B<T extends Supply<T>> {
            public Store<T> getStore(){
                return store;                         <-- compiler error!
    }Any help would be greatly appreciated.
    Edited by: farcat on Jan 13, 2009 1:23 PM

    Note that the type parameter T used to define class B is not the T used to define class A. What you wrote can be more clearly written:
    class Supply<T extends Supply<T>>{}
    class Store<T extends Supply<T>>{ }
    class A<T extends Supply<T>>{
        private Store<T> store;
        class B<U extends Supply<U>> {
            public Store<U> getStore(){
                return store;
    }Which produces the more readable error message:
    A.java:10: incompatible types
    found   : Store<T>
    required: Store<U>
                return store;B, being a nested, non-static class is already parameterized by T:
    class Supply<T extends Supply<T>>{}
    class Store<T extends Supply<T>>{ }
    class A<T extends Supply<T>>{
        private Store<T> store;
        class B {
            public Store<T> getStore(){
                return store;
    }

  • Incompatible types in case statement

    I'm getting incompatible types inside this case statement :
    inString = s_in.readUTF();
                switch (inString.substring(1,3))
                    case nam:
                        ChatClient.nameArea.append(inString);
                        break;
                    case txt:
                        ChatClient.chatArea.append( "\n >>>" + inString );
                        break;
                }If you want, or need to see more or all of the code in this class, just ask.

    This is because you can't use Strings within a switch statement. Use if statements instead.

  • Incompatible types - found, required...

    Experts,
    I am getting the following failure. What am I missing?
    Javac output,
    #javac .\org\ocap\dvr\*.java
    .\org\ocap\dvr\TestRecord.java:123: incompatible types
    found : org.ocap.shared.dvr.RecordingManager
    required: org.ocap.dvr.OcapRecordingManager
    recManager = OcapRecordingManager.getInstance();
    ^
    The source code is as follows,
    In .\src\org\ocap\shared\dvr\RecordingManager.java
    ----------------- START --------------------
    package org.ocap.shared.dvr;
    public abstract class RecordingManager
    public static RecordingManager getInstance()
    return null;
    // stuff deleted
    ------------------ END -------------------
    In .\src\org\ocap\dvr\OcapRecordingManager.java
    ----------------- START --------------------
    package org.ocap.dvr;
    import org.ocap.dvr.*;
    import org.ocap.shared.dvr.*;
    public abstract class OcapRecordingManager extends RecordingManager
    // stuff deleted
    ------------------ END -------------------
    In .\src\org\ocap\dvr\OcapRecordingManagerImpl.java
    ----------------- START --------------------
    package org.ocap.dvr;
    import org.ocap.dvr.*;
    import org.ocap.shared.dvr.*;
    public class OcapRecordingManagerImpl extends OcapRecordingManager
    private static OcapRecordingManager mOcapRecordingManager = null;
    public static OcapRecordingManager getInstance()
    if (mOcapRecordingManager == null)
    mOcapRecordingManager = new OcapRecordingManagerImpl();
    return mOcapRecordingManager;
    ------------------ END -------------------
    In .\src\org\ocap\dvr\TestRecord.java
    ----------------- START --------------------
    package org.ocap.dvr;
    import org.ocap.dvr.OcapRecordingManager;
    import org.ocap.shared.dvr.RecordingManager;
    class TestRecord
    //Object of OcapRecordingManager class
    private static OcapRecordingManager recManager = null;
    public static void main(String args[])
    recManager = OcapRecordingManager.getInstance();
    if(recManager == null)
    System.out.println ("Value obtained in OcapRecordingManagerImpl reference is null");
    ------------------ END -------------------
    Thanks!

    Please don't crosspost!
    http://forum.java.sun.com/thread.jspa?threadID=5210277&messageID=9846716#9846716

  • [SOLVED] XSD simpleType trying to assign incompatible types

    Hi all!
    I have a big XSD schema with complex and simple types defined. One of the simple types looks like this (string with min and max length defined):
         <xsd:simpleType name="MySimpleType">
              <xsd:restriction base="xsd:string">
                   <xsd:minLength value="1" />
                   <xsd:maxLength value="36" />
              </xsd:restriction>
         </xsd:simpleType>I assign (copy operation) a string variable to an element of this type. When I compile i get the trying to assign incompatible types warning. I know it's just a warning but I'd like to solve it. I thought I can create a variable of the same type, but I can't (if I try to define message type only the complex type from XSD are displayed).
    Is there a way to get rid of this warning?
    Thanks

    instead of using a variable assignment use the expression builder to construct the 'bpws:getVariableData() equivalent of the variable assignment. The warning will no longer exist.

  • ORABPEL-10041 Trying to assign incompatible types

    Hi,
    I'm developing a BPEL process which takes an input xml file and inserts data into AP interface tables. I used a file adapter to read the input file and used applications adapter to import ap interface tables.
    I use the assign activity to assign the number value from my xml file to the invoice_id column in the ap_invoices_interface column. I get the following warning. Can anyone please tell me how do I fix this. I have BPEL 10.1.2.2 installed.
    Warning(29):
    [Error ORABPEL-10041]: Trying to assign incompatible types
    [Description]: in line 29 of "C:\OraBPELPM_1\integration\jdev\jdev\mywork\Workspace1\BPELProcess_TestInsert\BPELProcess_TestInsert.bpel", <from> value type "{http://www.w3.org/2001/XMLSchema}string" is not compatible with <to> value type "{http://www.w3.org/2001/XMLSchema}long".
    [Potential fix]: Please make sure that the return value of from-spec query is compatible with the to-spec query.
    Thanks

    This is just a warning so it does not mean that your process will fail, e.g. string to decimal may work for the string holds a number, but will fail if it has a string.
    So if you know the data you can safely ignore, otherwise you will have to do some transofrmation within an assign.
    cheers
    James

  • Incompatible  types

    I get the following error message:
    headoffice.java:181: incompatible types
    found : java.lang.String
    required: int
    switch (sa[3]) //sa[3] contains customer type
    ^
    headoffice.java:183: incompatible types
    found : java.lang.String
    required: int
    case �B�:
    ^
    headoffice.java:186: incompatible types
    found : java.lang.String
    required: int
    case �G�:
    ^
    3 errors
    ...and it is associated with the piece of code below. I do not understand in what way the �G� and �B� are incompatible types with sa[3] which is supposed to hold strings.
    StringTokenizer st=new StringTokenizer(s, �*�);     
    String[] sa=new String[st.countTokens()]; int i=0;          
    while(st.hasMoreTokens())
    sa=st.nextToken();     
    i++;               
    switch (sa[3]) //sa[3] contains customer type
    case �B�:
    BronzeCustomer anotherBronzeCustomer = new BronzeCustomer(sa[0], sa[1]);     break;
    case �G�:
    GoldCustomer anotherGoldCustomer = new GoldCustomer(sa[0], sa[1]);     break;
    default: return;
    // break;     
    What is the problem here?
    Regards
    TJ

    If you are using only 1-character strings, then you can do:
       switch (sa[3].charAt(0)) //sa[3] contains customer type
          case 'B': // ...
          case 'G': // ...
          // etc.
       }

  • Incompatible type error

    I am receiving the following errors:
    incompatible types
    found: int
    required: boolean
    if (accessCode = 8345)
    if (accessCode = 55875)
    if (accessCode = 999909)
    I do not understand why I am getting the errors. accessCode is of type int.
    Thanks in advance for any input.
    int accessCode = Integer.parseInt( String.valueOf(
      securityCodeJPasswordField.getPassword() ) );
         int code;
         if (accessCode >= 1645 && accessCode <= 1689)
             code = 1;
         else
         if (accessCode  = 8345)
                code = 2;
         else
         if (accessCode = 55875)
             code = 3;
         else
         if (accessCode = 999898)
             code = 4;
         else
         if (accessCode >= 1000006 && accessCode <= 1000008)
             code = 5;
         else
         if (accessCode < 1000)
             code = 6;
         else
                        code = accessCode;

    Thanks !! I am stuck in the coding syntax that I use in my job: SAS

  • Incompatible Types... NOT!

    Why am I getting incompatible types in this method?
    C:\jdk1.3\src\CalcBusinessDays.java:53: incompatible types
    found : java.util.Date
    required: Date
              Date covDate = sdf.parse(dt, pos);^ <-- carat is at end of line
         public Date dateConvert(String dt) {
              SimpleDateFormat sdf = new SimpleDateFormat("mm/dd/yyyy");
              ParsePosition pos = new ParsePosition(0);
              Date covDate = sdf.parse(dt, pos);
              return covDate;
         }     //dateConvert
    Thanks in advance.

    Actually I'm in Hartford, CT, where NJ sends its rain! I used to live in Staten Island which is close to NJ as you know. Also worked in Parsippany for a while.
    I think "Date" needs to be changed to "java.util.Date" in three places. See comments below where changes are marked. I could not compile or test because I don't have Domino / Notes.
    By the way, in case you get similar problems with another class (Calendar?), I believe that the lotus.domino classes are AgentBase, AgentContext, Session and DateTime. The others should be standard Java classes. Good Luck.
    import java.util.*;
    import java.text.*;
    import java.math.*;
    import lotus.domino.*;
    public class CalcBusinessDays extends AgentBase {
        public void NotesMain() {
            DateTime startTime = null, endTime = null;
            String startTimeStr, endTimeStr, result;
            try {
                Session session = getSession();
                AgentContext agentContext = session.getAgentContext();
                startTimeStr = "04/12/2000";
                endTimeStr = "05/04/2000";
                startTime = session.createDateTime(startTimeStr);
                endTime = session.createDateTime(endTimeStr);
                result = diffInWeekdays(startTime, endTime, startTimeStr,
                endTimeStr);
                System.out.println("Result = " + result);
            } catch(Exception e) {
                e.printStackTrace();
        } //NotesMain
        public String diffInWeekdays(DateTime startTime, DateTime endTime, String startTimeStr, String endTimeStr) {
            String res = "";
            try {
                Date firstDate = null, secondDate = null;
                int diffInt = endTime.timeDifference(startTime);
                int diffIntDays = (diffInt / 86400 + 1);
                BigInteger sev = BigInteger.valueOf(7);
                BigInteger minusTwo = BigInteger.valueOf(-2);
                BigInteger bis = BigInteger.valueOf(getWeekday(firstDate = dateConvert(startTimeStr)));
                BigInteger bie = BigInteger.valueOf(getWeekday(secondDate = dateConvert(endTimeStr)));
                int strtDay = bis.mod(sev).intValue();
                int endDay = bie.mod(sev).intValue();
                int max = minusTwo.max(BigInteger.valueOf(strtDay * -1)).intValue();
                int min = BigInteger.valueOf(1).min(bie.mod(sev)).intValue();
                int result = (diffIntDays - endDay + strtDay - 8) * 5 / 7 - max - min + 5 - strtDay + endDay;
                //o.println("result =\t" + result);
                res = Integer.toString(result);
            } catch (Exception e) {
                e.printStackTrace();
            return res;
        } //diffInWeekdays
        public java.util.Date dateConvert(String dt) {          // *** changed
            SimpleDateFormat sdf = new SimpleDateFormat("mm/dd/yyyy");
            ParsePosition pos = new ParsePosition(0);
            java.util.Date covDate = sdf.parse(dt, pos);       // *** changed
            return covDate;
        } //dateConvert
        public int getWeekday(java.util.Date cdt) {            // *** changed
            Calendar cal = Calendar.getInstance();
            cal.setTime(cdt);
            return cal.get(Calendar.DAY_OF_WEEK);
        } //getWeekday
    } //CalcBusinessDays

  • Error in Parser.fx file "incompatible types found   : java.util.Properties"

    Hi,
    In parser file "Parser.fx",
    public-read def PROPERTIES_PARSER = StreamParser {
    override public function parse(input : java.io.InputStream) : RecordSet {
    var props = javafx.util.Properties {};
    props.load(input);
    input.close();
    MemoryRecordSet {
    records: [
    MapRecord {
    fields: props
    due to under line portion an error is appearing:
    "incompatible types
    found : javafx.util.Properties
    required: java.util.Map
    fields: props".
    Please suggest some solution.
    Thanks in advance.
    regards,
    Choudhary Nafees Ahmed
    Edited by: ChoudharyNafees on Jul 5, 2010 3:48 AM

    Parser.fx
    package org.netbeans.javafx.datasrc;
    import javafx.data.pull.PullParser;
    import javafx.data.pull.Event;
    import org.netbeans.javafx.datasrc.MemoryRecordSet;
    public-read def PROPERTIES_PARSER = StreamParser {
        override public function parse(input : java.io.InputStream) : RecordSet {
            var props =java.util.Properties{};
            props.load(input);
            input.close();
            MemoryRecordSet {
                records: [
                    MapRecord {
                        fields: props
    public-read def LINE_PARSER_FIELD_LINE = ".line";
    public-read def LINE_PARSER = StreamParser {
        override public function parse(input : java.io.Reader) : RecordSet {
            var line : String;
            var result : Record [] = [];
            line = readLine(input);
            // BEWARE  ("" == null) is true
            while (line != null or "".equals(line)) {
                var map = new java.util.HashMap();
                map.put(LINE_PARSER_FIELD_LINE, line);
                var record = MapRecord {
                    fields: map
                insert record into result;
                line = readLine(input);
            MemoryRecordSet {
                records: result
    function readLine(in : java.io.Reader) : String {
        var str = new java.lang.StringBuilder;
        while (true) {
            var c = in.read();
            if (c == -1) {
                return if (str.length() == 0) then null else str.toString();
            } else if (c == 0x0D) {
                c = in.read();
                if (c == 0x0A or c == -1) {
                    return str.toString();
                str.append(0x0D);
            } else if (c == 0x0A) {
                return str.toString();
            str.append(c as Character);
        str.toString()
    public-read def JSON_PARSER = StreamParser {
        function toSequence(list : java.util.List) : Record [] {
            var result : Record [] = [];
            var ii = list.iterator();
            while (ii.hasNext()) {
                var r = ii.next() as Record;
                insert r into result;
            result
        override public function parse(input : java.io.InputStream) : RecordSet {
            var topLevel : Object;
            def parser = PullParser {
                documentType: PullParser.JSON
                input: input
                var mapStack = new java.util.Stack();
                var currentMap : java.util.Map;
                var recordsStack = new java.util.Stack();
                var currentRecords : java.util.List;
                var lastEvent: Event;
                onEvent: function(event: Event) {
                    if (event.type == PullParser.TEXT) {
                        currentMap.put(event.name, event.text)
                    } else if (event.type == PullParser.INTEGER) {
                        currentMap.put(event.name, event.integerValue)
                    } else if (event.type == PullParser.NULL) {
                        currentMap.put(event.name, null)
                    } else if (event.type == PullParser.START_ELEMENT) {
                        if (lastEvent.type == PullParser.START_ARRAY_ELEMENT) return;
                        var oldMap = currentMap;
                        var temp = new java.util.HashMap();
                        temp.put(new Object(), null);
                        currentMap = temp;
                        currentMap.clear();
                        mapStack.push(currentMap);
                        if (topLevel == null) topLevel = currentMap;
                        if (oldMap != null) {
                            var mr = MapRecord {
                                fields: currentMap
                            if (event.name == "" and lastEvent.type == PullParser.START_VALUE) {
                                oldMap.put(lastEvent.name, mr)
                            } else {
                                oldMap.put(event.name, mr)
                    } else if (event.type == PullParser.START_ARRAY_ELEMENT) {
                        var temp = new java.util.HashMap();
                        temp.put(new Object(), null);
                        currentMap = temp;
                        currentMap.clear();
                        mapStack.push(currentMap);
                        var mr = MapRecord {
                            fields: currentMap
                        currentRecords.add(mr);
                    } else if (event.type == PullParser.END_ELEMENT) {
                        mapStack.pop();
                        if (not mapStack.empty()) {
                            currentMap = mapStack.peek() as java.util.HashMap;
                        } else {
                            currentMap = null;
                    } else if (event.type == PullParser.END_ARRAY_ELEMENT) {
                        if (lastEvent.type == PullParser.END_ELEMENT) return;
                        mapStack.pop();
                        if (not mapStack.empty()) {
                            currentMap = mapStack.peek() as java.util.HashMap;
                        } else {
                            currentMap = null;
                    } else if (event.type == PullParser.START_ARRAY) {
                        currentRecords = new java.util.ArrayList();
                        recordsStack.push(currentRecords);
                        if (topLevel == null) topLevel = currentRecords;
                    } else if (event.type == PullParser.END_ARRAY) {
                        var set = MemoryRecordSet {
                            records: toSequence(currentRecords)
                        currentMap.put(event.name, set);
                        recordsStack.pop();
                        if (not recordsStack.empty()) {
                            currentRecords = recordsStack.peek() as java.util.List;
                        } else {
                            currentRecords = null;
                    lastEvent = event;
            parser.parse();
            if (topLevel instanceof java.util.Map) {
                var mr = MapRecord {
                    fields: topLevel as java.util.Map
                MemoryRecordSet {
                   records: [mr]
            } else {
                // List
                var rs = MemoryRecordSet {
                    records: toSequence(topLevel as java.util.List)
                rs
            parser.parse();
            var mr = MapRecord {
                fields: topLevel as java.util.Map
            MemoryRecordSet {
               records: [mr]

  • Incompatible types in CMP .. How to read RAW

    MY CMP bean has a few CMP fields which are of type byte[] in the database i
    created dbfields having RAW datatype. Deployment is Successfull. but when i
    try to create this CMP then the ejbexception is thrown and it is having a
    nested exception SQLException Incompatible types
    Please help

    "LJS Narayana" <[email protected]> wrote in message
    news:[email protected]..
    MY CMP bean has a few CMP fields which are of type byte[] in the databasei
    created dbfields having RAW datatype. Deployment is Successfull. but wheni
    try to create this CMP then the ejbexception is thrown and it is having a
    nested exception SQLException Incompatible types
    Please help

  • Incompatible types in simple odbc statements

    this is my simple code
    import java.sql.*;
    public class QueryApp {
         public static void main(String a[]){
              try{
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   Connection con;
                   con=DriverManager.getConnection("jdbc:odbc:MyDataSource","nik","123456");
                   Statement stat=con.createStatement();
                   stat.executeQuery("Select * from Publishers");
              catch(Exception e){
                   System.out.println("Error:"+e);
    }after this when i compile i get these errors
    QueryApp.java:15: incompatible types
    found   : java.sql.Connection
    required: Connection
                con=DriverManager.getConnection("jdbc:odbc:MyDataSource","nik","123456");
                                                           ^
    QueryApp.java:16: cannot find symbol
    symbol  : method createStatement()
    location: class Connection
                Statement stat=con.createStatement();
                                              ^
    2 errorsCan some body help me on this error as searching on net wasn't fruitfull?

    1) You probably created a Connection class your compiler tries to use instead of java.sql.Connection. I advise to rename your class, or at least use the fully qualified classname for declaring con.
    2) The Connection class you created does not have such a method.

  • Incompatible types in assignment

    Hello everyone,
    I'm quite new to objective-c programming. So far, i pretty much solved everything either on my own with the documentation, and with some googling. One problem i haven't solved was how to detect a swipe on a uiscrollview, but i thought i found another way to do it.
    However, when i'm trying to get the contentoffset.x of my scrollview (named dayScrollView) and store it in a CGFloat, i get a compiler error ' incompatible types in assignment'. I have been able to access it just fine, however now it's giving me trouble.
    I declared the float in the header file (CGFloat *deceleratingTouch), and then tried to store it in the implementation file (deceleratingTouch=dayScrollView.contentOffset.x;). What is possible that went wrong? as i said, i'm quite new, so i sometimes make the stupidest mistakes.

    Ok, it was solved. Apparently, CGFloat doesn't need the asterisk if you declare it in the header file. That's what i said about stupid mistakes

  • Incompatible type  -  use of String datatype?

    I tried to compile the program but it seems to show "synax errors".
    What I complied the program below:
    import java.util.Scanner;
    public class String
       public static void main(String[] args)
          // declare constants and variables
          String tutorName;
          String stdtName;
          // read input data
          Scanner scn = new Scanner(System.in);
          System.out.print("Enter tutor's name : ");
          tutorName = scn.next();
          System.out.print("Enter student's name : ");
          stdtName = scn.next();
          // display output
          System.out.println ("Tutor's Name : " + tutorName);
          System.out.println ("Tutor's Name : " + stdtName);
    }The error message says:
    ----jGRASP exec: javac -g D:\String.java
    String.java:20: incompatible types
    found : java.lang.String
    required: String
    tutorName = scn.next();
                                    ^
    String.java:22: incompatible types
    found: java.lang.String
    required: String
    stdtName = scn.next();
                                  ^
    2 errors
    ----jGRASP wedge2: exit code for process is 1.
    ----jGRASP: operation complete.Edited by: soulhealer88 on May 28, 2008 8:11 AM

    BIJ001 wrote:
    java.lang.String tutorName;
    That would quickly become painful. It's much easier to rename your own class to be different from String.
    Big tip: and don't forget to delete your String.class, because if you don't it will continue to trip you up.

Maybe you are looking for

  • That did not work.  I would like to talk to someone directly to resolve this.  Thanks.

    Thanks James, but that did not work.  I think I need to speak to someone directly to walk me through this.  I am very new to this.

  • Output type to print pending schedule lines only

    Hi, Is there a standard Output type to print only pending schedule lines thru ME9E, with the respective delivery date, schedule Qty, delivered Qty and pending Qty, Please revert. Thanks & Regds, Ritesh

  • Error when I deploy EAR file

    Hi all, Today, I download the oc4j_extended_101340.zip file to use standalone OC4J. After that, I setup PDK Container bellow the pdksoftware file. when I deploy file wsrp-samples.ear (inside pdksoftware.zip file) --> OK But when I test its WSDL URL b

  • IFS-20010 : Unable to get service configuration properties

    Hi all, I am trying to connect to IFS using JDeveloper. I have coded a JSP which makes a call to my java class to connect. I know that I can connect from my machine because I can run a simple application from the command line to create a file in IFS.

  • Any solution for importing archived songs from HDD?

    My old laptop was stolen and I just purchased new PowerMac G5. Back when I imported my CD library (over 700 titles) I have made a backup of the created m4a's onto a HDD. I wanted to import the archived songs into iTunes, but after the "Adding Songs"