Casting in EJB's - please help?!!

I've coded a generic threadmanager type service component (within an app. server) that instantiates various EJB's dynamically depending on various criteria that I obtain from a database. My code looks something like this - I run each of these type calls in a seperate thread:
javax.naming.Context ctx = new javax.naming.InitialContext ();
RO.ContractHHHome home = (RO.ContractHHHome)ctx.lookup("Contract/contractHH");
RO.ContractHHRemote remote = home.create();
remote.setAppKey(getAppKey());
remote.startProcess();
remote.remove();
I've managed to find an alernative way way to cast my EJB's to a CorbaOrb object and hence I'm avoiding to have to know exactly what my EJB's class name is (i.e the reference to the object RO.ContractHHHome can then be revoked at compilation time).
initialContext.init( orbOptions ) initialContext.String_to_Object(this.location, corbaobject )
lcor_corbaobject._narrow(appManager, "SessionManager/Manager")
appManager.createSession(this.userid, "")
corbaobject = lses_session.lookup(bindNaming)
corbaobject._narrow(homeOrb, ejbHome)
However, this opt's the problem that unless my CorbaOrb object is inherited from a super class that is known to me, there is NO way that I can call any custom methods on the CorbaOrb object that has been casted from my EJB (i.e. RO.ContractHHHome). So how do I cast/inherit the CorbaOrb object so that I can reference a custom method via the remote interface of the EJB. Sorry for this bad explaination - I will gladly explain more if need be....
many thanks
francois

Sweet - I actually looked this up and looks exactly what I need. Hey many thanks - much appreciated. If you got any working examples of cause please forward them onto me.
thanks again!
francois

