Can't convert int to java.lang.Object

When I deploy my customer Bean, the following error occures, I think the main problem is Can't convert int to java.lang.Object, does anyone facing the same problem with me?
<pre>C:\j2sdkee1.3\repository\home\gnrtrTMP\CustomerApp\CustomerBean_RemoteHomeImpl.j
ava:27: Incompatible type for declaration. Can't convert int to java.lang.Object
java.lang.Object primaryKey = ejb.ejbCreate(param0, param1, para
m2);
^
C:\j2sdkee1.3\repository\home\gnrtrTMP\CustomerApp\CustomerBean_RemoteHomeImpl.j
ava:57: Incompatible type for =. Can't convert int to java.lang.Object.
primaryKeys = ejb.ejbFindByPrimaryKey( param0);
^</pre>
I really need your help!!!

you can only convert one object type to another. Integer is an object int isnt. You might want to convert int to Integer and then go ahead.
see if it works.

Similar Messages

  • Can't convert int to java.lang.Integer.

    Hi everyone.
    I'm working on an auction site at the moment and have problems gaining a bidID number. This is part of my code and my error.
    AuctionFacade aHse = (AuctionFacade) application.getAttribute("AuctionFacade");
    String strTraderName = (String)session.getAttribute("traderName");
    String strPassword = (String)session.getAttribute("password");
    String strIDNum = request.getParameter("auctionID");
    Integer intID = Integer.valueOf(strIDNum);
    Integer [] bids = aHse.getAllBids(intID);
    float fltYourBid = aHse.getBidPrice(bids.length);
    ^
    Can't convert int to java.lang.Integer.
    can anyone help please?

    So, does "aHse.getBidPrice" expect an int or an Integer as its parameter? And does it return an int, or an Integer, or what? The answer to those questions may lead to your solution -- look at what you are actually using as the parameter, for example.

  • Can't compile classes of java.lang.Object.*

    JDeveloper 10g
    portlet==> Java portlet
    I want to try as an an example multiform portlet
    I added a jsp page using Thesaurus and NaValue classes
    I imported java.lang.Object.*
    but it won't compile errors for these two classes
    What do I have to do?
    Thanks

    Double click the project to go to project settings, then go to libraries and add a library with the jar files you added.

  • Cant convert boolean to java.lang.Boolean - HUH?

    I'm fairly new to Java, but I'm pretty sure this should work.
    Can someone tell me why I'm getting these compiler errors:
    wehServlet.java:72: Incompatible type for if. Can't convert java.lang.Boolean to boolean.
    if (checkoutSpecificFile(req,res,busId,tempDir)) {
    ^
    wehServlet.java:123: Incompatible type for return. Can't convert boolean to java.lang.Boolean.
    return true;
    Here's the basic code:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    public class wehServlet extends HttpServlet {
    private void someThing (HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException {
    if(tryThis()) {
    <do something>
    } else {
    <do something else>
    private Boolean tryThis() {
    return false;
    Why can't I do this?
    How do I fix it?
    I tried
    if(tryThis().booleanValue())....
    and I get this compile error:
    Incompatible type for return. Can't convert boolean to java.lang.Boolean
    Now what do I do?

    There's a lot of confusion caused by these "Wrapper" objects, not just Boolean but Integer, Long etc.
    The basic ("primitive") types are lower case names, boolean, int, long etc..
    The related items with capital letters are "wrapper" objects. The are used in a context where you basically want to store a single value but must do so as an Object, for example in aggregate objects like Map or List.
    You should avoid these unless there's a specific reason to use them.
    You can convert between boolean and Boolean, int and Integer etc. but it has to be done explicitly. As far as Java is concerned they're entirely different kind of thing. To java the Boolean class is just another kind of Object, it has no special syntactic significance.
    boolean b;
    Boolean bo;
    b = bo.booleanValue();  // covert from Boolean object to boolean primitive
    bo = new Boolean(b); // convert primitive to Object
    if(bo.booleanValue()) {  // test Boolean objed

  • Help! How to convert an instance from java.lang.Object to a particula class

    * How to convert an instance from java.lang.Object class to a particular class
    witch is known only at the running time?
    Roster EJB component is make up of RosterHome, Roster and RosterBean.
    RosterHome is the home interface of Roster EJB.
    Roster is the remote interface of Roster EJB.
    RosterBean is the implement of Roster EJB.
    The following code segment is to invoke Roster EJB component.
    String jndiName="roster.RosterHome";
    javax.naming.Context initial = getInitialContext();//getInitialContext() returns a instance of Context.
    Object objref = initial.lookup(jndiName);
    RosterHome home =
    (RosterHome)javax.rmi.PortableRemoteObject.narrow(objref,
    RosterHome.class);
    Roster myRoster = home.create();
    String team="T1"
    String player="Tom"
    myRoster.addPlayer(player,team);
    But, now, all the home interface, the remote interface and the JNDI Name of
    Roster EJB component are not been known at the compiling time. However They are
    known at the running time, throught reading from the XML config file.
    Questions:
    1,How to write code for this case ? or
    2,How to convert an instance from Object class to a particular class witch is known
    only at the running time?
    String jndiName="roster.RosterHome";// in fact, reads from XML file.
    String homeClassName="roster.RosterHome";// in fact, reads from XML file.
    String remoteClassName="roster.Roster";// in fact, reads from XML file.
    javax.naming.Context initial = getInitialContext();//getInitialContext() returns a instance of Context.
    Object objref = initial.lookup(jndiName);
    Object objHome= javax.rmi.PortableRemoteObject.narrow(objref,
    Class.forName(homeClassName));
    /* how to do next?
    }

    I am not sure what you are trying to do. But at some point you should know which methods to call on the remote interfaces. Maybe the method names are stored in the XML file as well or you have a set of standard method names (also consider parameters).
    However, this can be solved by reflection. Look at the java.lang.reflect package, especially java.lang.reflect.Method, and also at java.lang.Class.
    If you are doing this on the app server:
    I've seen posts where people say that reflection is not permitted in EJB, but I don't think so. Check the EJB spec.
    If you are doing this in an application: reflection is always permitted. Probably also in applets and JSP.

  • Java newbie: java.lang.Object[]

    Hi: I have a method which returns a java.lang.Object[]. I have tried a number of things. But can't seem to How do I print the contents of the object?
    The method I am calling is the following
    ==============
    public java.lang.Object[] getAllUsers() {
    if (super.cachedEndpoint == null) {
    throw new org.apache.axis.NoEndPointException();
    org.apache.axis.client.Call _call = createCall();
    call.setOperation(operations[125]);
    _call.setUseSOAPAction(true);
    _call.setSOAPActionURI("");
    call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11CONSTANTS);
    _call.setOperationName(new javax.xml.namespace.QName("Urn:ApiService", "getAllUsers"));
    setRequestHeaders(_call);
    setAttachments(_call);
    try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {});
    if (_resp instanceof java.rmi.RemoteException) {
    throw (java.rmi.RemoteException)_resp;
    else {
    extractAttachments(_call);
    try {
    return (java.lang.Object[]) _resp;
    } catch (java.lang.Exception _exception) {
    return (java.lang.Object[]) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.Object[].class);
    =============
    Thanks
    Ravi

    Where in that code do you claim you are doing that? Post a SSCCE .
    edit: Should you really be trying to work with web services if you don't know the basics of Java?

  • Can't convert int to int[]    URGENT!

    HI list!
    Here is the code part I have:
    /** Holds the permutated groups which are arrays of integers. */
    Vector v;
    if(arg.length<3) System.exit (0); //Need at least 3 arguments
    elements=new int[arg.length-1]; //Create array to hold elements
    /* Copy the arguments into the element array. */
    for(i=0;i<arg.length-1;i++) elements=Integer.parseInt(arg[i+1]);
    groupsize=Integer.parseInt(arg[0]); //Get the number in each group.
    calc(groupsize,elements.length); //Find out how many permutations there are.
    v=permutate(groupsize,elements); //Do the permutation
    for(i=0;i<v.size();i++) { //Print out the result
    elements=(int[]) v.get(i);
    System.out.println("");
    for(j=0;j<elements.length;j++) System.out.print(elements
    [j]+" ");
    System.out.println("\nTotal permutations = "+v.size());
    and the error I get is:
    Permutate.java:26: Incompatible type for =. Can't convert int to int[]. for(i=0;i<arg.length-1;i++) elements=Integer.parseInt(arg[i+1]);

    elements=(int[]) v.get(i);
    The above statement is illegal. Its not possible to
    use an array type in casting at all.
    Basically you are trying to do a kind of multiple
    casting, which is not possible.
    You might want to store vectors in vector v instead of
    arrays in vector v. Its better to do this.There's nothing wrong with the line
    elements = (int[]) v.get(i);
    assuming the returned object from the vector is in fact an array of int. Even then, it is a runtime exception condition not a compile-time error.
    Using arrays is perfectly valid where you know the size of the array at creation and do not need to resize it during use... The arrays are fast and compact. This is however not a comment on the approach taken in this case but merely an observation that arrays are not always an inferior choice to one of the collection classes.
    Now put up your dukes... ;)

  • Cannot convert type class java.lang.String to class oracle.jbo.domain.Clob

    Cannot convert type class java.lang.String to class oracle.jbo.domain.ClobDomain.
    Using ADF Business Components I have a JSFF page fragment with an ADF form based on a table with has a column of type CLOB. The data is retrieved from the database and displayed correctly but when any field is changed and submitted the above error occurs. I have just used the drag and drop technique to create the ADF form with a submit button, am I missing a step?
    I am using the production release of Jdeveloper11G

    Reproduced and filed bug# 7487124
    The workaround is to add a custom converter class to your ViewController project like this
    package oow2008.view;
    import javax.faces.application.FacesMessage;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.convert.Converter;
    import javax.faces.convert.ConverterException;
    import oracle.jbo.domain.ClobDomain;
    import oracle.jbo.domain.DataCreationException;
    public class ClobConverter implements Converter {
         public Object getAsObject(FacesContext facesContext,
                                   UIComponent uIComponent,
                                   String string) {
           try {
             return string != null ? new ClobDomain(string) : null;
           } catch (DataCreationException dce) {
             dce.setAppendCodes(false);
             FacesMessage fm =
               new FacesMessage(FacesMessage.SEVERITY_ERROR,
                                "Invalid Clob Value",
                                dce.getMessage());
             throw new ConverterException(fm);
         public String getAsString(FacesContext facesContext,
                                   UIComponent uIComponent,
                                   Object object) {
           return object != null ?
                  object.toString() :
                  null;
    }then to register the converter in faces-config.xml like this
    <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee">
      <application>
        <default-render-kit-id>oracle.adf.rich</default-render-kit-id>
      </application>
      <converter>
        <converter-id>clobConverter</converter-id>
        <converter-class>oow2008.view.ClobConverter</converter-class>
      </converter>
    </faces-config>then reference this converter in the field for the ClobDomain value like this
              <af:inputText value="#{bindings.Description.inputValue}"
                            label="#{bindings.Description.hints.label}"
                            required="#{bindings.Description.hints.mandatory}"
                            columns="40"
                            maximumLength="#{bindings.Description.hints.precision}"
                            shortDesc="#{bindings.Description.hints.tooltip}"
                            wrap="soft" rows="10">
                <f:validator binding="#{bindings.Description.validator}"/>
                <f:converter converterId="clobConverter"/>
              </af:inputText>

  • Error: could not be converted to [class java.lang.Class].

    I am newbie to JDeveloper (10.1.2) on winxp and i was trying to setup the example from the following url http://radio.weblogs.com/0129487/2003/09/19.html
    It is a how to on "Executing Toplink Queries using JavaBean DataControl "
    Any help would be greatly appreciated.
    Near the bottom on step "In StrutsPageFlow diagram, select allEmpsDA Data Action, right mouse and chooe Run" i get a the following runtime errors:
    Validation Error
    You must correct the following error(s) before proceeding:
    JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=JBO-29000: Unexpected exception caught: oracle.toplink.exceptions.ConversionException, msg= Exception Description: The object [mypackage.Employees], of class [class java.lang.String], could not be converted to [class java.lang.Class]. Please ensure that the class [class java.lang.Class] is on the CLASSPATH. You may need to use alternate API passing in the appropriate class loader as required, or setting it on the default ConversionManager Internal Exception: java.lang.ClassNotFoundException: mypackage.Employees
    JBO-29000: Unexpected exception caught: oracle.toplink.exceptions.ConversionException, msg= Exception Description: The object [mypackage.Employees], of class [class java.lang.String], could not be converted to [class java.lang.Class]. Please ensure that the class [class java.lang.Class] is on the CLASSPATH. You may need to use alternate API passing in the appropriate class loader as required, or setting it on the default ConversionManager Internal Exception: java.lang.ClassNotFoundException: mypackage.Employees
    Exception Description: The object [mypackage.Employees], of class [class java.lang.String], could not be converted to [class java.lang.Class]. Please ensure that the class [class java.lang.Class] is on the CLASSPATH. You may need to use alternate API passing in the appropriate class loader as required, or setting it on the default ConversionManager Internal Exception: java.lang.ClassNotFoundException: mypackage.Employees

    This error is happening on a read.
    Here is the mapping descriptor:
    <database-mapping>
    <attribute-name>SuppItemCollection</attribute-name>
    <read-only>false</read-only>
    <reference-class>package.SuppItem</reference-class>
    <is-private-owned>false</is-private-owned>
    <uses-batch-reading>false</uses-batch-reading>
    <indirection-policy>
    <mapping-indirection-policy>
    <type>oracle.toplink.internal.indirection.NoIndirectionPolicy</type>
    </mapping-indirection-policy>
    </indirection-policy>
    <container-policy>
    <mapping-container-policy>
    <container-class>java.util.Vector</container-class>
    <type>oracle.toplink.internal.queryframework.ListContainerPolicy</type>
    </mapping-container-policy>
    </container-policy>
    <source-key-fields>
    <field>SUPP.REQ_NUM</field>
    </source-key-fields>
    <target-foreign-key-fields>
    <field>SUPP_ITEM.REQ_NUM</field>
    </target-foreign-key-fields>
    <type>oracle.toplink.mappings.OneToManyMapping</type>
    </database-mapping>
    Object model has a Supp class that has a collection of SuppItem(s). I was allowing the Mapping Workbench to create the Java Source. I'm not to fond of that, but I thought it would be easiest to get things going.
    The datamodel is similiar to the class model.
    Thanks for the help,
    Mike

  • Sort(java.util.LinkedList java.lang.Object ) doesn't work

    Why doesn't this work?
    LinkedList<Object> sysPropsKeys = new LinkedList<Object>(System.getProperties().keySet());
    Collections.sort(sysPropsKeys);
    cannot fnd symbol
    symbol : method sort(java.util.LinkedList<java.lang.Object>)
    location: class java.util.Collections

    I will admit to not having Java1.5 installed on my machine. Haven't yet had the chance to play with generics, but the above DOES work in 1.4, and SHOULD work in 1.5
    Maybe I'm naive but, System.getProperties() returns a Properties object right?
    According to the API: http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html: Each key and its corresponding value in the property list is a string.
    All the keys SHOULD be strings.
    AFAIK string are comparable, and shouldn't throw class cast exceptions
    Thus the keys returned from getProperties SHOULD be comparable, and compatible for comparision.
    Ok, I can see your point in that some hackers abuse the Properties class by putting non string keys/values into the Properties Map. In that case the code would become more like your above. I'd probably still go with a TreeMap though, rather than a sorted list of keys. Most time you want the keys, you want the values as well. So if the intention is to print out a sorted list of system properties, and their values, keeping it in a map is best.
    Just my 2 cents,
    evnafets

  • Javah error java.lang.Object not found

    Hi guys-
    I'm trying to run a javah command to generate a .h file... I'm using windows2000 & jdk1.1.8... when I run the command from DOS prompt I keep getting the same eror as java.lang.Object not found: aborting.. I've checked all the classpath and it seems ok ... I have CLASSPATH=..;c:\jdk1.1.8\lib\classes.zip
    Can anybody help me with this???
    Thanx

    Maybe try ; right click my computer ,click the advanced tab and select enviroment variables,click on classpath and then edit,check if it's correct.I had the sam problem and that seemed to fix it. :)

  • Weblogic - a web service with java.lang.Object parameter

    hi all,
    i'm creating a web service with a java.lang.Object parameter.
    my question is as follows:
    when a client calls the web service, how to i get the soap message object and convert it to soap message string using the parameter?
    thanks,
    alex

    Here's some code from one of the Axis samples, this shows the basic process of making a call:
    package samples.message;
    import org.apache.axis.client.Service;
    import org.apache.axis.client.Call;
    import org.apache.axis.message.SOAPBodyElement;
    import org.apache.axis.utils.Options;
    import org.apache.axis.utils.XMLUtils;
    import org.w3c.dom.Element;
    import java.net.URL;
    import java.util.Vector;
    public class TestMsg {
    public String doit(String[] args) throws Exception {
    Options opts = new Options(args);
    opts.setDefaultURL("http://localhost:8080/axis/services/MessageService");
    Service service = new Service();
    Call call = (Call) service.createCall();
    call.setTargetEndpointAddress( new URL(opts.getURL()) );
    SOAPBodyElement[] input = new SOAPBodyElement[2];
    input[0] = new SOAPBodyElement(XMLUtils.StringToElement("urn:foo",
    "e1", "Hello"));
    input[1] = new SOAPBodyElement(XMLUtils.StringToElement("urn:foo",
    "e1", "World"));
    Vector elems = (Vector) call.invoke( input );
    SOAPBodyElement elem = null ;
    Element e = null ;
    elem = (SOAPBodyElement) elems.get(0);
    e = elem.getAsDOM();
    String str = "Res elem[0]=" + XMLUtils.ElementToString(e);
    elem = (SOAPBodyElement) elems.get(1);
    e = elem.getAsDOM();
    str = str + "Res elem[1]=" + XMLUtils.ElementToString(e);
    return( str );
    public static void main(String[] args) throws Exception {
    String res = (new TestMsg()).doit(args);
    System.out.println(res);

  • Mapping xsd:anyType element to Java.lang.Object

    Hi,
    I am using JAXB to parse a xml and in the XSD we have one element which is of the anyType and returns java.lang.object from JAXB generated classes. The issue is that when the node contains string and we type cast the returned object to string every thing runs fine but when the element contains embeded xml then the object returned can not be type cast to string.
    code snippet:
    *<xsd:element name="SignatureDefinition" type="xsd:anyType" />*
    and the xml I am parsing contains:
    *<SignatureDefinition>
    <a>name</a>
    <b> job</b>
    </SignatureDefinition>*
    That is the element contains a object which is a well formed xml.
    Can any one guide or provide me the pointers.
    Thanks
    Regards,
    Devesh

    Hello Devesh,
    The "SignatureDefinition" portion of the XML document should be unmarshalled as a DOM Element.
    File file = new File("any.xml");
    Root root = (Root) jaxbContext.createUnmarshaller().unmarshal(file);
    Element element = (Element) root.getSignatureDefinition();
    System.out.println(element.getTextContent());
    If "SignatureDefintion" is the root of the XML document, you should get a JAXBElement wrapping a DOM Element.
    File file = new File("any.xml");
    JAXBElement<Element> root = (JAXBElement<Element>) jaxbContext.createUnmarshaller().unmarshal(file);
    System.out.println(root.getValue().getTextContent());
    -Blaise

  • Finalizer.register(java.lang.Object)

    I need to know th use of Finalizer.register(java.lang.Object) method.
    Can someone please help me...Its urgent!!!!
    Thank you!!
    Message was edited by:
    Java_Freak

    I am instantiating a MQQueue object..... When I run
    the memory debugger it says a call is made to the
    Finalizer.register method and the FInalizer object is
    on heap even after the GC...Why is this a problem? If it is a problem again
    1) Consult the bug database
    2) Post formatted code that reproduces your problem.
    Other than that consult these
    http://java.sun.com/developer/technicalArticles/ALT/RefObj/
    http://www.javaworld.com/javaworld/javatips/jw-javatip79.html
    This is the best and only advice I can give you based on your problem description.

  • The first quthor of java.lang.Object

    The biggest mystery for me in Java still exists as to who really coded the mother of all classes java.lang.Object.
    Here�s what the source of it says in JavaDocs
    * Class <code>Object</code> is the root of the class hierarchy.
    * Every class has <code>Object</code> as a superclass. All objects,
    * including arrays, implement the methods of this class.
    * @author unascribed
    * @version 1.61, 01/23/03
    * @see java.lang.Class
    * @since JDK1.0
    public class Object {

    See the annotation @author above, it says �unascribed� which means unknown. Any one who can solve this mystery for me and come up with the real author of this jni implementation class called �Object�
    I mean, the first one to code Object class...Please help me

    cross-post

Maybe you are looking for