JBoss ejb problem

I created a ear file wich contains a jar and war file. The jar contains an entity and session bean. The war file contains my junitee test case.
When I deploy the file I can surf to the url and my test goes fine. When I move the file from the deploy dir to someplace else (jboss starts undeploying) and move it back couple seconds later (jboss deploys again) I get this error while doing the same test again:
java.lang.ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293) ...........
The error appears at the line where I try to narrow cast the object to my home interface.
When I restard jboss , the test runs fine again.
Anyone ideas ?

When I move the file from the deploy dir to someplace else (jboss starts undeploying) and move it back couple seconds later (jboss deploys again)
This feature is called hot redeploy, the deploy directory is a place where you keep the files you want to deploy on the server. Whenever there are any changes in this directory .. moving files etc, the JBoss redeploys the new files, or undeploys the files removed from that place.
This is needed, because practically the servers are supposed to be up all the time, so if you need to make any updates etc, you could just paste the new files(or new versions) and they are redeployed.
I get this error while doing the same test again
When I restard jboss , the test runs fine again
This is happening because your test case is typically looking at the old version of your beans. But then why are you moving the files ... testing ? or do u really need to do that ?
If you are changing some implementation, just redploy the bean class and leave the interfaces like that. You should be fine
Regards
Meka Toka

Similar Messages

  • JMS - MDB, jboss deployment problem

    Hi everybody,
    I'm new to JMS/MDB and have following problem while deploying MDB under JBOSS:
    22:58:47,735 INFO [EjbModule] Deploying MyPublisher
    22:58:47,745 INFO [EjbModule] Deploying topicMessageBean
    22:58:47,795 WARN [StatelessSessionContainer] message-destination 'PhysicalTopic' has no jndi-name in jboss.xml
    22:58:47,845 INFO [ProxyFactory] Bound EJB Home 'MyPublisher' to jndi 'ejb/MyEj
    bReference'
    22:58:47,865 INFO [EJBDeployer] Deployed: file:/D:/DownLoads/ejb/JBoss/jboss-4.
    0.3/jboss-4.0.3/server/default/deploy/simplemessage.jar
    jboss.xml
    <jboss>
    <enterprise-beans>
    <message-driven>
    <ejb-name>topicMessageBean</ejb-name>
    <destination-jndi-name>topic/MyMDBTopic</destination-jndi-name>
    <mdb-connection-factory>
    <jndi-name>jms/MyTopicConnectionFactory</jndi-name>
    </mdb-connection-factory>
    </message-driven>
    <message-destination>
    <message-destination-name>PhysicalTopic</message-destination-name>
    <jndi-name>topic/MyMDBTopic</jndi-name>
    </message-destination>
    <session>
    <ejb-name>MyPublisher</ejb-name>
    <jndi-name>ejb/MyEjbReference</jndi-name>
    <resource-ref>
    <res-ref-name>jms/MyTopicConnectionFactory</res-ref-name>
    <jndi-name>jms/TopicConnectionFactory</jndi-name>
    <default-resource-principal>
    <name>guest</name>
    <password>guest</password>
    </default-resource-principal>
    </resource-ref>
    </session>
    </enterprise-beans>
    </jboss>
    ejb-jar.xml
    <ejb-jar>
    <display-name>MessageJAR</display-name>
    <enterprise-beans>
    <message-driven>
    <display-name>Topic Message Bean</display-name>
    <ejb-name>topicMessageBean</ejb-name>
    <ejb-class>MessageBean</ejb-class>
    <messaging-type>javax.jms.MessageListener</messaging-type>
    <message-selector></message-selector>
    <transaction-type>Container</transaction-type>
    <message-driven-destination>
    <destination-type>javax.jms.Topic</destination-type>
    <message-destination-link>PhysicalTopic</message-destination-link>
    </message-driven-destination>
    <activation-config>
    <activation-config-property>
    <activation-config-property-name>messageSelector</activation-config-property-name>
    <activation-config-property-value>NewsType = 'Sports' OR NewsType = 'Opinion'</activation-config-property-value>
    </activation-config-property>
    <activation-config-property>
    <activation-config-property-name>subscriptionDurability</activation-config-property-name>
    <activation-config-property-value>NonDurable</activation-config-property-value>
    </activation-config-property>
    </activation-config>
    </message-driven>
    <session>
    <display-name>MyPublisher</display-name>
    <ejb-name>MyPublisher</ejb-name>
    <home>PublisherHome</home>
    <remote>Publisher</remote>
    <ejb-class>PublisherBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    <resource-ref>
    <res-ref-name>jms/MyTopicConnectionFactory</res-ref-name>
    <res-type>javax.jms.TopicConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    <message-destination-ref>
    <!--message-destination-ref-name>topic/TopicName</message-destination-ref-name-->
    <message-destination-ref-name>topic/MyMDBTopic</message-destination-ref-name>
    <message-destination-type>javax.jms.Topic</message-destination-type>
    <message-destination-usage>Produces</message-destination-usage>
    <message-destination-link>PhysicalTopic</message-destination-link>
    </message-destination-ref>
    <security-identity>
    <use-caller-identity/>
    </security-identity>
    </session>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>topicMessageBean</ejb-name>
    <method-name>onMessage</method-name>
    <method-params>
    <method-param>javax.jms.Message</method-param>
    </method-params>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>MyPublisher</ejb-name>
    <method-intf>Remote</method-intf>
    <method-name>publishNews</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <message-destination>
    <message-destination-name>PhysicalTopic</message-destination-name>
    </message-destination>
    </assembly-descriptor>
    </ejb-jar>
    can somebody help???
    Zahid

    Hi,
    if possible, try with "max-bean-in-free-pool=1".
    note: it would be performance impact, as there would be single bean instance.
    Thanks,
    Qumar Hussain

  • JBoss Clustering problem

    I am not sure if this issue belongs to this forum. If not, please let me know and I will post it in the appropriate forum.
    My application has clustered remote SLSBs with "FirstAvaliable" policy.
    The BMP Entity Beans are set for cache invalidation as they exist at local level only. They is no clustering of entity beans.
    I am using Commit Option A.
    I want cache to invalidate bean on all nodes except the node it was accessed from.
    Here the cache is being cleared even on the node it was last accessed from.
    I executed a business method on the same node (due to FirstAvailable) and here is the list of methods encountered.
    setEntityContext
    ejbFindByPrimaryKey
    ejbActivate
    ejbLoad
    getAllAccounts
    ejbStore
    setEntityContext
    ejbActivate
    ejbLoad
    getAllAccounts
    ejbStore
    setEntityContext
    ejbActivate
    ejbLoad
    getAllAccounts
    ejbStore
    My expectation is that second and third time, in addition to my business method, only ejbLoad and ejbStore should be executed.
    After info from guides and forum topics, I have configured as under :
    cluster-service.xml
    ============
    I am using the default behaviour of JBoss-Cluster based bridge
    jboss.cache:service=InvalidationManager
    ${jboss.partition.name:DefaultPartition}
    DefaultJGBridge
    jboss:service=${jboss.partition.name:DefaultPartition}
    jboss.cache:service=InvalidationManager
    standardjboss.xml
    ============
    Container Configuration is defined as under : (Commit Option is A)
    <container-configuration>
    <container-name>Standard BMP 2.x EntityBean with cache invalidation</container-name>
    <call-logging>false</call-logging>
    <invoker-proxy-binding-name>entity-rmi-invoker</invoker-proxy-binding-name>
    <sync-on-commit-only>true</sync-on-commit-only>
    <insert-after-ejb-post-create>false</insert-after-ejb-post-create>
    <container-interceptors>
    org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor
    org.jboss.ejb.plugins.LogInterceptor
    org.jboss.ejb.plugins.SecurityInterceptor
    org.jboss.ejb.plugins.TxInterceptorCMT
    org.jboss.ejb.plugins.EntityCreationInterceptor
    org.jboss.ejb.plugins.EntityLockInterceptor
    org.jboss.ejb.plugins.EntityInstanceInterceptor
    org.jboss.ejb.plugins.EntityReentranceInterceptor
    org.jboss.resource.connectionmanager.CachedConnectionInterceptor
    org.jboss.ejb.plugins.EntitySynchronizationInterceptor
    org.jboss.cache.invalidation.triggers.EntityBeanCacheBatchInvalidatorInterceptor
    org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor
    </container-interceptors>
    <instance-pool>org.jboss.ejb.plugins.EntityInstancePool</instance-pool>
    <instance-cache>org.jboss.ejb.plugins.InvalidableEntityInstanceCache</instance-cache>
    <persistence-manager>org.jboss.ejb.plugins.BMPPersistenceManager</persistence-manager>
    <locking-policy>org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock</locking-policy>
    <container-cache-conf>
    <cache-policy>org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy</cache-policy>
    <cache-policy-conf>
    <min-capacity>50</min-capacity>
    <max-capacity>1000000</max-capacity>
    <overager-period>300</overager-period>
    <max-bean-age>600</max-bean-age>
    <resizer-period>400</resizer-period>
    <max-cache-miss-period>60</max-cache-miss-period>
    <min-cache-miss-period>1</min-cache-miss-period>
    <cache-load-factor>0.75</cache-load-factor>
    </cache-policy-conf>
    </container-cache-conf>
    <container-pool-conf>
    100
    </container-pool-conf>
    <commit-option>A</commit-option>
    </container-configuration>
    jboss.xml
    ======
    <?xml version="1.0"?>
    <security-domain>java:/jaas/defaultLdap</security-domain>
    <enterprise-beans>
    <ejb-name>ejb/ApplicationService</ejb-name>
    <security-domain>java:/jaas/defaultLdap</security-domain>
    <resource-ref>
    <res-ref-name>jdbc/OracleDS</res-ref-name>
    <jndi-name>java:/jdbc/OracleDS</jndi-name>
    </resource-ref>
    True
    <cluster-config>
    <home-load-balance-policy>
    org.jboss.ha.framework.interfaces.FirstAvailable
    </home-load-balance-policy>
    <bean-load-balance-policy>
    org.jboss.ha.framework.interfaces.FirstAvailable
    </bean-load-balance-policy>
    </cluster-config>
    <ejb-name>ejb/ApplicationEntity</ejb-name>
    <security-domain>java:/jaas/defaultLdap</security-domain>
    <resource-ref>
    <res-ref-name>jdbc/OracleDS</res-ref-name>
    <jndi-name>java:/jdbc/OracleDS</jndi-name>
    </resource-ref>
    <configuration-name>Standard BMP 2.x EntityBean with cache invalidation</configuration-name>
    <cache-invalidation>True</cache-invalidation>
    cache-invalidation.xml (No Change)
    ==============
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE server>
    <!-- $Id: cache-invalidation-service.xml,v 1.4 2003/08/27 04:31:54 patriot1burke Exp $ -->
    <!-- ===================================================================== -->
    <!-- -->
    <!-- Cache Invalidation Service -->
    <!-- -->
    <!-- ===================================================================== -->
    <!--
    Uncomment if you want to activate the cache invalidation mechanism accross
    nodes using the JMS bridge
    PropagationMode can be : IN_OUT = 1, IN_ONLY = 2, OUT_ONLY = 3
    You can also set the ProviderUrl attribute to another IP:port setting if you
    must lookup your JMS information in other JMS trees i.e.
    MyOtherNode:1099
    -->
    <!--
    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager
    <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager
    jboss.cache:service=InvalidationManager
    jboss.mq.destination:service=Topic,name=JMSCacheInvalidationBridge
    jboss.cache:service=InvalidationManager
    java:/ConnectionFactory
    topic/JMSCacheInvalidationBridge
    1
    -->
    Thanks.

    hi ,
    In this scenario u can use the load balancer instead of fail over clustering .
    I would suggest u to create apache proxy for redirect the request for many jboss instance.
    Rgds
    kathir

  • EJB Problem in JBoss

    Hi ,
    I am able to successfully deploy the .ear file in Jboss ..but when i try to call the Entity Bean ...i get the following Exception on JBoss Server Console :
    18:15:42,595 INFO [STDOUT] javax.ejb.CreateException: Error checking if entity exists:com.sybase.jdbc2.jdbc.SybSQLException: Incorrect syntax near 'WHERE'.
    This is giving me a lot of pain ..can anyone suggest me is something i am missing ?
    I would appreciate for Ur feedback .
    Thanks

    topic"virtual routing network emulation framework"http://www.google.com/search?q=virtual+routing+network+emulation+framework&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US:official

  • Yet Another EJB/JBoss/Datasource problem

    This is my first try at creating an ejb. I got that working, and now i'm trying to hook the ejb to a database via a datasource. I know I'm just doing something stupid and missing a tag or an xml file of a java: or whatever. If you can find this probem, I'll be completely in your debt forever.
    I've googled and searched this form to death.
    Here're the relevant parts:
    META-INF\ejb-ref.xml
          <session>
             <description><![CDATA[Stuff]]></description>
             <display-name>Stuff</display-name>
             <ejb-name>NrcrCore</ejb-name>
             <home>my.ejb.NrcrCoreHome</home>
             <remote>my.ejb.NrcrCore</remote>
             <ejb-class>my.ejb.NrcrCoreBean</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Container</transaction-type>
         <resource-ref>
              <res-ref-name>nrcrds</res-ref-name>
              <res-type>javax.sql.Datasource</res-type>
              <res-auth>Container</res-auth>
         </resource-ref>
          </session>META-INF\jboss.xml
    <jboss>
      <enterprise-beans>
        <session>
          <ejb-name>NrcrCore</ejb-name>
          <jndi-name>nrcr/NrcrCore</jndi-name>
           <resource-ref>
              <res-ref-name>nrcrds</res-ref-name>
              <jndi-name>java:nrcrds</jndi-name>
         </resource-ref>
        </session>
      </enterprise-beans>
    </jboss>deploy\nrcr-ds.xml
    <datasources>
      <local-tx-datasource>
        <jndi-name>nrcrds</jndi-name>
        <connection-url>jdbc:jtds:sqlserver://myserver/nrcr;domain=isledev</connection-url>
        <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
        <user-name>nrcr</user-name>
        <password>mypass</password>
      </local-tx-datasource>
    </datasources>And the code to connect:
                try{
                     ctx = new InitialContext();
                     if(ctx == null )
                          throw new Exception("No Context Found");
                     ds = (DataSource)ctx.lookup("java:nrcrds");
                catch(Exception e) {
                     System.out.println(e);
                }If you can make this work, I'll be your best friend.

    I think it would be better if u develop ejb by using
    weblogic Server and X-Doclet tags. Then u don't need
    to think about the xml files and their hectic tags.You don't need weblogic server to use x-doclet. It can be done even on jboss. The xml files can be automatically generated with some tool/plugin available with popular IDEs.

  • EJB problem (Seam 2.1.2 + WLS 10.3)

    Hi,
    I'm having some problems getting the EJB version of the booking example in Seam 2.1.2 working with WebLogic 10.3, and I'm hoping that someone here might have some advice. I followed the instructions in Chapter 39 of the Seam documentation for building the application on WebLogic 10.3 (http://docs.jboss.org/seam/2.1.2/reference/en-US/html/weblogic.html), worked through a few dependency issues, and got the application to the point where it deployed cleanly into WLS. When I go to http://localhost:7001/seam-booking, though, I get lots of exceptions, each of whose root cause is this:
    Caused by: javax.naming.NameNotFoundException: While trying to lookup 'jboss-seam-booking.EjbSynchronizations/local' didn't find subcontext 'jboss-seam-booking'. Resolved ''; remaining name 'jboss-seam-booking/EjbSynchronizations/local'
    at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
    at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)
    at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
    at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
    at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
    at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at org.jboss.seam.Component.instantiateSessionBean(Component.java:1400)
    at org.jboss.seam.Component.instantiate(Component.java:1364)
    at org.jboss.seam.Component.newInstance(Component.java:2122)
    ... 48 more
    On the "Deployments" tab of the admin console, I can expand the deployed EAR and see the packaged EJB jars inside of there, and they're identified as EJBs, but I don't see anything in the JNDI tree for that server.
    I am able to get beyond this error by commenting out the "<transaction:ejb-transaction/>" line in components.xml, which gets me to the booking application's home page in the browser, but trying to do anything else (log in, for example), hits the same kinds of error, just with different beans (like the AuthenticatorAction bean).
    Thanks in advance for any suggestions!
    Mark

    I worked out the solution to this one, and have documented it at http://seamframework.org/Community/Weblogic103SetupWithEjbBookingExample#comment106254 for future reference.

  • Mysql, Jboss connecting problem

    Hello,
    I am having problem with mysql database. I am trying to run AccountEJB application from SUN with mysql as my backend.
    PLEASE DO NOT FORGET I AM NOT EXPERT IN JBOSS OR EJB BUT I AM TRYING TO LEAN WITH A EXAMPLE.
    HERE IS MY SETUP UP TO THIS POINT.
    I am running jboss-3.03.0_tomcat-4.0.3
    I am including
    1. AccountBean
    2. ejb-jar.xml
    3. web.xml
    4. jboss.xml
    6. mysql-service.xml ( I add my database name, username, password and i copy it to ..server/default/deploy dir.)
    I only modified mysql-service.xml. Do i have to modify any other jboss files. Some people are saying i have to modify "standardjaws.xml, standardjbosscmp.xml"
    My AccountBean code is
    Please take a look at "setEntityContext" and "makeConnection" that is where problem comes.
    Here is the error
    10:43:19,950 INFO [Engine] AccountServlet: init
    10:43:19,950 INFO [STDOUT] AccountServlet: init()
    10:43:20,101 INFO [STDOUT] Got context
    10:43:20,311 INFO [STDOUT] Got referance
    10:43:20,371 INFO [STDOUT] Got referance to home object
    10:43:20,501 INFO [STDOUT] setEntityContext call....
    10:43:20,501 INFO [STDOUT] makeConnection call...
    10:43:20,501 INFO [STDOUT] Something went wrong within makeConnction call ....
    javax.naming.NameNotFoundException: MySqlDS not bound
    10:43:20,501 INFO [STDOUT] Came back from makeConnction call ...
    10:43:20,501 INFO [STDOUT] ejbCreate call
    10:43:20,501 INFO [STDOUT] insertRow call...
    10:43:20,511 ERROR [STDERR] Caught an exception.
    10:43:20,511 ERROR [STDERR] java.rmi.ServerException: ejbCreate: null; nested ex
    ception is:
    javax.ejb.EJBException: ejbCreate: null
    package com.ps.impl;
    import javax.ejb.EntityBean;
    import javax.ejb.EntityContext;
    import java.sql.*;
    import javax.sql.*;
    import javax.ejb.*;
    import javax.naming.*;
    import java.util.*;
    import java.rmi.*;
    public class AccountBean implements EntityBean
    private EntityContext context;
    private String id;
    private String firstName;
    private String lastName;
    private double balance;
    private Connection con;
    //private String dbName = "java:/MySqlDS";
    public void debit (double amount)
    if (balance - amount < 0)
    else
    balance = balance - amount;
    public void credit (double amount)
    balance = balance + amount;
    public String getFirstName()
    return firstName;
    public String getLastName()
    return lastName;
    public double getBalance()
    return balance;
    public String ejbCreate(String id, String firstName, String lastName, double balance)
    throws CreateException
    System.out.println("ejbCreate call");
    if (balance < 0.00) {
    throw new CreateException
    ("A negative initial balance is not allowed.");
    try {
    insertRow(id, firstName, lastName, balance);
    } catch (Exception ex) {
    throw new EJBException("ejbCreate: " +
    ex.getMessage());
    this.id = id;
    this.firstName = firstName;
    this.lastName = lastName;
    this.balance = balance;
    return id;
    public void ejbPostCreate(String id, String firstname, String lastname, double blance)
    public String ejbFindByPrimaryKey(String primaryKey)
    throws FinderException
    System.out.println("ejbFindPrimaryKey call...");
    boolean result;
    try {
    result = selectByPrimaryKey(primaryKey);
    } catch (Exception ex) {
    throw new EJBException("ejbFindByPrimaryKey: " +
    ex.getMessage());
    if (result) {
    return primaryKey;
    else {
    throw new ObjectNotFoundException
    ("Row for id " + primaryKey + " not found.");
    public Collection ejbFindByLastName(String lastName)
    throws FinderException
    System.out.println("ejbFindByLastName call...");
    Collection result;
    try {
    result = selectByLastName(lastName);
    } catch (Exception ex) {
    throw new EJBException("ejbFindByLastName " +
    ex.getMessage());
    if (result.isEmpty()) {
    throw new ObjectNotFoundException("No rows found.");
    else {
    return result;
    public Collection ejbFindInRange(double low, double high)
    throws FinderException
    System.out.println("ejbFindRange call ....");
    Collection result;
    try {
    result = selectInRange(low, high);
    } catch (Exception ex) {
    throw new EJBException("ejbFindInRange: " +
    ex.getMessage());
    if (result.isEmpty()) {
    throw new ObjectNotFoundException("No rows found.");
    else {
    return result;
    public void ejbActivate()
    System.out.println("ejbActivate call ...");
    id = (String)context.getPrimaryKey();
    public void ejbLoad()
    System.out.println("ejbLoad call ...");
    try {
    loadRow();
    } catch (Exception ex) {
    throw new EJBException("ejbLoad: " +
    ex.getMessage());
    public void ejbPassivate()
    id = null;
    public void ejbRemove()
    System.out.println("ebjRemove call ...");
    try {
    deleteRow(id);
    } catch (Exception ex) {
    throw new EJBException("ejbRemove: " +
    ex.getMessage());
    public void ejbStore()
    System.out.println("ejbStore call ...");
    try {
    storeRow();
    } catch (Exception ex) {
    throw new EJBException("ejbLoad: " +
    ex.getMessage());
    public void setEntityContext(EntityContext context)
    this.context = context;
    System.out.println("setEntityContext call....");
    try {
    makeConnection();
    System.out.println("Came back from makeConnction call ...");
    } catch (Exception ex) {
    throw new EJBException("Unable to connect to database " +
    ex.getMessage());
    public void unsetEntityContext()
    System.out.println("unsetEntityContext call ...");
    try {
    con.close();
    } catch (SQLException ex) {
    throw new EJBException("unsetEntityContext: " + ex.getMessage());
    /*********************** Database Routines *************************/
    private void makeConnection() throws NamingException, SQLException
    System.out.println("makeConnection call...");
    try
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource) ic.lookup("java:/MySqlDS");
    con = ds.getConnection();
    catch (Exception ex)
    System.out.println("Something went wrong within makeConnction call .... " + ex);
    private void insertRow (String id, String firstName, String lastName,
    double balance) throws SQLException {
    System.out.println("insertRow call...");
    String insertStatement =
    "insert into account values ( ? , ? , ? , ? )";
    PreparedStatement prepStmt =
    con.prepareStatement(insertStatement);
    prepStmt.setString(1, id);
    prepStmt.setString(2, firstName);
    prepStmt.setString(3, lastName);
    prepStmt.setDouble(4, balance);
    prepStmt.executeUpdate();
    prepStmt.close();
    private void deleteRow(String id) throws SQLException {
    System.out.println("deleteRow call ...");
    String deleteStatement =
    "delete from account where id = ? ";
    PreparedStatement prepStmt =
    con.prepareStatement(deleteStatement);
    prepStmt.setString(1, id);
    prepStmt.executeUpdate();
    prepStmt.close();
    private boolean selectByPrimaryKey(String primaryKey)
    throws SQLException {
    System.out.println("selectByPrimaryKey call...");
    String selectStatement =
    "select id " +
    "from account where id = ? ";
    PreparedStatement prepStmt =
    con.prepareStatement(selectStatement);
    prepStmt.setString(1, primaryKey);
    ResultSet rs = prepStmt.executeQuery();
    boolean result = rs.next();
    prepStmt.close();
    return result;
    private Collection selectByLastName(String lastName)
    throws SQLException {
    System.out.println("selectByLastName call...");
    String selectStatement =
    "select id " +
    "from account where lastname = ? ";
    PreparedStatement prepStmt =
    con.prepareStatement(selectStatement);
    prepStmt.setString(1, lastName);
    ResultSet rs = prepStmt.executeQuery();
    ArrayList a = new ArrayList();
    while (rs.next()) {
    String id = rs.getString(1);
    a.add(id);
    prepStmt.close();
    return a;
    private Collection selectInRange(double low, double high)
    throws SQLException {
    System.out.println("selectInRange call ....");
    String selectStatement =
    "select id from account " +
    "where balance between ? and ?";
    PreparedStatement prepStmt =
    con.prepareStatement(selectStatement);
    prepStmt.setDouble(1, low);
    prepStmt.setDouble(2, high);
    ResultSet rs = prepStmt.executeQuery();
    ArrayList a = new ArrayList();
    while (rs.next()) {
    String id = rs.getString(1);
    a.add(id);
    prepStmt.close();
    return a;
    private void loadRow() throws SQLException {
    System.out.println("loadRow call ....");
    String selectStatement =
    "select firstname, lastname, balance " +
    "from account where id = ? ";
    PreparedStatement prepStmt =
    con.prepareStatement(selectStatement);
    prepStmt.setString(1, this.id);
    ResultSet rs = prepStmt.executeQuery();
    if (rs.next()) {
    this.firstName = rs.getString(1);
    this.lastName = rs.getString(2);
    this.balance = rs.getDouble(3);
    prepStmt.close();
    else {
    prepStmt.close();
    throw new NoSuchEntityException("Row for id " + id +
    " not found in database.");
    private void storeRow() throws SQLException {
    System.out.println("storeRow call ...");
    String updateStatement =
    "update account set firstname = ? ," +
    "lastname = ? , balance = ? " +
    "where id = ?";
    PreparedStatement prepStmt =
    con.prepareStatement(updateStatement);
    prepStmt.setString(1, firstName);
    prepStmt.setString(2, lastName);
    prepStmt.setDouble(3, balance);
    prepStmt.setString(4, id);
    int rowCount = prepStmt.executeUpdate();
    prepStmt.close();
    if (rowCount == 0) {
    throw new EJBException("Storing row for id " + id + " failed.");
    2. ejb-jar.xml
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    <enterprise-beans>
    <entity>
    <description>Entity Bean ( BMP )</description>
    <display-name>Account</display-name>
    <ejb-name>Account</ejb-name>
    <home>com.ps.AccountHome</home>
    <remote>com.ps.Account</remote>
    <ejb-class>com.ps.impl.AccountBean</ejb-class>
    <persistence-type>Bean</persistence-type>
    <prim-key-class>java.lang.String</prim-key-class>
    <reentrant>False</reentrant>
    </entity>
    </enterprise-beans>
    </ejb-jar>
    3. web.xml
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <description>Empty web.xml file for Web Application</description>
    <servlet>
    <servlet-name>AccountServlet</servlet-name>
    <servlet-class>com.ps.AccountServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>AccountServlet</servlet-name>
    <url-pattern>/accountservlet</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    </web-app>
    4. jboss.xml (i am not sure this is righ maybe this is the problem)
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">
    <jboss>
    <resource-managers>
    <resource-manager res-class="">
    <res-name>MySqlDS</res-name>
    <res-jndi-name>java:/MySqlDS</res-jndi-name>
    </resource-manager>
    </resource-managers>
    </jboss>
    5. mysql-service.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- ===================================================================== -->
    <!-- -->
    <!-- JBoss Server Configuration -->
    <!-- -->
    <!-- ===================================================================== -->
    <server>
    <!-- ==================================================================== -->
    <!-- New ConnectionManager setup for mysql using 2.0.11 driver -->
    <!-- Build jmx-api (build/build.sh all) and view for config documentation -->
    <!-- ==================================================================== -->
    <mbean code="org.jboss.resource.connectionmanager.LocalTxConnectionManager" name="jboss.jca:service=LocalTxCM,name=MySqlDS">
    <!-- Include a login module configuration named MySqlDbRealm.
    Update your login-conf.xml, here is an example for a
    ConfiguredIdentityLoginModule:
    <application-policy name = "MySqlDbRealm">
    <authentication>
    <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
    <module-option name = "principal">yourprincipal</module-option>
    <module-option name = "userName">yourusername</module-option>
    <module-option name = "password">yourpassword</module-option>
    <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=MySqlDS</module-option>
    </login-module>
    </authentication>
    </application-policy>
    NOTE: the application-policy name attribute must match SecurityDomainJndiName, and the
    module-option name = "managedConnectionFactoryName"
    must match the object name of the ConnectionManager you are configuring here.
    -->
    <!--uncomment out this line if you are using the MySqlDbRealm above
    <attribute name="SecurityDomainJndiName">MySqlDbRealm</attribute>
    -->
    <depends optional-attribute-name="ManagedConnectionFactoryName">
    <!--embedded mbean-->
    <mbean code="org.jboss.resource.connectionmanager.RARDeployment" name="jboss.jca:service=LocalTxDS,name=MySqlDS">
    <attribute name="JndiName">MySqlDS</attribute>
    <attribute name="ManagedConnectionFactoryProperties">
    <properties>
    <config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://localhost:3306/pac</config-property>
    <config-property name="DriverClass" type="java.lang.String">org.gjt.mm.mysql.Driver</config-property>
    <!--set these only if you want only default logins, not through JAAS -->
    <config-property name="UserName" type="java.lang.String">t100</config-property>
    <config-property name="Password" type="java.lang.String">t200</config-property>
    </properties>
    </attribute>
    <!--Below here are advanced properties -->
    <!--hack-->
    <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper</depends>
    </mbean>
    </depends>
    <depends optional-attribute-name="ManagedConnectionPool">
    <!--embedded mbean-->
    <mbean code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool" name="jboss.jca:service=LocalTxPool,name=MySqlDS">
    <attribute name="MinSize">0</attribute>
    <attribute name="MaxSize">50</attribute>
    <attribute name="BlockingTimeoutMillis">5000</attribute>
    <attribute name="IdleTimeoutMinutes">15</attribute>
    <!--criteria indicates if Subject (from security domain) or app supplied
    parameters (such as from getConnection(user, pw)) are used to distinguish
    connections in the pool. Choices are
    ByContainerAndApplication (use both),
    ByContainer (use Subject),
    ByApplication (use app supplied params only),
    ByNothing (all connections are equivalent, usually if adapter supports
    reauthentication)-->
    <attribute name="Criteria">ByContainer</attribute>
    </mbean>
    </depends>
    <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager</depends>
    <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:name=JaasSecurityManager</depends>
    <attribute name="TransactionManager">java:/TransactionManager</attribute>
    <!--make the rar deploy! hack till better deployment-->
    <depends>jboss.jca:service=RARDeployer</depends>
    </mbean>
    </server>

    In /JBoss/server/default/conf/standardjaws.xml.
    Set
    <datasource>java:/mySqlDS</datasource>
    <type-mapping>mySql</type-mapping>
    In /JBoss/server/default/conf/standardjbosscmp-jdbc.xml.
    Set
    <defaults>
    <datasource>java:/mySqlDS</datasource>
    <datasource-mapping>mySql</datasource-mapping></defaults>

  • EJB problem with home interface

    Hi firends
    I am beginner to EJB world, and trying first EJB object i.e. Hello World program
    I prepared first Remote interface, HelloBean and it compiled also properly.
    names of program
    Remote interface : Hello
    Bean: HelloBean
    Home interface : HelloHome
    But after preparing Home interface it fails to compile at position of create()
    the declaration is
    public Hello create() throws RemoteException,CreateException
    compilation error pointing at Hello in above statement saying 'Cannot resolve symbol'
    The fact is all these files are located in same directory only
    can anyone help me in this problem as I am eger to execute my first program and want to go further in EJB
    thanx in advance
    Mandar

    Hi Mandar,
    How are you setting the classpath and what exactly is it set to?
    Unresolved symbol can only mean that the class cannot be found in the classpath. If two files are in the same directory and one has a dependency on the other then adding '.' to the classpath is all that is needed. Questions to ask yourself. Are the files in the same directory? does either include a 'package' statement? and are you absolutely certain that the classpath is set correctly (type 'set' at the command line)? Also if you have set the CLASSPATH variable, using -classpath with the javac command will override the variable.
    Check everything above and if you still have problems maybe we can get some more details if you can post the entire error message.
    Mandy

  • Loading EJB problem with deployejb !

    I am working with Oracle 8.1.5 and jdk 1.1.6,
    when I am running the deployejb tool with the HelloWorld example of the demo directory, I have a problem when loadind EJB files into the database:
    deployejb -v -u workuser ...
    done
    Compiling Stubs...done
    Generating Jar File...done
    Loading EJB Jar file adn Comm Stubs Jar file...loading: helloServer/HelloBean
    ORA-01552: cannot use system rollback segment for non-system tablespace USERS
    SQL Error in loading : helloServer/HelloBean
    ORA-06502: PL/SQL : numeric or value error
    ORA-06512: at "SYS.DBMS_LOB", line 700
    ORA-06512: at "WORKUSER.LOADLOBS", line 1
    ORA-06512: at line 1
    ... [same problem with all objects]
    Can you HELP me ?

    Hard to say, looks like a database configuration problem. Check with your DBA...
    Matthieu

  • Ejb problem,

    I had a problem in a previous post which i solved. I am trying to create the hellBoean from Mastering EJBs. I am packaging it with the sun application server. When I run the appclient I get the following. seems like its looking for a main class in my bean? I dont get it?
    Mar 11, 2005 8:57:54 PM com.sun.enterprise.util.Utility invokeApplicationMain
    SEVERE: UTIL6027:Exception in invokeApplicationMain [{0}].
    java.lang.NoSuchMethodException: examples.HelloBean.main([Ljava.lang.String;)
            at java.lang.Class.getMethod(Class.java:986)
            at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:207)
            at com.sun.enterprise.appclient.Main.<init>(Main.java:425)
            at com.sun.enterprise.appclient.Main.main(Main.java:97)
    Mar 11, 2005 8:57:54 PM com.sun.enterprise.appclient.Main <init>
    WARNING: ACC003: Application threw an exception.
    java.lang.ClassNotFoundException: No main method in class: class examples.HelloBean
            at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:211)
            at com.sun.enterprise.appclient.Main.<init>(Main.java:425)
            at com.sun.enterprise.appclient.Main.main(Main.java:97)

    i read the help on the deploytool with making application client. I am supposed to pick a main class. I think this is causing an error. none of my ejb classes have a main???

  • WLS6.1sp1 stateful EJB problem =   load-balancing and fail over

              I have three problem
              1. I have 2 clustered server. my weblogic-ejb-jar.xml is here
              <?xml version="1.0"?>
              <!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB//EN'
              'http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd'>
              <weblogic-ejb-jar>
              <weblogic-enterprise-bean>
                   <ejb-name>DBStatefulEJB</ejb-name>
                   <stateful-session-descriptor>
                   <stateful-session-cache>
                        <max-beans-in-cache>100</max-beans-in-cache>
                        <idle-timeout-seconds>120</idle-timeout-seconds>
                   </stateful-session-cache>
                   <stateful-session-clustering>
                        <home-is-clusterable>true</home-is-clusterable>
                        <home-load-algorithm>RoundRobin</home-load-algorithm>
                        <home-call-router-class-name>common.QARouter</home-call-router-class-name>
                        <replication-type>InMemory</replication-type>
                   </stateful-session-clustering>
                   </stateful-session-descriptor>
                   <jndi-name>com.daou.EJBS.solutions.DBStatefulBean</jndi-name>
              </weblogic-enterprise-bean>
              </weblogic-ejb-jar>
              when i use "<home-call-router-class-name>common.QARouter</home-call-router-class-name>"
              and deploy this ejb, exception cause
              <Warning> <Dispatcher> <RuntimeException thrown b
              y rmi server: 'weblogic.rmi.cluster.ReplicaAwareServerRef@9 - jvmid: '2903098842
              594628659S:203.231.15.167:[5001,5001,5002,5002,5001,5002,-1]:mydomain:cluster1',
              oid: '9', implementation: 'weblogic.jndi.internal.RootNamingNode@5f39bc''
              java.lang.IllegalArgumentException: Failed to instantiate weblogic.rmi.cluster.B
              asicReplicaHandler due to java.lang.reflect.InvocationTargetException
              at weblogic.rmi.cluster.ReplicaAwareInfo.instantiate(ReplicaAwareInfo.ja
              va:185)
              at weblogic.rmi.cluster.ReplicaAwareInfo.getReplicaHandler(ReplicaAwareI
              nfo.java:105)
              at weblogic.rmi.cluster.ReplicaAwareRemoteRef.initialize(ReplicaAwareRem
              oteRef.java:79)
              at weblogic.rmi.cluster.ClusterableRemoteRef.initialize(ClusterableRemot
              eRef.java:28)
              at weblogic.rmi.cluster.ClusterableRemoteObject.initializeRef(Clusterabl
              eRemoteObject.java:255)
              at weblogic.rmi.cluster.ClusterableRemoteObject.onBind(ClusterableRemote
              Object.java:149)
              at weblogic.jndi.internal.BasicNamingNode.rebindHere(BasicNamingNode.jav
              a:392)
              at weblogic.jndi.internal.ServerNamingNode.rebindHere(ServerNamingNode.j
              ava:142)
              at weblogic.jndi.internal.BasicNamingNode.rebind(BasicNamingNode.java:36
              2)
              at weblogic.jndi.internal.BasicNamingNode.rebind(BasicNamingNode.java:36
              9)
              at weblogic.jndi.internal.BasicNamingNode.rebind(BasicNamingNode.java:36
              9)
              at weblogic.jndi.internal.BasicNamingNode.rebind(BasicNamingNode.java:36
              9)
              at weblogic.jndi.internal.BasicNamingNode.rebind(BasicNamingNode.java:36
              9)
              at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
              at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:296)
              So do i must use it or not???
              2. When i don't use "<home-call-router-class-name>common.QARouter</home-call-router-class-name>"
              , there's no exception
              but load balancing does not happen. According to the document , there's must load
              balancing when i call home.create() method.
              my client program goes here
                   DBStateful the_ejb1 = (DBStateful) PortableRemoteObject.narrow(home.create(),
              DBStateful.class);
                   DBStateful the_ejb2 = (DBStateful) PortableRemoteObject.narrow(home.create(3),
              DBStateful.class);
              the result is like that
                   the_ejb1 = ClusterableRemoteRef(203.231.15.167 weblogic.rmi.cluster.PrimarySecon
                   daryReplicaHandler@4695a6)/397
                   the_ejb2 = ClusterableRemoteRef(203.231.15.167 weblogic.rmi.cluster.PrimarySecon
                   daryReplicaHandler@acf6e)/398
                   or
                   the_ejb1 = ClusterableRemoteRef(203.231.15.125 weblogic.rmi.cluster.PrimarySecon
                   daryReplicaHandler@252fdf)/380
                   the_ejb2 = ClusterableRemoteRef(203.231.15.125 weblogic.rmi.cluster.PrimarySecon
                   daryReplicaHandler@6a0252)/381
                   I think the result should be like under one... isn't it??
                   the_ejb1 = ClusterableRemoteRef(203.231.15.167 weblogic.rmi.cluster.PrimarySecon
                   daryReplicaHandler@4695a6)/397
                   the_ejb2 = ClusterableRemoteRef(203.231.15.125 weblogic.rmi.cluster.PrimarySecon
                   daryReplicaHandler@6a0252)/381
              In this case i think the_ejb1 and the_ejb2 must have instance in different cluster
              server
              but they go to one server .
              3. If i don't use      "<home-call-router-class-name>common.QARouter</home-call-router-class-name>",
              "<replication-type>InMemory</replication-type>" then load balancing happen but
              there's no fail-over
              So how can i get load-balancing and fail over together??
              

              I have three problem
              1. I have 2 clustered server. my weblogic-ejb-jar.xml is here
              <?xml version="1.0"?>
              <!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB//EN'
              'http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd'>
              <weblogic-ejb-jar>
              <weblogic-enterprise-bean>
                   <ejb-name>DBStatefulEJB</ejb-name>
                   <stateful-session-descriptor>
                   <stateful-session-cache>
                        <max-beans-in-cache>100</max-beans-in-cache>
                        <idle-timeout-seconds>120</idle-timeout-seconds>
                   </stateful-session-cache>
                   <stateful-session-clustering>
                        <home-is-clusterable>true</home-is-clusterable>
                        <home-load-algorithm>RoundRobin</home-load-algorithm>
                        <home-call-router-class-name>common.QARouter</home-call-router-class-name>
                        <replication-type>InMemory</replication-type>
                   </stateful-session-clustering>
                   </stateful-session-descriptor>
                   <jndi-name>com.daou.EJBS.solutions.DBStatefulBean</jndi-name>
              </weblogic-enterprise-bean>
              </weblogic-ejb-jar>
              when i use "<home-call-router-class-name>common.QARouter</home-call-router-class-name>"
              and deploy this ejb, exception cause
              <Warning> <Dispatcher> <RuntimeException thrown b
              y rmi server: 'weblogic.rmi.cluster.ReplicaAwareServerRef@9 - jvmid: '2903098842
              594628659S:203.231.15.167:[5001,5001,5002,5002,5001,5002,-1]:mydomain:cluster1',
              oid: '9', implementation: 'weblogic.jndi.internal.RootNamingNode@5f39bc''
              java.lang.IllegalArgumentException: Failed to instantiate weblogic.rmi.cluster.B
              asicReplicaHandler due to java.lang.reflect.InvocationTargetException
              at weblogic.rmi.cluster.ReplicaAwareInfo.instantiate(ReplicaAwareInfo.ja
              va:185)
              at weblogic.rmi.cluster.ReplicaAwareInfo.getReplicaHandler(ReplicaAwareI
              nfo.java:105)
              at weblogic.rmi.cluster.ReplicaAwareRemoteRef.initialize(ReplicaAwareRem
              oteRef.java:79)
              at weblogic.rmi.cluster.ClusterableRemoteRef.initialize(ClusterableRemot
              eRef.java:28)
              at weblogic.rmi.cluster.ClusterableRemoteObject.initializeRef(Clusterabl
              eRemoteObject.java:255)
              at weblogic.rmi.cluster.ClusterableRemoteObject.onBind(ClusterableRemote
              Object.java:149)
              at weblogic.jndi.internal.BasicNamingNode.rebindHere(BasicNamingNode.jav
              a:392)
              at weblogic.jndi.internal.ServerNamingNode.rebindHere(ServerNamingNode.j
              ava:142)
              at weblogic.jndi.internal.BasicNamingNode.rebind(BasicNamingNode.java:36
              2)
              at weblogic.jndi.internal.BasicNamingNode.rebind(BasicNamingNode.java:36
              9)
              at weblogic.jndi.internal.BasicNamingNode.rebind(BasicNamingNode.java:36
              9)
              at weblogic.jndi.internal.BasicNamingNode.rebind(BasicNamingNode.java:36
              9)
              at weblogic.jndi.internal.BasicNamingNode.rebind(BasicNamingNode.java:36
              9)
              at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
              at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:296)
              So do i must use it or not???
              2. When i don't use "<home-call-router-class-name>common.QARouter</home-call-router-class-name>"
              , there's no exception
              but load balancing does not happen. According to the document , there's must load
              balancing when i call home.create() method.
              my client program goes here
                   DBStateful the_ejb1 = (DBStateful) PortableRemoteObject.narrow(home.create(),
              DBStateful.class);
                   DBStateful the_ejb2 = (DBStateful) PortableRemoteObject.narrow(home.create(3),
              DBStateful.class);
              the result is like that
                   the_ejb1 = ClusterableRemoteRef(203.231.15.167 weblogic.rmi.cluster.PrimarySecon
                   daryReplicaHandler@4695a6)/397
                   the_ejb2 = ClusterableRemoteRef(203.231.15.167 weblogic.rmi.cluster.PrimarySecon
                   daryReplicaHandler@acf6e)/398
                   or
                   the_ejb1 = ClusterableRemoteRef(203.231.15.125 weblogic.rmi.cluster.PrimarySecon
                   daryReplicaHandler@252fdf)/380
                   the_ejb2 = ClusterableRemoteRef(203.231.15.125 weblogic.rmi.cluster.PrimarySecon
                   daryReplicaHandler@6a0252)/381
                   I think the result should be like under one... isn't it??
                   the_ejb1 = ClusterableRemoteRef(203.231.15.167 weblogic.rmi.cluster.PrimarySecon
                   daryReplicaHandler@4695a6)/397
                   the_ejb2 = ClusterableRemoteRef(203.231.15.125 weblogic.rmi.cluster.PrimarySecon
                   daryReplicaHandler@6a0252)/381
              In this case i think the_ejb1 and the_ejb2 must have instance in different cluster
              server
              but they go to one server .
              3. If i don't use      "<home-call-router-class-name>common.QARouter</home-call-router-class-name>",
              "<replication-type>InMemory</replication-type>" then load balancing happen but
              there's no fail-over
              So how can i get load-balancing and fail over together??
              

  • Sun One EJB problem - PortableRemoteObject.narrow ClassCastException...

    Hi all,
    I'm using Sun One app server 7 for the first time and am having a bit of difficulty. I have deployed a very simple EAR containing one stateless session bean just to test it. The ear appears to have deployed correctly but PortableRemoteObject.narrow is throwing a ClassCastException when trying to do a remote lookup on the bean.
    I'm using the following env settings...
    initialContextFactory = com.sun.enterprise.naming.SerialInitContextFactory
    providerUrl = iiop://127.0.0.1:3700The lookup appears to work okay - this line of code executes successfully
    Object objref = initialContext.lookup(jndiHomeName);...objref appears to initalise succesfully (if I toString() it I get an iiop stream of some sort). However, it is the next line that is failing...
    Object obj = PortableRemoteObject.narrow(objref, homeClass);...this is the exception I get...
    java.lang.ClassCastException
         at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(Unknown Source)
         at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
         at com.scorlog.ServiceLocator.getRemoteHome(ServiceLocator.java:145)Furthermore, when PortableRemoteObject.narrow() executes, I get the following console exception on the server...
    com.sun.corba.ee.internal.core.DuplicateServiceContext
            at com.sun.corba.ee.internal.core.ServiceContexts.put(ServiceContexts.java:208)
            at com.sun.corba.ee.internal.iiop.ServerRequestImpl.getServiceContextsForReply(ServerRequestImpl.java:258)
            at com.sun.corba.ee.internal.iiop.ServerRequestImpl.createResponse(ServerRequestImpl.java:89)
            at com.sun.corba.ee.internal.POA.SubcontractResponseHandler.createReply(SubcontractResponseHandler.java:50)
            at org.omg.CosNaming.NamingContextExtPOA._invoke(NamingContextExtPOA.java:377)
            at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(GenericPOAServerSC.java:569)
            at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(GenericPOAServerSC.java:211)
            at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAServerSC.java:113)
            at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:275)
            at com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProcessor.java:83)
            at com.iplanet.ias.corba.ee.internal.iiop.ServicableWrapper.service(ServicableWrapper.java:25)
            at com.iplanet.ias.util.threadpool.FastThreadPool$ThreadPoolThread.run(FastThreadPool.java:288)
            at java.lang.Thread.run(Thread.java:534)
    FINE: No SAS context element found in service context listI have seen the forum that other users have had similar problems and the suggestion was that the client can't see the ejb stubs. I don't think this is the problem in my case as I deployed the same ear on weblogic 7 (obviously substituting sun-ejb-jar.xml for a weblogic-ejb-jar.xml) and successfully executed the same client code for the remote lookup.
    My feeling is that the problem revolves around the JNDI binding. Could it be the case that even though the object is binding properly, the app server doesn't realise it is an ejb and not a jdbc/jms/mail object? The documentation gives details on looking up a JDBC, javamail, URL, JMS resource (http://docs.sun.com/source/817-2177/djjndi.html) but not ejb so I could be doing something simple wrong here...
    My sun-ejb-jar.xml is as follows....
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Generated by XDoclet -->
    <sun-ejb-jar>
        <enterprise-beans>
            <ejb>
                <ejb-name>SBTest</ejb-name>
                <jndi-name>ejb/SBTestBean</jndi-name>
            </ejb>
        </enterprise-beans>
    </sun-ejb-jar>However, I noticed on another thread, a user had some additional elements under their <ejb> tag like this...
    <?xml version="1.0" encoding="UTF-8"?>
    <sun-ejb-jar>
      <enterprise-beans>
        <name>Ejb1</name>
        <ejb>
          <ejb-name>HelloBean</ejb-name>
          <jndi-name>HelloBean</jndi-name>
          <ejb-ref>
            <ejb-ref-name>ejb/helloBean</ejb-ref-name>
            <jndi-name>HelloBean</jndi-name>
          </ejb-ref>
        </ejb>
      </enterprise-beans>
    </sun-ejb-jar>However, when I tried to add and <ejb-ref> element to my xml doc the ear failed to deploy. This is the error I get in the admin console...
    Error
    Deployment Error -- Error while running ejbc -- Fatal Error from EJB Compiler -- --
    Failed to load deployment descriptor for: testApp cause: Error converting J2EE-
    specific ejb xml to object representation: testApp.jar app_testApp Generated by
    XDoclet This bean has no ejb reference by the name of [ejb/SBtest]
    ejb/SBTestSBTestThis problem is eating up my time and being made all the more frustrating by the fact that a) it deploys on weblogic and b) the documentation is terrible. Even the sample application that comes with sun one only provides the .class files for the code that does the ejb look up and not the .java so you can't see how they hell they do it!
    Unfortunately I am tied to using Sun One so I really need to solve this problem fast. If anyone can provide any help I'd greatly appreciate it.
    Cheers,
    John :)

    I am having the same problem after upgrading to Sun One from iplanet. Any clue?

  • RMI of EJB Problem Sun Application Server 8

    I have an application that tries to invoke a remote ejb. If the client is on the same box as the ejb then everything works as expected. If the client makes the call from a different application server, then the errors listed below are generated CONTINIOUSLY UNTIL THE CLIENT APP SERVER IS STOPPED.
    Although I specify a hostname and port of the desired server, the error in the server log displays the hostname as localhost (which is incorrect, with the correct port) :
    locahhost:hostname: 127.0.0.1; port: 33702.
    I know that client is communicating with the app server where the ejb reside because the other log messages show the other iiop ports of the ejb app server:
    Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.0.1; port: 33702"
    Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.0.1; port: 33822"
    Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.0.1; port: 33922"
    I use the following code to point the remote server:port:
    env.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
    env.put("java.naming.provider.url", urlString);
    The value of the urlString is extracted from a properties file and
    contains the server and the port information.
    GENERATED ERRORS:
    [#|2007-02-15T12:22:53.995-0500|WARNING|sun-appserver-pe8.2|javax.enterprise.resource.corba.ee._DEFAULT_.rpc.transport|_ThreadID=11;|"IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.0.1; port: 33702"
    org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
    at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2257)
    at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2278)
    at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:208)
    at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:221)
    at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:104)
    at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:152)
    at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:146)
    at org.omg.CORBA.portable.ObjectImpl._request(ObjectImpl.java:431)
    at org.omg.CosNaming._NamingContextExtStub.resolve(_NamingContextExtStub.java:397)
    at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:440)
    at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:492)
    at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:470)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at cyberCash.VerisignDriver.lookupRemoteVerisignAgentBean(VerisignDriver.java:779)
    at cyberCash.VerisignDriver.createVerisignRemote(VerisignDriver.java:609)
    at cyberCash.VerisignDriver.getVerisignRemote(VerisignDriver.java:579)
    at cyberCash.VerisignDriver.SaveInput(VerisignDriver.java:232)
    at org.apache.jsp.jsp.ePayment.verisignresults_jsp._jspService(verisignresults_jsp.java:143)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:297)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:247)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
    at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
    at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
    at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:189)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doProcess(ProcessorTask.java:604)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:475)
    at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:371)
    at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:264)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:281)
    at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:83)
    Caused by: java.net.ConnectException: Connection refused: connect
    at sun.nio.ch.Net.connect(Native Method)
    at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:464)
    at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
    at com.sun.corba.ee.impl.transport.DefaultSocketFactoryImpl.createSocket(DefaultSocketFactoryImpl.java:63)
    at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:191)
    ... 52 more
    |#]

    hi
    I am working with Sun java application Server 8.
    I can able to create application(*.ear),
    (Enterprise Java Bean) bean component,
    client application
    Problem is, i am unable to provide JNDI name for client application
    advice needed to provide JNDI name for the client applications
    i dont know whats the use of pointbase/cloudscape
    (As i am new to this sjaServer 8, i need your advice)
    Response to the following mail id
    [email protected]
    Please do the favour
    thank you

  • JBoss install problem - nothing is installed

    Hello,
    I have installed aur/jboss package
    aur/jboss 5.1.0.GA-1 [installed] (53)
    JBoss Application Server
    But there is no /opt/jboss directory, no service added, nothing. When I try to uninstall it, it says:
    Packages (1): jboss-5.1.0.GA-1
    Total Removed Size: 0,00 MiB
    zip file with jboss is installed correctly, all additional files (build, service..) are too.
    What is the problem with this process ?

    Moving to AUR Issues...

  • JBOSS deployment problem

    I get a classNotFound in my ejb session class when calling web application class.
    The following is my structures:
    +harvester.ear
    ---ejb.harvester.jar
    --------Session.class
    --------Object.class
    --------Home.class
    --------Manifest.mf ****
    --------ejb-jar.xml
    --------jboss.xml
    ---Manifest.mf
    ---harvester.war
    --------WEB-INF/lib/harvester.jar
    ---application.xml
    In the Manifest.mf file labeled with *** I have the following entry:
    Class-Path: WEB-INF/lib/harvester.jar
    So from my Session.class I try to call a class located in harvester.jar. I deploy the application and I get an ClassNotFoundException in the Session.class when trying to call a class in harvester.jar
    Did I specify an incorrect class-path in the manifest? ...
    Thanks

    I would package your app this way:
    +harvester.ear
    ---lib/harvester.jar
    ---ejb.harvester.jar
    ---harvester.war
    in this case no entry in manifest is required...
    --lukas                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • Web service data source - Entry 70 still missing

    Hello, I have created a web service data source in order to create a push mechanism for master data. Before implementing and consuming it in R/3 side, I have tested the generated function module of the data source. I have created a real time (and pus

  • Run a program with system exec.vi

    hi I've got a problem with system exec. When I launch a simple program like :  c:\windows\notepad.exe it works very well. But when I launch a program with parameters, it doesn't. here is the command line:   c:\bmd.exe a.bmd a.txt ffffffff ffffffff  

  • Last servlet in request pipeline

    Hi All , What is the last  servlet in the request pipeline?  Because I have a requirement to redirect to some other page based on our business logic. Thanks in advance.

  • Frames in Dreamweaver

    Hello Everyone, I am planning to use frames for my website. I have some problems with saving them. For example, lets say I create a new page and save it as "index.html". I then add a frame, so there are now two parts to the page: the top and the bott

  • SpeedGrade minimum CPU requirement

    Hello, Will SpeedGrade function with previous generation intel CPUs such as Intel Core2 Duo E8400 / Quad Q9650 running at 3GHz? Thanx.../John