Similar Messages

  • EJB Question Please help me

    Hi
    I am preparing for certification exam. I don't know the correct answer of these question. Please help me.
    Regards
    Arghya Banerjee
    ========================================================================
    1. While testing a BMP Entity Bean, a developer discovers that a transaction rollback does not cause a rollback of the changes made to the bean as it should. Which of the following should the developer suspect?
    A.     The ejbPassivate() method has a bug.
    B.     The ejbStore() method has a bug.
    C.     The ejbCreate() method has a bug.
    D.     The datastore does not support JTA.
    E.     The transaction does not implement javax.transaction.UserTransaction.
    Select 2 answers.
    2.     A Servlet must perform 3 operations that are independent of one another. They are time consuming with each operation consuming about 10 msec of CPU. The Servlet's response depends on the completion of all three operations. The developer decides to perform each operation on a separate worker thread to run them concurrently. Which of the following describe important parts of this implementation?
    A.     The Servlet should implement MultiThreadModel
    B.     The Servlet should implement SingleThreadModel
    C.     Access to the HttpSession must be synchronized.
    D.     The worker threads must not write to the ServletOutputStream.
    E.     The worker threads must not read from the ServletInputStream.
    Select the best answer.
    3. A client invokes the create() method on an CMP entity bean. Which of the following is a correct sequence in which the operations mentioned below are performed?
    a.     Container creates an EJBObject.
    b.     EJB home object invokes ejbCreate() on Bean instance
    c.     Bean instance is associated with EJBObject.
    d.     Container creates new bean instance.
    e.     Container calls setEntityContext() on bean instance.
    f.     Container creates the bean representation in a database.
    g.     ejbPostCreate() method is invoked on bean instance.
    A.     b -> f -> a -> c -> g
    B.     b -> a -> f -> c -> e -> g
    C.     a -> d -> c -> b -> e -> g -> f
    D.     a -> d -> c -> b -> f -> g -> e
    E.     a -> c -> e -> b -> f -> g
    Select the best answer.
    4.     A Web site is getting a lot of 'hits' and the amount of session data managed by the server is becoming too large for it to handle. Which of the following are appropriate ways to solve the problem?
    A.     Expand the capacity of the server.
    B.     Add additional servers to share the load.
    C.     Store the session data in a Cookie.
    D.     Store all session data in hidden fields on the web pages that are served.
    5. A developer wishes to make a server function available to an applet via a Servlet. The applet passes the Servlet a serialized object as an argument. How should the developer implement the Servlet?
    A.     Sub-class HttpServlet and create an ObjectInputStream from the
    ServletInputStream in the doGet() method.
    B.     Sub-class HttpServlet and create an ObjectInputStream from the
    ServletInputStream in the service() method.
    C.     Sub-class GenericServlet and create an ObjectInputStream from the
    ServletInputStream in the doGet() method.
    D.     Sub-class GenericServlet and create an ObjectInputStream from the ServletInputStream in the service() method.
    Select the best answer.
    6. While testing a CMP Entity bean, a developer discovers that a change to one of the bean's properties is not being reflected in the database that contains the bean data. What are possible causes?
    A.     The ejbStore() method has a bug.
    B.     The ejbCreate() method has a bug.
    C.     The setter for the property has a bug.
    D.     The mapping of container managed fields to database fields has a bug.
    E.     The deployment descriptor has a bug.
    F.     The ejbLoad() method has a bug.
    Select 4 answers.

    Hi Arghya ,
    From where you have taken these quetions , are they from the book.
    1. While testing a BMP Entity Bean, a developer
    discovers that a transaction rollback does not cause a
    rollback of the changes made to the bean as it should.
    Which of the following should the developer suspect?
    A.     The ejbPassivate() method has a bug.
    B.     The ejbStore() method has a bug.
    C.     The ejbCreate() method has a bug.
    D.     The datastore does not support JTA.
    E.     The transaction does not implement
    javax.transaction.UserTransaction.
    Select 2 answers.
    D,B If the Transaction is rolled back there are the possibility that either the datasource doesnot support it or the bean is updating the inconsistent data, so mostly problem in ejbStore() where there is a database update.
    2.     A Servlet must perform 3 operations that are
    independent of one another. They are time consuming
    with each operation consuming about 10 msec of CPU.
    The Servlet's response depends on the completion of
    all three operations. The developer decides to perform
    each operation on a separate worker thread to run them
    concurrently. Which of the following describe
    important parts of this implementation?
    A.     The Servlet should implement MultiThreadModel
    B.     The Servlet should implement SingleThreadModel
    C.     Access to the HttpSession must be synchronized.
    D.     The worker threads must not write to the
    ServletOutputStream.
    E.     The worker threads must not read from the
    ServletInputStream.
    Select the best answer.
    Now here what is the worker Thread should not write to output stream as if it does then there will be wrong formatting of the data, we are bothered about to improve the throughput so we have spawned three worker thread.Also there is no dependency so D is proper one
    3. A client invokes the create() method on an CMP
    entity bean. Which of the following is a correct
    sequence in which the operations mentioned below are
    performed?
    a.     Container creates an EJBObject.
    b.     EJB home object invokes ejbCreate() on Bean
    instance
    c.     Bean instance is associated with EJBObject.
    d.     Container creates new bean instance.
    e.     Container calls setEntityContext() on bean
    instance.
    f.     Container creates the bean representation in a
    database.
    g.     ejbPostCreate() method is invoked on bean
    instance.
    A.     b -> f -> a -> c -> g
    B.     b -> a -> f -> c -> e -> g
    C.     a -> d -> c -> b -> e -> g -> f
    D.     a -> d -> c -> b -> f -> g -> e
    E.     a -> c -> e -> b -> f -> g
    Select the best answer.
    Client invokes the create method on the home which inturn prepares the EJBObject and attaches the bean instance to the EJBObject and returned the reference to the client.So the option E.
    >
    4.     A Web site is getting a lot of 'hits' and the
    amount of session data managed by the server is
    becoming too large for it to handle. Which of the
    following are appropriate ways to solve the problem?
    A.     Expand the capacity of the server.
    B.     Add additional servers to share the load.
    C.     Store the session data in a Cookie.
    D.     Store all session data in hidden fields on the web
    pages that are served.
    You have to use the Load balancing tech , go for distributed technology B , the processing speed is now the criteria so you distribute the work.
    5. A developer wishes to make a server function
    available to an applet via a Servlet. The applet
    passes the Servlet a serialized object as an argument.
    How should the developer implement the Servlet?
    A.     Sub-class HttpServlet and create an
    ObjectInputStream from the
    ServletInputStream in the doGet() method.
    B.     Sub-class HttpServlet and create an
    ObjectInputStream from the
    ServletInputStream in the service() method.
    C.     Sub-class GenericServlet and create an
    ObjectInputStream from the
    ServletInputStream in the doGet() method.
    D.     Sub-class GenericServlet and create an
    ObjectInputStream from the ServletInputStream in the
    service() method.
    Select the best answer.
    I have to refer some docs for this
    6. While testing a CMP Entity bean, a developer
    discovers that a change to one of the bean's
    properties is not being reflected in the database that
    contains the bean data. What are possible causes?
    A.     The ejbStore() method has a bug.
    B.     The ejbCreate() method has a bug.
    C.     The setter for the property has a bug.
    D.     The mapping of container managed fields to database
    fields has a bug.
    E.     The deployment descriptor has a bug.
    F.     The ejbLoad() method has a bug.
    Select 4 answers.
    If there is the problem in the deployment descriptor then there ejb will not deploy at all .As the problem comes in updating I can make so no problem in the ejbCreate() also , but then many other consideration has to be taken .So I have my answer as
    A,C,D,F
    That is all I can say.
    Regard
    Vicky

  • Ejb Deployment - Please help ?????

    I am using Oracle 8.1.7 database ( Oarcle 9i App Server ) & JDeveloper 3.2 , but i am Unable to Deploy The BC4j as a Session bean in Oracle 9i App Server .
    Can u please help me Out , in Getting it work Sucessfully .
    Below is the Command Output .....
    EJB deployment argument list:
    "D:\Program Files\JDeveloper 3.2\java1.2\jre\bin\javaw"
    "-DPATH=D:\Program Files\JDeveloper 3.2\bin;D:\Program Files\JDeveloper 3.2\java1.2\bin"
    -classpath
    "D:\Program Files\JDeveloper 3.2\aurora\lib\aurora_client.jar;D:\Program Files\JDeveloper 3.2\lib\javax-ssl-1_2.jar;D:\Program Files\JDeveloper 3.2\aurora\lib\jasper.zip;D:\Program Files\JDeveloper 3.2\aurora\lib\vbjorb.jar;D:\Program Files\JDeveloper 3.2\aurora\lib\vbjapp.jar;D:\Program Files\JDeveloper 3.2\aurora\lib\vbjtools.jar;D:\Program Files\JDeveloper 3.2\aurora\lib\vbj30ssl.jar;D:\Program Files\JDeveloper 3.2\aurora\lib\aurora.zip;D:\Program Files\JDeveloper 3.2\sqlj\lib\translator.zip;D:\Program Files\JDeveloper 3.2\sqlj\lib\runtime.zip;D:\Program Files\JDeveloper 3.2\aurora\lib\mts.jar;E:\JDEV\OurTest;D:\Program Files\JDeveloper 3.2\lib\jbojdbcpatch.zip;D:\Program Files\JDeveloper 3.2\lib\jbodomorcl.zip;D:\Program Files\JDeveloper 3.2\lib\jbodatum12.zip;D:\Program Files\JDeveloper 3.2\lib\jdev-rt.zip;D:\Program Files\JDeveloper 3.2\jdbc\lib\oracle8.1.7\classes12.zip;D:\Program Files\JDeveloper 3.2\lib\connectionmanager.zip;D:\Program Files\JDeveloper 3.2\lib\javax_ejb.zip;D:\Program Files\JDevelope
    3.2\lib\jbomt.zip;D:\Program Files\JDeveloper 3.2\lib\jboremote.zip;D:\Program Files\JDeveloper 3.2\lib\jndi.jar;D:\Program Files\JDeveloper 3.2\lib\xmlparserv2.jar;D:\Program Files\JDeveloper 3.2\lib\jbotester.zip;D:\Program Files\JDeveloper 3.2\aurora\lib\aurora_client.jar;D:\Program Files\JDeveloper 3.2\lib\javax-ssl-1_2.jar;D:\Program Files\JDeveloper 3.2\aurora\lib\jasper.zip;D:\Program Files\JDeveloper 3.2\aurora\lib\vbjorb.jar;D:\Program Files\JDeveloper 3.2\aurora\lib\vbjapp.jar;D:\Program Files\JDeveloper 3.2\aurora\lib\vbjtools.jar;D:\Program Files\JDeveloper 3.2\aurora\lib\vbj30ssl.jar;D:\Program Files\JDeveloper 3.2\aurora\lib\aurora.zip;D:\Program Files\JDeveloper 3.2\sqlj\lib\translator.zip;D:\Program Files\JDeveloper 3.2\sqlj\lib\runtime.zip;D:\Program Files\JDeveloper 3.2\aurora\lib\mts.jar;D:\Program Files\JDeveloper 3.2\lib\jbocmp.zip;D:\Program Files\JDeveloper 3.2\java1.2\jre\lib\rt.jar;D:\Program Files\JDeveloper 3.2\lib\xmlparserv2.jar"
    oracle.aurora.ejb.deployment.GenerateEjb
    -u
    scott
    -p
    tiger
    -s
    sess_iiop://208.13.222.141:2481:CTPOS
    -republish
    -keep
    -temp
    TEMP
    -descriptor
    "D:\Program Files\JDeveloper 3.2\myprojects\Emp.xml"
    -oracledescriptor
    D:\Program Files\JDeveloper 3.2\myprojects\Emp_oracle.xml
    -generated
    "D:\Program Files\JDeveloper 3.2\myprojects\EmpGenerated.jar"
    "D:\Program Files\JDeveloper 3.2\myprojects\EmpSource.jar"
    org.omg.CORBA.COMM_FAILURE: java.io.IOException: Peer disconnected socket minor code: 0 completed: No
    org.omg.CORBA.portable.InputStream com.visigenic.vbroker.orb.GiopStubDelegate.invoke(org.omg.CORBA.Object, org.omg.CORBA.portable.OutputStream, org.omg.CORBA.StringHolder, org.omg.CORBA.Context, org.omg.CORBA.ContextList)
    org.omg.CORBA.portable.InputStream com.visigenic.vbroker.orb.GiopStubDelegate.invoke(org.omg.CORBA.Object, org.omg.CORBA.portable.OutputStream, org.omg.CORBA.StringHolder)
    org.omg.CORBA.portable.InputStream com.inprise.vbroker.CORBA.portable.ObjectImpl._invoke(org.omg.CORBA.portable.OutputStream, org.omg.CORBA.StringHolder)
    byte[] oracle.aurora.AuroraServices._st_LoginServer.O3Logon_A_Locale(java.lang.String, oracle.aurora.AuroraServices.Locale)
    boolean oracle.aurora.client.Login.authenticate(java.lang.String, java.lang.String, java.lang.String)
    boolean oracle.aurora.jndi.sess_iiop.SessionCtx.login(java.lang.String, java.lang.String, java.lang.String)
    boolean oracle.aurora.jndi.sess_iiop.SessionCtx.login()
    oracle.aurora.jndi.sess_iiop.SessionCtx oracle.aurora.jndi.sess_iiop.ServiceCtx.login()
    void oracle.aurora.server.tools.sess_iiop.ToolImpl.initializeSession()
    java.lang.String[] oracle.aurora.server.tools.sess_iiop.ToolImpl.parseStdArgs(java.lang.String[])
    void oracle.aurora.server.tools.sess_iiop.ToolImpl.invoke(java.lang.String[], java.io.InputStream, java.io.PrintStream, java.io.PrintStream)
    void oracle.aurora.ejb.deployment.GenerateEjb.main(java.lang.String[])
    Exception in thread main
    *** Errors occurred while deploying the EJB to 8i JVM ***
    *** Deployment completed ***
    null

    there area couple of notes at the following location which describe how to setup ias 9i and then deploy bc4k app's to it .
    http://technet.oracle.com/docs/products/jdev/howto.html

  • Cast Exception Issue. Please help

    Hello all,
    I have a piece of code that is giving me runtime class cast exception error.
    The error occurs whenever code trys to cast the tableData into Strin.
    Any insight into why this error occurs I would I appreciate the information:
    for (int i=0; i<rowCount; i++)
    List tableData = this.tableModel.getRow(i);
    System.out.println("we are here 5.1");
    row = sheet1.createRow((short)(i+1));
    System.out.println("we are here 5.2");
    for (int j=0; j<tableData.size(); j++)
    String columnData = (String)tableData.get(j);
    row.createCell((short)j).setCellValue((String)tableData.get(j));
    currentCell++;
    frame.current.setValue(currentCell);
    }

    The scope of the code is taking results of table data(from database) which could be string, number or other data types and converting it into string which in turn gets written to excel spreadsheet cell.
    I'm really taking shortcut in that I dont try and figure out the datatype from database value first then try to cast it into appropriate value. Taking the easy way out so to speak...
    BTW, I'm relatively new to Java. Still a lot of OJT.

  • Getting Error in Viewing Report..Please help

    Post Author: gauravitech
    CA Forum: JAVA
    Hi All,
      I am new to Crystal Report world.. I am trying to integrate Crystal Report with FileNet. FileNet has its own API to call webservices for Crystal report which bring reports back to the web application. I am getting some error like incopatible cast type objects. Please help me to resolve this..For me it seems to  be a jar problem
    Thanks in advance for your replies....
    Below is the error:
    Error Message:com.crystaldecisions.xml.serialization.SaveOption.setTimeZone(Ljava/util/TimeZone;)VException Class:java.lang.NoSuchMethodErrorStack Trace:java.lang.NoSuchMethodError: com.crystaldecisions.xml.serialization.SaveOption.setTimeZone (Ljava/util/TimeZone;)V    at com.crystaldecisions.proxy.remoteagent.TCPIPCommunicationAdapter.setTimeZone (Unknown Source)    at com.crystaldecisions.sdk.occa.report.application.ReportAppSession.int (Unknown Source)    at com.crystaldecisions.sdk.occa.report.application.ReportAppSession.initialize (Unknown Source)    at com.filenet.rm.apps.server.ui.report.crystal.CrystalAdapter.executeReport (CrystalAdapter.java:35)    at com.filenet.rm.apps.server.ui.report.crystal.CrystalManager.execute (CrystalManager.java:40)    at com.filenet.rm.apps.server.ui.report.ReportModule.onStartPage (ReportModule.java:93)    at com.filenet.wcm.toolkit.server.base.WcmController.broadcastStartPageEvent (WcmController.java:4531)    at com.filenet.wcm.toolkit.server.base.WcmController.initializeModulesWork (WcmController.java:3641)    at com.filenet.wcm.toolkit.server.base.WcmController.initializeModules (WcmController.java:3574)    at com.filenet.wcm.toolkit.server.base.WcmController.initializeModules (WcmController.java:3446)    at com.filenet.wcm.toolkit.server.base.WcmController.handleEvent (WcmController.java:3157)    at com.filenet.wcm.apps.server.controller.WcmWorkplaceController.handleEvent (WcmWorkplaceController.java:495)    at com.filenet.wcm.toolkit.server.base.WcmController.handleEvent (WcmController.java:3089)    at jsp_servlet._reports.__rmviewreport._jspService (__rmviewreport.java:206)    at weblogic.servlet.jsp.JspBase.service (JspBase.java:33)    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run (ServletStubImpl.java:1006)    at weblogic.servlet.internal.ServletStubImpl.invokeServlet (ServletStubImpl.java:419)    at weblogic.servlet.internal.ServletStubImpl.invokeServlet (ServletStubImpl.java:315)    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run (WebAppServletContext.java:6718)    at weblogic.security.acl.internal.AuthenticatedSubject.doAs (AuthenticatedSubject.java:321)    at weblogic.security.service.SecurityManager.runAs (SecurityManager.java:121)    at weblogic.servlet.internal.WebAppServletContext.invokeServlet (WebAppServletContext.java:3764)    at weblogic.servlet.internal.ServletRequestImpl.execute (ServletRequestImpl.java:2644)    at weblogic.kernel.ExecuteThread.execute (ExecuteThread.java:219)    at weblogic.kernel.ExecuteThread.run (ExecuteThread.java:178)

    Post Author: Ted Ueda
    CA Forum: JAVA
    If SaveOption doesn't have setTimeZone method, then my best guess is that either Serialization.jar file is from a version older than it should be, or rasapp.jar is newer than it should be - there might be a mixing of jar files from different versions of the RAS SDK.  I'd recommend cleaning out the jars and copying then anew from the installation folder.
    Sincerely,
    Ted Ueda

  • Urgent Please help: Error Testing EJB in Universal Test Client

    Hi,
    I have to get this working by tommrow guys - can you please help.
    I wonder if someone can assist. I am new to WSAD 5.1 and am trying to test an EJB I have created with both local and remote interfaces.
    The bean has been created OK and ithe stub files have created for the bean via Generate->Deploy and RMIC code.
    The RJB project has been defind in my WAS server correctly. The JNDI name in the EJB is \ejb\MyEJBHome
    I start the Universal Test client (UTC) via the options on my WAS Server and then click on the JNDI explorer icon option and see my local EJB Folder and an ejb folder (plus others). If I go to the local EJB folder the stub for my local home inteface appears , I am able to click on it and consumme the bean.
    However if I go to the ejb folder I see my home stub for the remote inteface , I do indded need to click on this to get at the remote inteface for my bean. However on clicking it I get a WAS error "null reference found".
    It does not appear to be able to get at the MyBeanHome stub (no reference to it).
    Ok what am I doing wrong! The project build with no errors and I can see all the stubs in the ejbModule folder. Now is the UTC expecting these stubs to be sitting in a particular directory? if so where?

    Hi Problem is with
    public class MyEJBBean extends AbstractStatelessSessionBean {
         private javax.ejb.SessionContext mySessionCtx;
    extends AbstractStatelessSessionBean causes a problem in UTC.
    Regards.

  • Getting EJB spec violation error - please help

    I'm getting following error while trying to deploy my stateless SB.
    17:13:30,399 WARN [verifier] EJB spec violation:
    Bean : UnifiedMsg
    Method : public abstract UnifiedMsg create() throws CreateException, RemoteExcep
    tion
    Section: 7.10.6
    Warning: The method return values in the home interface must be of valid types f
    or RMI/IIOP.
    17:13:30,399 ERROR [MainDeployer] could not create deployment: file:/C:/AddOnPkg
    /jboss-3.2.5/server/all/deploy/webmail_ejb_session_umm.jar
    org.jboss.deployment.DeploymentException: Verification of Enterprise Beans faile
    d, see above for error messages.
    at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:517)
    at org.jboss.deployment.MainDeployer.create(MainDeployer.java:790)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:644)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:608)
    at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    I've double check the section 7.10.6 requiremnts and do not find anything wrong. Stuck at this from many days,PLEASE HELP
    SB home interface is as follow:
    import java.util.*;
    import javax.ejb.*;
    import java.rmi.*;
    public interface UnifiedMsgHome extends EJBHome {
    public UnifiedMsg create() throws CreateException, RemoteException;

    Hai,
    My dear friends, I am getting some problem. In my system only. mean. I am getting from the CVS and as our batch file i am deploying. I thing, this problem i am only getting in my team. By givein this error. i repleace the JBoss server from my backup softwares. Even it is giving same error. three of our team also check the bug, but not able to resolve. Let me know any external errors instemd of ejb method errors. because it is working in the other systems.
    the bug details:
    14:20:56,717 INFO [EARDeployer] Init J2EE application: file:/D:/jboss-4.0.2/server/default/deploy/matrix.ear
    14:21:02,530 WARN [verifier] EJB spec violation:
    Bean : AddressManagerSessionBean
    Section: 22.2
    Warning: The Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean's busines
    Info : Class not found on 'uk.ses.matrix.address.bean.AddressManagerSessionBean': Unexpected error during load of: uk.ses.matr
    14:21:02,530 WARN [verifier] EJB spec violation:
    Bean : ADMCustomerSessionBean
    Section: 22.2
    Warning: The Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean's busines
    Info : Class not found on 'uk.ses.matrix.address.bean.ADMCustomerSessionBean': Unexpected error during load of: uk.ses.matrix.
    14:21:02,530 WARN [verifier] EJB spec violation:
    Bean : ADMServicePointSessionBean
    Section: 22.2
    14:21:02,608 ERROR [MainDeployer] could not create deployment: file:/D:/jboss-4.0.2/server/default/tmp/deploy/tmp17389matrix.ear
    org.jboss.deployment.DeploymentException: Verification of Enterprise Beans failed, see above for error messages.
    at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:553)
    at org.jboss.deployment.MainDeployer.create(MainDeployer.java:918)
    at org.jboss.deployment.MainDeployer.create(MainDeployer.java:910)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:774)
    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
    at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    please give suggestions to solve this.

  • EJB Please Help

    Dear all,
    At the time of creation EJB's , 4 interfaces are created.
    Out of this, i have doubts like,,
    i have the general idea that , EJB contains
    1) Remote Interface
    2) Home Interface
    3) Bean Class...
       But what is the importance of the
    Two Remote Interfaces ,, ?
    and
    Two Home Interfaces.. ?
    I need the help about the necessity of that
    Local interface and LocalHome interface?..
             Please help me with suitable helps and exact reasons means importance of these Interfaces  ..
                                        With Regards
                                           Kishor

    Hi Kishor,
    Simply put remote interfaces are a remote view, local interfaces for local view of the EJB logic. If you are not going to access the EJBs remotely (that is from a separate JVM), you can drop parameter serialization/deserialization as well as marshalling overhead and use local interfaces.
    Still you have to keep in mind the difference - remote invokation is pass by value, local is pass by reference.
    So beware of surprises if you are modifying the passed as parameters Objects. While using a remote interface, the <u><b>copy</b></u> of the passed Object will be modified, with local interface you will change the <b><u>original</u></b>.
    Have fun: Iavor

  • JDev 10.1.3 generates incorrect getter/setter for CMP EJB 3.0 - Please help

    Hi,
    I am using JDev 10.1.3 Production and using the EJB3.0 CMP wizard to generate the code from a MySQL database. No matter what type I specify for my database columns in schema, code generator always generates the properties of type String only. e.g if a column called Age is specified as Integer in schema, the generator generates setters/getters with String type.
    Can somebody please help me.
    Regards
    Vimal

    I was able to reproduce the problem and logged bug 5035459 for now. -- thanks

  • Class Cast problem when attempting to add Object in TreeSet, Please Help...

    hi friends,
    I have a TreeSet Object in which i add Object of type WeatherReport but when I trying to add my Second WeatherReport Object it throwing ClassCastException please Help Me in figure out the mistake that i did...
    /*code sample of my WeatherReport.class*/
    package com;
    class WeatherReport implements Serializable
    private String region;
    private String desc;
    private String temp;
    /*equvalent getter and setters come here*/
    /*in my jsp*/
    <%@ page import="com.WeatherReport"%>
    <%
    TreeSet<com.WeatherReport> ts=new TreeSet<com.WeatherReport>();
    while(condition)
    WeatherReport wp=new WeatherReport();
    /*setting data for all the Methods*/
    ts.add(wp);
    %>
    Error:
    java.lang.ClassCastException: com.WeatherReport
            at java.util.TreeMap.compare(TreeMap.java:1093)
            at java.util.TreeMap.put(TreeMap.java:465)
            at java.util.TreeSet.add(TreeSet.java:210)
            at org.apache.jsp.Weather_jsp._jspService(Weather_jsp.java:138)
            at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
            at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
            at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
            at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
            at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
            at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
            at java.lang.Thread.run(Thread.java:595)Edited by: rajaram on Oct 31, 2007 12:56 AM

    hi ChuckBing,
    Thank you very much, your suggestion helps me a lot...
    I change the WeatherReport Class as follows and its working now...
    public class WeatherReport implements Serializable,Comparable {
        private String location;
        private String temp;
        private String desc;
        public int compareTo(Object o) {
            if(o instanceof WeatherReport)
                WeatherReport wp=(WeatherReport)o;
                String l1=wp.getLocation();
                String l2=this.getLocation();
                return l2.compareTo(l1);
            return -1;
    }Once Again Thanks a lot ...
    Edited by: rajaram on Oct 31, 2007 9:11 PM

  • Error parsing weblogic-ejb-jar. HELP please :(

    When I have added the transaction-descriptor into weblogic-ejb-jar.xml I start getting next error:
    [java] ERROR: Error parsing 'META-INF/weblogic-ejb-jar.xml' line 18: The content of element type "weblogic-enterprise-bean" must match "(ejb-name,caching-descriptor?,persistence-descriptor?,clustering-descriptor?,transaction-descriptor?,reference-descriptor?,enable-call-by-reference?,jndi-name?,transaction-isolation*)".
    The weblogic-ejb.jar.xml is the next:
    <?xml version="1.0"?>
    <!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB//EN' 'http://www.bea.com/servers/wls510/dtd/weblogic-ejb-jar.dtd'>
    <weblogic-ejb-jar>
         <weblogic-enterprise-bean>
         <ejb-name>statelessSession</ejb-name>
         <caching-descriptor>
              <max-beans-in-free-pool>100</max-beans-in-free-pool>
              <idle-timeout-seconds>1200</idle-timeout-seconds>
         </caching-descriptor>
         <transaction-descriptor>
         <trans-timeout-seconds>50</trans-timeout-seconds>
         </transaction-descriptor>
         <jndi-name>statelessSession.EcasServicesHome</jndi-name>
         </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    Please tell me what did I do wrong and how to fix the problem.
    Thnx.
    VG.

    I suspect you are using a version of WebLogic higher than 5.1. Coz, your XML is invalid if I use the following DOCTYPE.
    <!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN" "http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd">
    You can try this
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN" "http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd">
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>statelessSession</ejb-name>
    <stateless-session-descriptor>
    <pool>
    <max-beans-in-free-pool>100</max-beans-in-free-pool>
    <initial-beans-in-free-pool>20</initial-beans-in-free-pool>
    </pool>
    </stateless-session-descriptor>
    <transaction-descriptor>
    <trans-timeout-seconds>50</trans-timeout-seconds>
    </transaction-descriptor>
    <jndi-name>statelessSession.EcasServicesHome</jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    cheers !
    Dips

  • _iiopClient.jar is not generated - please help!

    I have an application where an EJB exposes its remote interface to the web application. The web application can ONLY call this EJB from the ejb application, no other. All other EJBs are accessed locally from this EJB (Business Delegate pattern).
    The problem is that normal Java casting fails for the home object returned by the JNDI context lookup. So I am using PortableRemoteObject.narrow() and it predictably fails with the message that _iiopClient.jar is required on the classpath.
    So, on OEM, I enabled IIOP for the target server instance by checking all three options:
    Generate IIOP Client Stubs when Compiling EJBs
    IIOP Wrapper Code Debug Mode
    Keep Generated IIOP Source Code
    Now I am deploying the application, but the iiopClient.jar is nowhere to be seen. Please tell me what I am doing wrong; or what alternatives do I have to get this application working.
    I am using Oracle AS 10.1.3
    This is a bit urgent; please help! TIA.

    Thanks...I would like to see the whole posting I am interested in the InitialContext properties, you can hide the username and pwd for security purposes. What I am trying to say that there should be no problems to access the EJB from your web Application within the same ear.
    Here is an example:
    // Code to look up an EJB object is part of some other J2EE application in the same server
    import java.sql.Connection;
    import javax.naming.InitialContext;
    import javax.naming.Context;
    import javax.sql.DataSource;
    //Note :This code assumes EJBHomeInterface and EJBRemoteInterface already exist
    public class Code2{
    public Code2()
         Hashtable env = new Hashtable(); // set the environment properties
         env.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.RMIInitialContextFactory");
         env.put(Context.PROVIDER_URL, "ormi:///ejbsample");
         env.put(Context.SECURITY_PRINCIPAL, "admin");
         env.put(Context.SECURITY_CREDENTIALS, "welcome");
         try {
    // create an initial context using the above environment properties
              Context context = new InitialContext(env);
              EJBRemoteInterface ejbObject; // Perform look up using JNDI name of ejb object
              Object boundObject = context.lookup("ObjectName");
    // Narrow the reference of the object returned by lookup() method
              EJBHomeInterface homeInterface = (EJBHomeInterface)PortableRemoteObject.narrow( boundObject, EJBHomeInterface.class);
    // create an EJB instance
              ejbObject =homeInterface.create();
         catch (NamingException e) {
         System.out.println(e.toString());
    } It all depends on the kind of InitialContext Factory you are using. See this link
    Hope this helps.
    Deepak

  • Please help me to run this CMP BEAN, I need help urgently, I am running out of time :(

    Hi,
    I am facing this problem, Please help me, I am attaching the source files
    also along with the mail. This is a small CMP EJB application, I am using
    IAS SP2 on NT server with Oracle 8. I highly appreciate if someone can send
    me the working copy of the same. I need these urgent. I am porting all my
    beans from bea weblogic to Iplanet. Please help me dudes.
    Err.........
    [06/Sep/2001 13:41:29:7] error: EBFP-marshal_internal: internal exception
    caught
    in kcp skeleton, exception = java.lang.NoSuchMethodError
    [06/Sep/2001 13:41:29:7] error: Exception Stack Trace:
    java.lang.NoSuchMethodError
    at
    com.se.sales.customer.ejb_kcp_skel_CompanyHome.create__com_se_sales_c
    ustomer_Company__java_lang_Integer__indir_wstr__215617959(ejb_kcp_skel_Compa
    nyHo
    me.java:205)
    at com.kivasoft.ebfp.FPRequest.invokenative(Native Method)
    at com.kivasoft.ebfp.FPRequest.invoke(Unknown Source)
    at
    com.se.sales.customer.ejb_kcp_stub_CompanyHome.create(ejb_kcp_stub_Co
    mpanyHome.java:297)
    at
    com.se.sales.customer.ejb_stub_CompanyHome.create(ejb_stub_CompanyHom
    e.java:89)
    at
    com.se.sales.customer.CompanyServlet.doGet(CompanyServlet.java:35)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at
    com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    at
    com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unkno
    wn Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    Caught an exception.
    java.rmi.RemoteException: SystemException: exid=UNKNOWN
    at com.kivasoft.eb.EBExceptionUtility.idToSystem(Unknown Source)
    at com.kivasoft.ebfp.FPUtility.replyToException(Unknown Source)
    at
    com.se.sales.customer.ejb_kcp_stub_CompanyHome.create(ejb_kcp_stub_Co
    mpanyHome.java:324)
    at
    com.se.sales.customer.ejb_stub_CompanyHome.create(ejb_stub_CompanyHom
    e.java:89)
    at
    com.se.sales.customer.CompanyServlet.doGet(CompanyServlet.java:35)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at
    com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    at
    com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unkno
    wn Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    Thanks in advance
    Shravan
    [Attachment iplanet_app.jar, see below]
    [Attachment iplanet_src.jar, see below]

    One reason that I sometimes get 'NoSuchMethodError' is when I make a change to a
    java class that is imported into another java class. When I go to run the
    importing class, it will throw a 'NoSuchMethodError' on any methods that I've
    changed in the imported class. The solution is to recompile the importing class
    with the changed classes in the classpath.
    shravan wrote:
    Hi,
    I am facing this problem, Please help me, I am attaching the source files
    also along with the mail. This is a small CMP EJB application, I am using
    IAS SP2 on NT server with Oracle 8. I highly appreciate if someone can send
    me the working copy of the same. I need these urgent. I am porting all my
    beans from bea weblogic to Iplanet. Please help me dudes.
    Err.........
    [06/Sep/2001 13:41:29:7] error: EBFP-marshal_internal: internal exception
    caught
    in kcp skeleton, exception = java.lang.NoSuchMethodError
    [06/Sep/2001 13:41:29:7] error: Exception Stack Trace:
    java.lang.NoSuchMethodError
    at
    com.se.sales.customer.ejb_kcp_skel_CompanyHome.create__com_se_sales_c
    ustomer_Company__java_lang_Integer__indir_wstr__215617959(ejb_kcp_skel_Compa
    nyHo
    me.java:205)
    at com.kivasoft.ebfp.FPRequest.invokenative(Native Method)
    at com.kivasoft.ebfp.FPRequest.invoke(Unknown Source)
    at
    com.se.sales.customer.ejb_kcp_stub_CompanyHome.create(ejb_kcp_stub_Co
    mpanyHome.java:297)
    at
    com.se.sales.customer.ejb_stub_CompanyHome.create(ejb_stub_CompanyHom
    e.java:89)
    at
    com.se.sales.customer.CompanyServlet.doGet(CompanyServlet.java:35)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at
    com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    at
    com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unkno
    wn Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    Caught an exception.
    java.rmi.RemoteException: SystemException: exid=UNKNOWN
    at com.kivasoft.eb.EBExceptionUtility.idToSystem(Unknown Source)
    at com.kivasoft.ebfp.FPUtility.replyToException(Unknown Source)
    at
    com.se.sales.customer.ejb_kcp_stub_CompanyHome.create(ejb_kcp_stub_Co
    mpanyHome.java:324)
    at
    com.se.sales.customer.ejb_stub_CompanyHome.create(ejb_stub_CompanyHom
    e.java:89)
    at
    com.se.sales.customer.CompanyServlet.doGet(CompanyServlet.java:35)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at
    com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    at
    com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unkno
    wn Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    Thanks in advance
    Shravan
    Name: iplanet_app.jar
    iplanet_app.jar Type: Java Archive (application/java-archive)
    Encoding: x-uuencode
    Name: iplanet_src.jar
    iplanet_src.jar Type: Java Archive (application/java-archive)
    Encoding: x-uuencode

  • Please, help me learn J2EE...point me out to better tutorials or something!

    Hi,
    Guys, I really need help in trying to learn what J2EE is.
    I've got prior knowledge and experience on Java (I thought), but ever since I came across the terms J2EE, EJB, JNI, JSP, JDBC and all that crap, I now don't know what I actually learnt!
    Please bear with me I beg of you! :)
    1.0: What I've learnt.
    ===============================
    So far, I've learnt (I think) the core/basics of the Java language, covering uhm...the basics up to GUIs, Arrays, IOStreams...yeah I think that's it.
    I code using notepad and compile them using the SDK...which up to now I still don't know if it is an SE or EE edition. It's j2sdk1.4.0 the last time I checked. I didn't use any IDE.
    I've done (school) projects like a Library System (involves loaning of books and charges etc etc), a Chalet Organizer (Loaning out chalets/rooms and charges etc etc) and an Appointment Organizer.
    So what was that which I learnt? Am I right to say that that is only core Java and nothing else and is next to worthless in the working world?
    2.0: Why I want to learn J2EE.
    ===============================
    Okay so why do I want to learn specifically J2EE? Well, most employment opportunities here require J2EE and EJB (and maybe some other alien terms) as prerequisites to being a "Java Programmer".
    I really need the job as soon as possible (for family's sake) and the job market here is already saturated with webmasters..
    3.0: What I have tried.
    ===============================
    Believe me, I tried for like 2 months already to try learn this thing on my own.
    I have followed almost exactly to the J2EE "Beginner's Tutorial" found on http://java.sun.com/j2ee/tutorial/ but no matter how far I read, I'm still just as clueless as I was when I was in my mother's womb about what J2EE is all about, even though I did the examples. I stopped somewhere in the middle of "Getting Started" because I realized I wasn't learning anything at all.
    4.0: Help meeeeeee...
    ===============================
    4.1:
    Can anyone please help me set my head straight and either point me to a REAL beginner's tutorial on J2EE and what the heck it is, or help explain to me slowly what J2EE really is and how to learn it?
    4.2:
    What's the difference between J2EE and J2SE?!? I initially thought that J2SE was simply just a smaller download which didn't include some of the heavier stuff that the EE carried, but boy was I wrong when that same tutorial asked me to install BOTH of them!
    4.3:
    Is it right for me to think that EJB are just files which are precoded to facilitate programming? e.g.:(I could've written up my own Date class instead of using the standard Date class that everybody uses.)
    4.4:
    What the hell is Jakarta Ant? Is it a builder and not a compiler, and may allow me to run built programs just by double-clicking on an e.g. executable? Like C++? So that I don't have to go to command prompt and type "java myApp.class"? (OT, but I think it's ridiculous that Apache has this and not Sun!!)
    4.5:
    Is there a simpler, much much much simpler example of a J2EE tutorial besides the overly vague tutorial "The Duke's Bank Application"? I need more examples of smaller scale maaaan... Better yet, is there a tutorial around that covers the very very very basics of Java all the way up to J2EE, step by step and with ample explanations?
    =========================
    Thanks all, I would really really appreciate any heads up you can provide me with.
    Sincerely, Kai.

    Lee and tsith - same fella -
    Run Tomcat as a standalone critter - the install of the current ver (4.1.12?) on a Windows machine sets it up nicely, and you don't have to worry about web connectors and stuff. Just create a few JSPs and dump them somewhere under the ROOT directory of your webapps directory and you should be able to hit them via a URL like http://localhost:8080/test.jsp (assuming you have it running on port 8080). Once you get your fill of the JSP thing, make a serrvlet and look into creating WAR files - then copy your WAR file into webapps subdirectory of your Tomcat installation and play with that. When you've had enough Servlet fun, then look into JBoss and making EAR files and you'll have all sorts of fun with JNDI and JDBC and all those other acronyms.
    Ant is just a build tool, not a compiler. Compiling simple java classes is no big deal, 'cause you just type javac MyClass.java or some such. But when you get into complicated build processes (like, compile these classes, making sure to include the J2EE jar and all the other jars I need, and create a WAR file, and deploy it to Tomcat) then Ant really helps.
    If you want help documenting your classes, the javadoc tool is for you.
    Lee

  • Please help with my helper class

    Hi,
    plz I need some assistance with this:
    I have a big table which consist of 200 columns. This table gets fields from different tables. It has records of orders which may have several items and each item can have up to 8 taxes. So i have fields reaping for other order order records. I need to display an order then have a navigation to list items in details, with all its taxes, one by one.
    Here is how I have decided to do it in a nutshell. I have decided to get all taxes of a particular item and put in a map with tax_codes as values and tax details arraylist as values. I then add this to an item with its other details. then I add items to a particular order. I have separated orders,items and taxes in their separate beans. Im trying to first the implimentation for each order, item and taxes by displaying them on a JSP. However am currently getting the following error with taxdetails:
    java.lang.ClassCastException: OrderItems.ItemTax cannot be cast to java.lang.String
    at OrderItems.OrderDetails.getItemTaxDetails(OrderDetails.java:166)
    at OrderItems.Controller.processRequest(Controller.java:57)
    at OrderItems.Controller.doGet(Controller.java:72)
    I have a list of all itemTaxCodes am iterating and am casting to string...am not casting ItemTax object.Here is my code below:
    OrderDetails.java
    package orderitems;
    import java.sql.*;
    import java.util.*;
    public class OrderDetails {
        private LineOder lineOrder;
        private Map lineItems;
        //returns an item number, key_item, from its unique keys
        public int getItemNumber(int key_item, String key_year,
                String key_office,String key_client,String key_company){
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            int itmNum = 0;
             * key_item a unique number for an item.
             * key_year,key_office,key_client,key_company unique keys
             * for each order where this key_item is taken
             * from.
            String select = "SELECT key_item FROM "+
                    Constants.WEB_TABLE +" WHERE key_item = " + key_item +
                    " AND key_year = '" + key_year + "'" +
                    " AND key_office = '" + key_office + "'" +
                    " AND key_client = '" + key_client + "'" +
                    " AND key_company = '" + key_company +"'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                if(rst.next()){
                    itmNum = Integer.parseInt(rst.getString("key_item"));
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return itmNum;
        //get a list of item number(item codes)
        public List getAllItemNumbers(String key_year,
                String key_office,String key_client,String key_company){
            List itemNumbers = new ArrayList();
            LineItem itemNumber = null;
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            String select = "SELECT key_item FROM "+ Constants.WEB_TABLE +
                    " WHERE key_year = '" + key_year + "'" +
                    " AND key_office = '" + key_office + "'" +
                    " AND key_client = '" + key_client + "'" +
                    " AND key_company = '" + key_company + "'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                while(rst.next()){
                    itemNumber = new LineItem();
                    itemNumber.setKey_item(Integer.parseInt(rst.getString("key_item")));
                    itemNumbers.add(itemNumber);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return itemNumbers;
        //get a list of tax codes
        public List getAllTaxCodes(int key_item, String key_year,
                String key_office,String key_client,String key_company){
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            ItemTax taxCode;
            List taxCodes = new ArrayList();
            int itemNum = getItemNumber(key_item, key_year,
                    key_office,key_client,key_company);
            String select = "SELECT key_tax_code FROM "+
                    Constants.WEB_TABLE +" WHERE key_item = " + itemNum +
                    " AND key_year = '" + key_year + "'" +
                    " AND key_office = '" + key_office + "'" +
                    " AND key_client = '" + key_client + "'" +
                    " AND key_company = '" + key_company +"'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                while(rst.next()){
                    taxCode = new ItemTax();
                    taxCode.setKey_tax_code(rst.getString("key_tax_code"));
                    taxCodes.add(taxCode);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return taxCodes;
        //use tax code to get tax details
        public Map getItemTaxDetails(String key_year,String key_office,
                String key_client,String key_company,int key_item){
            ItemTax taxDetail = null;
            List taxDetails = new ArrayList();
            List itemTaxCodes = new ArrayList();
            Map itemTaxdetails = new HashMap();
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            //get a list of all tax codes of an item with a
            //given item number
            itemTaxCodes = getAllTaxCodes(key_item,key_year,///a list of tax codes
                    key_office,key_client,key_company);
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                for(Iterator taxCodeIter= itemTaxCodes.iterator(); taxCodeIter.hasNext();){
                    String taxCode = (String)taxCodeIter.next();/////casting taxtCode to string***exception occurs from here
                    String select = "SELECT tax_type,tax_value," +
                            "tax_limit_val FROM "+ Constants.WEB_TABLE +
                            " WHERE key_item = "+ key_item +
                            " AND key_year = '" + key_year + "'" +
                            " AND key_office = '" + key_office + "'" +
                            " AND key_client = '" + key_client + "'" +
                            " AND key_company = '" + key_company +"'" +
                            " AND key_tax_code = '" + taxCode + "'";///tax code string
                    rst = stat.executeQuery(select);
                    while(rst.next()){
                        taxDetail = new ItemTax();
                        //records to be displayed only
                        taxDetail.setKey_item(Integer.parseInt(rst.getString("key_item")));
                        taxDetail.setTax_value(rst.getString("tax_value"));
                        taxDetail.setTax_limit_val(Float.parseFloat(rst.getString("tax_limit_val")));
                        //////other details records ommited//////////////////////////
                        taxDetails.add(taxDetail);
                //a HashMap of all tax code as keys and list of details as values 4 each key
                for(int i = 0;i<itemTaxCodes.size(); i++){
                    itemTaxdetails.put(itemTaxCodes.get(i),taxDetails.get(i));
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return itemTaxdetails;
        //details of an item with all its taxes
        public List getAllItemDetails(String key_year,
                String key_office,String key_client,String key_company){
            List lineItems = new ArrayList();
            List itemNumbers = new ArrayList();
            Map taxDetails = new HashMap();
            LineItem item = null;
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            //A list of all item numbers in the declaration
            itemNumbers = getAllItemNumbers(key_year,
                    key_office,key_client,key_company);
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                for(Iterator itemIter= itemNumbers.iterator(); itemIter.hasNext();){
                    int itemNumber = ((Integer)itemIter.next()).intValue();
                    String select = "SELECT item_description,item_mass," +
                            "item_cost" +
                            " FROM " + Constants.WEB_TABLE +
                            " WHERE key_year = '"+key_year+"'" +
                            " AND key_office = '"+key_office+ "'"+
                            " AND key_client = '"+key_client+ "'"+
                            " AND key_company = '"+key_company+ "'"+
                            " AND key_item = " + itemNumber;
                    rst = stat.executeQuery(select);
                    while(rst.next()){
                        item = new LineItem();
                        item.setItem_description(rst.getString("item_description"));
                        item.setItem_mass(Float.parseFloat(rst.getString("item_mass")));
                        item.setKey_item(Integer.parseInt(rst.getString("item_cost")));
                        //////other details records ommited//////////////////////////
                        //A HashMap of all itemTaxeCodes as its keys and an ArrayList of itemTaxedetails as its values
                        taxDetails = getItemTaxDetails(item.getKey_year(),item.getKey_office(),
                                item.getKey_client(),item.getKey_company(),item.getKey_item());
                        //item tax details
                        item.setItmTaxes(taxDetails);
                        //list of items with tax details
                        lineItems.add(item);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return lineItems;
        public Set getDeclarations(String key_year,String key_cuo,
                String key_dec,String key_nber){
            List lineItems = new ArrayList();
            Set lineOrders = new HashSet();
            Connection conn = null;
            Statement stat = null;
            ResultSet rst = null;
            LineOder lineOrder = null;
            String select = "SELECT * FROM " + Constants.WEB_TABLE +
                    " WHERE key_year = '" + key_year + "'" +
                    " AND key_cuo = '" + key_cuo + "'" +
                    " AND key_dec = '" + key_dec + "'" +
                    " AND key_nber = '" + key_nber + "'";
            DbConnection dbConn = new DbConnection();
            try {
                conn = dbConn.getDbConnection(Constants.WEB_JNDI);
                stat = conn.createStatement();
                rst = stat.executeQuery(select);
                while(rst.next()){
                    lineOrder = new LineOder();
                    lineOrder.setKey_year(rst.getString("key_year"));
                    lineOrder.setKey_office(rst.getString("key_cuo"));
                    lineOrder.setKey_client(rst.getString("key_dec"));
                    lineOrder.setKey_company(rst.getString("key_nber"));
                    ////list of items with all their details
                    lineItems = getAllItemDetails(lineOrder.getKey_year(),lineOrder.getKey_office(),
                            lineOrder.getKey_client(),lineOrder.getKey_company());
                    //setting item details
                    lineOrder.setItems(lineItems);
                    //a list of order with all details
                    lineOrders.add(lineOrder);
            } catch (SQLException ex) {
                ex.printStackTrace();
            } finally{
                SQLHelper.cleanUp(rst, stat, conn);
            return lineOrders;
    } and my testing servlet controller
    Controller.java
    package orderitems;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Controller extends HttpServlet {
        private Map taxDetails = new HashMap();
        //private List itemDetails = new ArrayList();
        //private Set orderDetails = new HashSet();
        private OrderDetails orderDetails = null;
        protected void processRequest(HttpServletRequest request,
                HttpServletResponse response)throws
                ServletException, IOException {
            response.setContentType("text/html;charset=UTF-8");
            String key_year = "2007";
            String key_office = "VZX00";
            String key_company = "DG20";
            String key_client =  "ZI001";
            int key_item = 1;
            String nextView = "/taxdetails_list.jsp";
            //String nextView = "/order_list.jsp";
            //String nextView = "/items_list.jsp";
            orderDetails = new OrderDetails();
            taxDetails = orderDetails.getItemTaxDetails(key_year,key_office,
                    key_company,key_client,key_item);
            //Store the collection objects into HTTP Request
            request.setAttribute("taxDetails", taxDetails);
            RequestDispatcher reqstDisp =
                    getServletContext().getRequestDispatcher(nextView);
            reqstDisp.forward(request,response);
        protected void doGet(HttpServletRequest request,
                HttpServletResponse response)throws
                ServletException, IOException {
            processRequest(request, response);
        protected void doPost(HttpServletRequest request,
                HttpServletResponse response)throws
                ServletException, IOException {
            processRequest(request, response);
    }I have not included code for beans to reduce on bulk.please help and with suggestions...
    Thanx in advance.
    Edited by: aiEx on Oct 3, 2007 8:13 AM

    aiEx wrote:
    sometimes a tap on the head is needed to really learn and understand :-)You're casting them to the String type while they are of the ItemTax type and you've confirmed it yourself. Likely you misunderstood the concepts behind "casting" and you was expecting some magic that they are automatically converted somehow from the ItemTax type to the String type while the ItemTax class isn't a subclass of the String class :)

Maybe you are looking for

  • Purchase order print program error

    hi experts! am facing a problem in my purchase order print program. the problem is that when i am trying to see the print preview the following dump error is throughing, which am not able to understand. the P.O total amount should be change into word

  • Pdf's won't display - get 403 access denied message

    And I apologize if this is answered previously. I'm new to Mac (from Windows for years) . I have read some old threads on this from 2005 or early 2006 and top of thread screen indicated topic closed (or something like that.) Problem: trying to access

  • What is the checkbox for in the name field?

    what does the checkbox in the name field do? i have audiobooks that i have already listened to and want them off my ipod (but still on the pc). there does not seem to be a way to have it not sync them like you can with a video already watched (ie: tv

  • Real time scenarios...

    hello ther ....i am simi .. iam new to sdn...i have my interview in sem bps..in a couple of days time..iam through with the theoritical bit ...my concerns are related to the questions that may arise about project scenarios....would be much obliged if

  • DME for Foreign payments in Italy

    Hello All SAP Gurus!!! I am using program RFFOIT_FOR for configuring DME for Foreign payments in Taly. But I am getting errors. I need to update the UIC code in the DME file. Please help.