1

I am developing an application with WebSphere Commerce 8.

I have this particular class

package com.whr.commerce.catalog.objects;

import javax.rmi.PortableRemoteObject;

import com.ibm.ivj.ejb.runtime.AbstractSessionAccessBean;




/**
 * WHRCatalogJDBCHelperAccessBean
 * @generated
 */
public class WHRCatalogJDBCHelperAccessBean extends AbstractSessionAccessBean {

[...]
    private com.whr.commerce.catalog.objects.WHRCatalogJDBCHelperHome ejbHome()
        throws java.rmi.RemoteException,
        javax.naming.NamingException {
        return (com.whr.commerce.catalog.objects.WHRCatalogJDBCHelperHome) PortableRemoteObject
            .narrow(
                getHome(),
                com.whr.commerce.catalog.objects.WHRCatalogJDBCHelperHome.class);
    }

    /**
     * ejbRef
     * @generated
     */
    private com.whr.commerce.catalog.objects.WHRCatalogJDBCHelper ejbRef()
        throws java.rmi.RemoteException {
        if (ejbRef == null)
            return null;
        if (__ejbRef == null)
            __ejbRef = (com.whr.commerce.catalog.objects.WHRCatalogJDBCHelper) PortableRemoteObject
                .narrow(
                    ejbRef,
                    com.whr.commerce.catalog.objects.WHRCatalogJDBCHelper.class);
    
        return __ejbRef;
    
  [...]
        }

It gives me this error at runtime, when I try to open a page

01/03/21 15.44.44:532 CET] 00000167 CommerceSrvr  E DataBeanManager activate(DataBean,ViewCommandContext,HttpServletRequest,HttpServletResponse) CMN0420E: Si รจ verificata la seguente eccezione comando durante l'elaborazione: "java.lang.ClassCastException: com.ibm.ws.asynchbeans.WorkManagerImpl incompatible with org.omg.CORBA.portable.ObjectImpl". java.lang.ClassCastException: com.ibm.ws.asynchbeans.WorkManagerImpl incompatible with org.omg.CORBA.portable.ObjectImpl
at com.ibm.rmi.javax.rmi.PortableRemoteObject.getObjectImpl(PortableRemoteObject.java:572)
at com.ibm.rmi.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:314)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:161)
at com.whr.commerce.catalog.objects.WHRCatalogJDBCHelperAccessBean.ejbHome(WHRCatalogJDBCHelperAccessBean.java:50)
at com.whr.commerce.catalog.objects.WHRCatalogJDBCHelperAccessBean.instantiateEJB(WHRCatalogJDBCHelperAccessBean.java:83)
at com.whr.commerce.catalog.objects.WHRCatalogJDBCHelperAccessBean.findCatgroupIdByField2MemId(WHRCatalogJDBCHelperAccessBean.java:97)

I've tried to change imports, remove some libraries that could be in conflict, but nothing solved...

Any suggestion? I'm using RAD IDE.

Lore
  • 1,286
  • 1
  • 22
  • 57

2 Answers2

0

Try this code.

    String BS_PORT = ""; // port number of the remote EJB container
    String IP_ADDRESS = ""; // IP address of the remote EJB container

    String REMOTE_LOOKUP_KEY = ""; // the lookup key which is configured via the Administrative console
    String JNDI_PROVIDER_URL = "iiop://" + IP_ADDRESS + ":" + BS_PORT;

    Properties props = new Properties();
    props.put( javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory" );
    props.put( Context.PROVIDER_URL, JNDI_PROVIDER_URL );

    Object lobj;
    InitialContext ctx;
    try{
        ctx = new InitialContext( props );

        lobj = ctx.lookup( REMOTE_LOOKUP_KEY );
        
        CustomServiceReferenceInterface remoteServiceRef = (CustomServiceReferenceInterface)javax.rmi.PortableRemoteObject.narrow(lobj, CustomServiceReferenceInterface.class);
        return remoteServiceRef;
    }
    catch( NamingException e ){
        // handle the exception
    }
Apps
  • 3,284
  • 8
  • 48
  • 75
-2

Try to download it from another site, second in if condition Try to flip sign were it's syntax look like this null == ejbref Because It give me error someTimes