Cannot convert from ImageIcon to Image

Please tell me why I'm getting error: I have seen many example of this both in this forum and other places.
Type mismatch: cannot convert from ImageIcon to Image[b]
Thanks in advance
here's my code, I m using fileupload to load my images:
<%@ page import="java.util.List"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="java.io.File" %>
<%@ page import="java.io.IOException"%>
<%@ page import="java.io.*"%>
<%@ page import="java.awt.image.ImageFilter"%>
<%@ page import="java.awt.Color"%>
<%@ page import="java.awt.image.ImageProducer"%>
<%@ page import="java.awt.image.ReplicateScaleFilter"%>
<%@ page import="java.awt.image.FilteredImageSource"%>
<%@ page import="javax.swing.*"%>
<%@ page import="java.awt.image.BufferedImage"%>
<%@ page import="java.awt.Image"%>
<%@ page import="java.awt.Graphics"%>
<%@ page import="java.awt.Toolkit"%>
<%@ page import="com.sun.image.codec.jpeg.JPEGCodec"%>
<%@ page import="com.sun.image.codec.jpeg.JPEGImageEncoder"%>
<%@ page import="org.apache.commons.fileupload.servlet.ServletFileUpload"%>
<%@ page import="org.apache.commons.fileupload.disk.DiskFileItemFactory"%>
<%@ page import="org.apache.commons.fileupload.*"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
   <center><table border="2">
        <tr><td><h1>Your files  uploaded </h1></td></tr>
   <%
    //setting the target w + h
     int targetWidth=0;
    int targetHeight=0;
     //session values used to rename loaded image.
     String adID = "EM225";
     session.setAttribute("adID", adID);
     String fileName = null;
  // String imageid = request.getParameter("imgageID");
     boolean isMultipart = ServletFileUpload.isMultipartContent(request);
     if (!isMultipart) {
     } else {
        FileItemFactory factory = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(factory);
        List items = null;
        try {
             items = upload.parseRequest(request);
        } catch (FileUploadException e) {
             System.out.println("Unable to load image" +  e.getMessage());
        Iterator itr = items.iterator();
        while(itr.hasNext()) {
               FileItem item = (FileItem) itr.next();
               if (item.isFormField()) {
                    //String name = item.getFieldName();  //This will get the field names. for eg. if u have a hidden field this line will get the hidden filed name.
                //value = item.getString();
                    //out.println(value);
               } else {
             try {
                  File fullFile  = new File(item.getName());
                  fileName = fullFile.getName();
                  String id = (String)session.getAttribute("adID");
                  String newName =  id+fileName;
                  //passing renamed uploaded image.
                  Image sourceImage = new ImageIcon(Toolkit.getDefaultToolkit().getImage(newName));
                  // Calculate the target width and height
                  float scale = 50/100;
                  targetWidth = (int)(sourceImage.getWidth(null)*scale);
                  targetHeight = (int)(sourceImage.getHeight(null)*scale);
                  BufferedImage resizedImage = this.scaleImage(sourceImage,targetWidth,targetHeight);
                  ByteArrayOutputStream baos = new ByteArrayOutputStream();
               JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(baos);
                  encoder.encode(resizedImage);
               byte[] b = baos.toByteArray();
                 // File tosave = new File(getServletContext().getRealPath("/"),resizedImage);
                 // item.write(tosave);
             } catch (Exception e) {
                  System.out.println("Unable to save the image" + e.getMessage());
   %>
   <%!
   private BufferedImage scaleImage(Image sourceImage, int width, int height){
        ImageFilter filter = new ReplicateScaleFilter(width,height);
        ImageProducer producer = new FilteredImageSource
        (sourceImage.getSource(),filter);
        Image resizedImage = Toolkit.getDefaultToolkit().createImage(producer);
        return this.toBufferedImage(resizedImage);
    private BufferedImage toBufferedImage(Image image){
        image = new ImageIcon(image).getImage();
        BufferedImage bufferedImage = new BufferedImage(image.getWidth(null),image.getHeight(null),BufferedImage.TYPE_INT_RGB);
        Graphics g = bufferedImage.createGraphics();
        g.setColor(Color.white);
        g.fillRect(0,0,image.getWidth(null),image.getHeight(null));
        g.drawImage(image,0,0,null);
        g.dispose();
        return bufferedImage;
   %>
    </table>
   </center>
    </table>
   </center>

Hello. So, it's difficult to say, but the following line is probably the cause of the problem.:
Image sourceImage = new ImageIcon(Toolkit.getDefaultToolkit().getImage(newName));Basically, you are making an ImageIcon by passing an image, but perhaps you can just replace the line with this:
Image sourceImage = Toolkit.getDefaultToolkit().getImage(newName);I use ImageIcon when reading from files, such as:
BufferedImage image = ImageIO.read(file);
Icon icon = new ImageIcon(image);However, if you already have an Image, I don't see why you just can't just use the Image reference. Perhaps someone more wise will have a more concise answer. Good luck.

Similar Messages

  • Cannot convert from java.util.Date to java.sql.Date

    In the below code am trying to get the current date and 60 days prior date:
    Date  todayDate;
              Date  Sixtydaysprior;
              String DATE_FORMAT = "MM/dd/yy";
              DateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
             Calendar cal = Calendar.getInstance();
              todayDate = sdf.parse(sdf.format(cal.getTime()));
              cal.add(Calendar.DATE, -60);
             Sixtydaysprior = sdf.parse(sdf.format(cal.getTime()));I have imported following files:
    <%@page
         import="java.util.Calendar,
                   java.text.SimpleDateFormat,
                   java.text.ParseException,
                            java.util.*"
    %>Shows up following error msg:
    Type mismatch: cannot convert from java.util.Date to java.sql.Date
    Thanks.
    Edited by: MiltonDetroja on May 22, 2009 11:03 AM

    Shows up following error msg:
    Type mismatch: cannot convert from java.util.Date to java.sql.Date
    I don't think this exception is thrown from the portion of code you have shown. As clearly specified in exception message, you cannot cast an instance of java.util.Date to java.sql.Date. you will need to do something like this
    java.util.Date today = new java.util.Date();
    long t = today.getTime();
    java.sql.Date dt = new java.sql.Date(t);

  • Error:Type mismatch: cannot convert from Long to Long

    hi friends,
    I've a problem.I've a JSP that does some long converions,and its working fine when i make it run on my machine i.e
    (Running Tomcat5.0),but when I deploy this file on the server which runs Tomcat 5.5.7,it throws this error:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 20 in the jsp file: /abc.jsp
    Generated servlet error:
    Type mismatch: cannot convert from Long to Long
    Can anyone of you,tell me where i am going wrong???

    Here is an example of doing it with a JavaBean... the bean looks like this:
    package net.thelukes.steven;
    import java.io.Serializable;
    import java.text.DateFormat;
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    public class FormHandlerBean implements Serializable {
         private static final long serialVersionUID = 1L;
         private Date startTime = null;
         private DateFormat dateFormatter;
         public FormHandlerBean() {
              setDateFormat("yyyy-MM-dd hh:mm:ss");
         public void setStart(String strt) {
              setStartAsString(strt);
         private void setStartAsString(String strt) {
              setStartAsDate(getDate(strt));
         private void setStartAsDate(Date d) {
              startTime = d;
         private Date getDate(String s) {
              Date d = null;
                   try {
                        d = dateFormatter.parse(s);
                   } catch (ParseException pe) {
                        System.err.print("Error Parsing Date for "+s);
                        System.err.println(".  Using default date (right now)");
                        pe.printStackTrace(System.err);
                        d = new Date();
              return d;
         public long getStartAsLong() {
              return getStart().getTime();
         public String getStartAsString() {
              return Long.toString(getStartAsLong());
         public Date getStart() {
              return startTime;
         public void setDateFormat(String format) {
              dateFormatter = new SimpleDateFormat(format);
    }You would only need to make the getStartXXX methods public that need to be accessed from the JSP. For example, if you will not need to get the Long value of the time, then you do not need to make getStartAsLong public...
    The JSP looks like this:
    <html>
      <head>
        <title>I got the Form</title>
      </head>
      <body>
        <h3>The Output</h3>
        <jsp:useBean class="net.thelukes.steven.FormHandlerBean" id="formHandler"/>
        <%
             formHandler.setStart(request.getParameter("start"));
        %>
        <table>
          <tr><td>Start as String</td><td><jsp:getProperty name="formHandler" property="startAsString"/></td></tr>
          <tr><td>Start as Date</td><td><jsp:getProperty name="formHandler" property="start"/></td></tr>
          <tr><td>Start as long</td><td><jsp:getProperty name="formHandler" property="startAsLong"/></td></tr>
        </table>
      </body>
    </html>If this were a servlet processing the form rather than a JSP, I might throw the ParseException that might occur in getDate and catch it in the Servlet, with which I could then forward back to the form telling the user they entered mis-formatted text value... But since JSPs should be mainly display, I catch the exception internally in the Bean and assign a safe value...

  • HelloClient.cpp(36) : error C2440: 'initializing' : cannot convert from 'class CORBA_WStringValue *' to '

    "HelloClient.cpp(36) : error C2440: 'initializing' : cannot convert from 'class CORBA_WStringValue *' to 'const char *'"Hi I am getting this error when I try toprint the value which I am getting fromthe RMI Implementation class.Thanks.

    What orb are you using in the client?
    LP wrote:
    "HelloClient.cpp(36) : error C2440: 'initializing' : cannot convert from 'class CORBA_WStringValue *' to 'const char *'"Hi I am getting this error when I try toprint the value which I am getting fromthe RMI Implementation class.Thanks.

  • Cannot convert from IPrivate{cn}view.I{cn}Element to IPublicTabComp.IPeople

    Hi,
    I have 2 context node Person and People in a view context and context node People in component controller's context ,now i want to create new People element in the implementation of view
    so when i had written code below in eventhandler method in view implementation:
    IPeopleElement newPerson = wdContext.nodePeople().createPeopleElement();
    it gives me an error :
    Cannot convert from IPrivateview.IElement to IPublicTabComp.IPeopleElement
    Any help will be appreciated.
    Thanks,
    Rashmi.

    Hi,
    i hope you mapped the component controller context "People "to view .
    then to create a element do like this,
    IPrivate<View Nmae>View.IPeopleNode pnode= wdContext.nodePeople().createPeopleElement();
    Regards,
    ramesh

  • Cannot convert from PDF to word doc.....

    I am not able to access PDF files on my desktop to then convert.

    Hi Dan,
    What happens when you try to access the PDF files? Do you get an error message? Are you converting from within Adobe Reader, or via the ExportPDF web interface?
    Are you able to log in directly to https://cloud.acrobat.com/exportpdf and convert your files from there?
    Best,
    Sara

  • Migration Workbench is messing up data in converted from SQL Server image fields.

    I am working on porting a SQL Server 7 database to Oracle 8i (8.1.6 release 2). In the SQL Server database I have several tables that contain image fields that hold binary data (like Word documents, and other files). When I port the database to Oracle, the data in these fields gets garbled (the resultant records contain the correct amount of data (bytes), yet the data is different). Data in image fields that contain text oriented data ports correctly (i.e. if you just saved a long string in the field). Has anyone else posted a similar problem? Is there a workaround here to get the data stored in these image fields to port correctly?

    The thing is DDL of SQL Server and Oracle are quite different, without the help of MW from SQL Developer. You can't convert SQL server version of DDL to Oracle version. Of course you can accomplish the same thing using other tools like ERwin and Visio. Since SQL Developer is free why bother?

  • I cannot convert from Indesign CS7 to CS6

    Is there a way of converting InDesign CS7 files to CS6 format?

    THe files need to be saved as CS6 or IDML from within CC (CS7). There is no other way .
    Mylenium

  • Cannot convert from itunes 10 to itunes 10.1

    Hello i am trying to get the new software (ios4.2) for iphone4 but am unable to upgrade my itunes to 10.1. I try installing the 10.1 but it says "There is a problem with this windows installer package. A program required for this install to complete could not be run." What is the easiest way to rectify this problem? I remember trying to get itunes 10 to work properly, what a huge pain, now this! Please help?

    "There is a problem with this windows installer package. A program required for this install to complete could not be run."
    That can indicate trouble with your Apple Software Update, Sir. So first we'd better check to see if that is functioning properly.
    Go "Start > All programs > Apple Software Update". Does ASU launch, or do you get an error message? If you get an error message, what does it say? (Precise text, please.)

  • Cannot convert from excel to adobe (using acrobat 8 standard)

    Document will begin conversion and then just get stuck forever in an unending loop.  When I cancel the program (excel) get a prompt that says that Acrobat was unable to complet PDF process!!!  Help!!!

    Open the file in Excel. Then go to the FILE menu and select print. Chose the Adobe PDF printer and see if you get a PDF -- all of the other Acrobat processes depend on this printing process. If not, report what error messages you get. I suspect that you have deactivated AcroTray.exe that is a required part of the conversion part. If you like to test the latter, use the print-to-file option in the printer dialog, then open the file in Distiller to complete the process. The latter should either give you a PDF or a mess of error messages telling you why not.

  • Cannot cast from SOMETHING to SOMETHING (Error in 1.4) (Works in 1.6)

    Our company have developed an accounting program, and it is already near completion.
    We developed it with JavaBean and Eclipse in Windows Environment with JRE 1.6.0_05
    When we tried to compile and run the program in our linux environment (Server) that runs on 1.4 , the casting error occured..
    we have written a program to generate all casting errors that occurred in our project.
    import java.math.*;
    import java.util.*;
    public class testnow {
         public static void main(String[] args){
              //Declare ALL Primitive!
              int TestINT = 150;
              Boolean TestBOOL = true;
              String TestSTR = "Streng" + "th";
              BigDecimal TestDCM = BigDecimal.valueOf(20);
              Date TestDATE = new Date();
              //Declare ALL Object
              Object TestINTObj = 150;
              Object TestSTRObj = "Strength";
              Object TestDCMObj = BigDecimal.valueOf(20);
              Object TestBOOLObj = true;
              Object TestDATEObj = new Date();
              if(TestINT == (Integer)TestINTObj){
                   System.out.println("TEST Integer PASSED");
              if(TestSTR.equals((String)TestSTRObj)){
                   System.out.println("TEST String PASSED");
              if(TestDCM.equals(TestDCMObj)){
                   System.out.println("TEST Decimal PASSED");
              if(TestBOOL == (Boolean)TestBOOLObj){
                   System.out.println("TEST Boolean PASSED");
              if(TestDATE.equals((Date)TestDATEObj)){
                   System.out.println("TEST Date PASSED");
    }the following is what happened when i run javac testnow.java
    1. ERROR in testnow.java
    (at line 6)
    Integer TestINT = 150;
    ^^^^^^^
    Type mismatch: cannot convert from int to Integer
    2. ERROR in testnow.java
    (at line 7)
    Boolean TestBOOL = (Boolean)true;
    ^^^^^^^^^^^^^
    Cannot cast from boolean to Boolean
    3. ERROR in testnow.java
    (at line 11)
    Object TestINTObj = (Object)150;
    ^^^^^^^^^^^
    Cannot cast from int to Object
    4. ERROR in testnow.java
    (at line 14)
    Object TestBOOLObj = true;
    ^^^^^^^^^^^
    Type mismatch: cannot convert from boolean to Object
    4 problems (4 errors)
    in our windows development JRE 1.6 , it run well and gives the following output :
    TEST Integer PASSED
    TEST String PASSED
    TEST Decimal PASSED
    TEST Boolean PASSED
    TEST Date PASSED
    how do we solve this? i mean we have been using this "convenience" casting all over our code . :(
    please help
    thanks a lot.
    Cheers and God Bless,
    Chowi

    You've got a lot of problems there, and not all of them are due to Java version incompatibilites. I'll take them in the order I see them. public static Object FindDataInTable(ArrayList TargetTable, String TypeColumn,
             String TargetColumn, Object TargetData, String ReturnedColumn)&#x7B; The convention is to give methods and variables names that start with lowercase letters. That makes your code easier to read, which makes it easier for us to help you. Later on, I see you also use a mix of underscores and camelcase. Underscores should be used only in constant names; class, method and variable names should use only camelcase.
    Also, if you don't have a good reason to make that first argument an ArrayList, you should declare it as a List instead. That leaves the calling code the option of using a different List implementation should they need to.
    Next, you assign a primitive value to an Object reference: Object ReturnedObject = 0; That requires autoboxing, as others have pointed out, which didn't exist in JDK 1.4. Even if you could use autoboxing though, that assignment would be a bad idea; a variable of type Object should be assigned a default value of {color:000080}null{color}, not a number. However, you may not need to declare that variable at all, as I explain later.
    Next you use a "foreach" loop, another feature that was added in JDK 1.5; you'll have to switch to the old-style loop if you want this code to work under JDK 1.4. While you're at it, you should declare your "SingleRow" variable inside the loop, since it's not used anywhere else: for (Iterator it = TargetTable.iterator(); it.hasNext(); ) {
        Model_DatabaseQuery SingleRow = (Model_DatabaseQuery)it.next(); Next I see you using matches() to compare String values: if(TypeColumn.matches("String")){
        if(((String)TargetData).matches((String)CheckData))&#x7B; You get away with that because the strings contain only letters, but you need to look up the docs for matches() so you'll understand why you shoudn't be using it here. But this is nothing compared to the next issue: if((Integer)TargetData == (Integer)CheckData)&#x7B; // WRONG WRONG WRONG That can't possibly have worked right, no matter what version of Java you ran it under. You NEVER use == to compare the values objects! You should have been using equals() for all those comparisions, not matches(), and definitely not ==.
    But I don't see why you're doing all those checks on the column type anyway. All you ever do after that is compare the same two values, so just do it: for (Iterator it = targetTable.iterator(); it.hasNext(); ) {
        Model_DatabaseQuery SingleRow = (Model_DatabaseQuery)it.next();
        Object CheckData = SingleRow.Get_object(TargetColumn);
        if (CheckData != null && CheckData.equals(TargetData)) {
            return SingleRow.Get_object(ReturnedColumn);
    } If there are other columns that you're supposed to ignore, you may still need to check the column type, but you could do that in one {color:000080}if{color} statement; you don't have to check them all separately.

  • Want to convert an array to image in gray scale

    i have an image that i have read into the vi. using the draw unflattened pixmap , i have an array of numbers .after some mathematical computations on the array i should be able to convert the array back to the image. how can i convert from array to image.and then from image to gray scale?

    I am not sure what you are doing. Can you post a simple example program?

  • I cannot seem to load raw images into LR 2.5.  I've been using this for years.  I always load from memory card, but it gives me an unknown error message.  I tried to load from camera, hard drive, & external drive and still will not work.  I checked import

    I cannot seem to load raw images into LR 2.5.  I've been using this for years.  I always load from memory card, but it gives me an unknown error message.  I tried to load from camera, hard drive, & external drive and still will not work.  I checked import menu and nothing has changed.  I loaded the photos onto my tablet and images are fine, so do not feel it is the memory card.  Any thoughts?

    The error message probably said "unsupported or damaged"
    The T3 requires Lightroom 3.4.1 or later. You can either upgrade to a more current version of Lightroom (version 5.6 is the most recent) or you can use the free Adobe DNG Converter to convert the RAWs to DNG, which should import into Lightroom properly.

  • RFC Function Error: Cannot convert a value of 'MM/DD/YYYY' from type java.l

    hi experts,
    iam calling an RFC using SAP_JCO_Function. one of the input parameters is date which shud be in the format 'MM/DD/YYYY' but when i create a transaction property of data type DATETIME the format changes to " 2007-06-21 14:31:50 ". to refrain form passing this value at run time i have defined the transaction property as string and defaulted the value to MM/DD/YYYY.
    When i execute the RFC i get the error "Cannot convert a value of 'MM/DD/YYYY' from type java.l".
    Issue is with time field as well. Any suggestions would be appreciated.
    Thanks,
    Avinash

    Hi
    You can use datefromxmlformat( datetime, toformat ) .
    in toformat you give: "MM/dd/yyyy" and in datetime you pass your xml format date like: 2007-06-21 T14:31:50.
    Try like this. Hope this may help you.
    Thanks

  • Cannot Convert standby database from snapshot to physical

    Hello all,
    I am using Oracle Entreprise version 11gR1 and had made the followings configuration:
    - ANAISMD2 : primary database+_+
    - ANAISMD3 : physical standby datbase. Created via RMAN
    Both are located on the same host running a RH 4.
    ANAISMD3 is maintained successfully with the primary.
    I can make a fail-over between the both: it works fine.
    I can convert ANAISMD3 from physical to snapshot via DGMGRL: it works fine
    But I cannot convert back ANAISMD3 to physical, got an error ORA-12514
    I had checked also the listener service for both ANAISMD2/ANAISMD3 before launching the conversion:
    - the services shown on ANAISMD3 seems correct e.g. ANAISMD2 is seen as a remote server.
    - but on ANAISMD2, ANAISMD3 seems incorrect e.g. ANAISMD3 is seen as a local server.
    I had attached some screen shots of dg/lsnrctl results;
    What are the mistakes
    Thank in advance for support
    ==> Before I made the conversion , DGMGRL shows correct primary/standby status:
    DGMGRL for Linux: Version 11.1.0.6.0 - Production
    Copyright (c) 2000, 2005, Oracle. All rights reserved.
    Welcome to DGMGRL, type "help" for information.
    DGMGRL> connect sys/oracle@ANAISMD2
    Connected.
    DGMGRL> show configuration
    Configuration
    Name: ANAIS
    Enabled: YES
    Protection Mode: MaxPerformance
    Databases:
    ANAISMD2 - Primary database
    ANAISMD3 - Snapshot standby database
    Fast-Start Failover: DISABLED
    Current status for "ANAIS":
    SUCCESS
    ==> When I want to convert back ANAISMD3 to physical, I got the following errors from the listener:_
    Welcome to DGMGRL, type "help" for information.
    DGMGRL> connect sys/oracle@ANAISMD2
    Connected.
    DGMGRL> convert database 'ANAISMD3' to physical standby;
    Converting database "ANAISMD3" to a Physical Standby database, please wait...
    Operation requires shutdown of instance "ANAISMD3" on database "ANAISMD3"
    Shutting down instance "ANAISMD3"...
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    Operation requires startup of instance "ANAISMD3" on database "ANAISMD3"
    Starting instance "ANAISMD3"...
    Unable to connect to database
    ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
    Failed.
    You are no longer connected to ORACLE
    Please connect again.
    Unable to start instance "ANAISMD3"
    You must start instance "ANAISMD3" manually
    Failed to convert database "ANAISMD3"
    DGMGRL>
    ==> Here ist he listener.ora_ (I put the same for both ANAISMD2/ANAISMD3 with port 1541/1551). Note: DGB is the accepted extension for dgmgrl service (instead of DGMGRL as mentionned in documentation).
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL=TCP) (HOST=rh4-2a) (PORT=1541))
    TRACE_LEVEL_LISTENER = ADMIN
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME=/home/oracle/product/11.1.0)
    (PROGRAM = extproc)
    (SID_DESC =
    (SID_NAME = ANAISMD2)
    (GLOBAL_DBNAME = ANAISMD2.world)
    (ORACLE_HOME=/home/oracle/product/11.1.0)
    (SID_DESC =
    (SID_NAME = ANAISMD2)
    (GLOBAL_DBNAME = ANAISMD2_DGB.world)
    (ORACLE_HOME=/home/oracle/product/11.1.0)
    (SID_DESC =
    (SID_NAME = ANAISMD3)
    (GLOBAL_DBNAME = ANAISMD3_DGB.world)
    (ORACLE_HOME=/home/oracle/product/11.1.0)
    (SID_DESC =
    (SID_NAME = ANAISMD3)
    (GLOBAL_DBNAME = ANAISMD3.world)
    (ORACLE_HOME=/home/oracle/product/11.1.0)
    ==> Here is the tnsnames.ora (I put the same for both ANAISMD2/ANAISMD3 with port 1541/1551).
    ANAISMD2.WORLD =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rh4-2a)(PORT = 1541))
    (CONNECT_DATA =
    (SERVICE_NAME = ANAISMD2_DGB.world)
    ANAISMD3.WORLD =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rh4-2a)(PORT = 1551))
    (CONNECT_DATA =
    (SERVICE_NAME = ANAISMD3_DGB.world)
    ==> Here is the sqlnet.ora (same on both):
    TRACE_LEVEL_CLIENT = OFF
    DIAG_ADR_ENABLED=FALSE
    DIAG_DDE_ENABLED=FALSE
    DIAG_SIGHANDLER_ENABLED=FALSE
    names.directory_path = (TNSNAMES)
    names.default_domain = world
    name.default_zone = world
    ==>
    ==> List of services provided by the listener of ANAISMD2:
    LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 10-AUG-2009 16:39:36
    Copyright (c) 1991, 2007, Oracle.  All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rh4-2a)(PORT=1541)))
    Services Summary...
    Service "ANAISMD2.world" has 1 instance(s).
    Instance "ANAISMD2", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
    +"DEDICATED" established:0 refused:0+
    LOCAL SERVER
    Service "ANAISMD2_DGB.world" has 1 instance(s).
    Instance "ANAISMD2", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
    +"DEDICATED" established:3 refused:0+
    LOCAL SERVER
    Service "ANAISMD3.world" has 1 instance(s).
    Instance "ANAISMD3", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
    +"DEDICATED" established:0 refused:0+
    LOCAL SERVER
    Service "ANAISMD3_DGB.world" has 1 instance(s).
    Instance "ANAISMD3", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
    +"DEDICATED" established:0 refused:0+
    LOCAL SERVER
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
    +"DEDICATED" established:0 refused:0+
    LOCAL SERVER
    The command completed successfully
    ==> List of services provided by the listener of ANAISMD3:
    Services Summary...
    Service "ANAISMD2.world" has 2 instance(s).
    Instance "ANAISMD2", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0
    LOCAL SERVER
    Instance "ANAISMD2", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0 state:ready
    REMOTE SERVER
    (ADDRESS=(PROTOCOL=TCP)(HOST=rh4-2)(PORT=1521))
    Service "ANAISMD2_DGB.world" has 2 instance(s).
    Instance "ANAISMD2", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0
    LOCAL SERVER
    Instance "ANAISMD2", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0 state:ready
    REMOTE SERVER
    (ADDRESS=(PROTOCOL=TCP)(HOST=rh4-2)(PORT=1521))
    Service "ANAISMD2_XPT.world" has 1 instance(s).
    Instance "ANAISMD2", status READY, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0 state:ready
    REMOTE SERVER
    (ADDRESS=(PROTOCOL=TCP)(HOST=rh4-2)(PORT=1521))
    Service "ANAISMD3.world" has 1 instance(s).
    Instance "ANAISMD3", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0
    LOCAL SERVER
    Service "ANAISMD3_DGB.world" has 1 instance(s).
    Instance "ANAISMD3", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0
    LOCAL SERVER
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
    "DEDICATED" established:0 refused:0
    LOCAL SERVER
    The command completed successfully

    You need to have static service registered with listener in this way. This is must because as you know when it converts db that time it shutsdown dbs also so all dynamic services are lost and dgmgrl is not ale to connect to db hence conversion fails.
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = ORACLE_SID)
    (GLOBAL_DBNAME=db_unique_name_DGMGRL.db_domain)
    (ORACLE_HOME = /apps/oracle/product/11.1.0)
    Plus with this make a entry in tnsnames.ora using service name from above or check from lsnrctl status look for service "db_unique_name_DGMGRL.db_domain"
    e.g. this is my best practice how i give the names to tns entry
    db_unique_name_DGMGRL =
    (DESCRIPTION =
    (SDU = 32767)
    (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = port))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = db_unique_name_DGMGRL.db_domain)
    Define same way in both primary and standby db.
    Now use these tns entries to create configuration.
    e.g.
    create configuration prim_db as primary database is db_unique_name connect identifier is "db_unique_name_DGMGRL";
    -- db_unique_name_DGMGRL from primary tns entry
    add database stdby_db as connect identifier is "db_unique_name_DGMGRL" MAINTAINED AS PHYSICAL;
    -- db_unique_name_DGMGRL from standby db tns entry
    hope this will help

Maybe you are looking for

  • Adobe Echosign included in Adobe Full CC?

    HI all, i was just going through acrobat. Learning how to sign documents etc when I came across Echosign. It's a superb solution. I tried a few documents with friends to see how it works. I am a full cc subscriber but not sure if Echosign is a part o

  • Can I use 640g HD with my 3000 G430?

    My HD just died and I wanna replace it with WD640g HD.  Can anyone confirm me if I can replace my old one(WD 250g) with WD 640g HD?  Thank you very much

  • Adjustment brush error Lightroom 4

    So, I've been working on a photo using a number of adjustment brushes and now, all of a sudden, if I try to add another brush stroke in an adjustment I've already been working on, Lightroom reverts my image back to the default and removes all the bru

  • How do I get rid of Trovi which redirects

    please give my step-by-step how to get rid of Trovi

  • Change Log in Customization

    Hi, In a senario  like i open the preproduction system and did the customizing changes but systems didnot ask me the any type of requests...then where will the change log will maintain for given user? Thanks in advance Sharad