Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
JSP - A mailing list about Java Server Pages specification and reference
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
Changes for

Changes for

2007-06-11       - By mahtab.singh

 Back
Hi,

I am also getting somewhat simillar error:

the error stack is below:

java.lang.RuntimeException Source code of java.lang.RuntimeException: Could not resolve beanClass method from proxy call
  at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke
(StatelessContainer.java:199)
  at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
  at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke
(AOPRemotingInvocationHandler.java:82)
  at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
  at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
  at org.jboss.remoting.transport.socket.ServerThread.processInvocation
(ServerThread.java:358)
  at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java
:412)
  at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
  at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:190)
  at org.jboss.remoting.Client.invoke(Client.java:525)
  at org.jboss.remoting.Client.invoke(Client.java:488)
  at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke
(InvokeRemoteInterceptor.java:55)
  at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java
:101)
  at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke
(ClientTxPropagationInterceptor.java:61)
  at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java
:101)
  at org.jboss.aspects.security.SecurityClientInterceptor.invoke
(SecurityClientInterceptor.java:55)
  at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java
:101)
  at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java
:65)
  at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java
:101)
  at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy
.java:102)
  at $Proxy0.updateCabin(Unknown Source)
  at com.titan.clients.Client_1.main(Client_1.java:51)


below is my client code:

public class Client_1
{
   public static void main(String [] args)
   {
       try
       {
          Properties p = new Properties( );
           p.put(Context.INITIAL_CONTEXT_FACTORY,
               "org.jnp.interfaces.NamingContextFactory Source code of org.jnp.interfaces.NamingContextFactory");
           p.put(Context.URL_PKG_PREFIXES,
               " org.jboss.naming:org.jnp.interfaces");
           p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
         
           Context jndiContext = new InitialContext(p);
           Object ref = jndiContext.lookup("TravelAgentBean/remote");
           TravelAgentRemote dao = (TravelAgentRemote)ref;

           Cabin noCabin = dao.findCabin(1);
           System.out.println("no cabin should be null: " + noCabin);

           Cabin cabin_1 = new Cabin();
           cabin_1.setId(4);
           cabin_1.setName("Master Suite");
           cabin_1.setDeckLevel(3);
           cabin_1.setShipId(3);
           cabin_1.setBedCount(3);

           dao.createCabin(cabin_1);

           Cabin cabin_2 = dao.findCabin(4);
           System.out.println(cabin_2.getName());
           System.out.println(cabin_2.getDeckLevel());
           System.out.println(cabin_2.getShipId());
           System.out.println(cabin_2.getBedCount());

     System.out.println("Updating detached cabin instance with new bed count of
4");
     cabin_2.setBedCount(4);  // this is where it fails
     dao.updateCabin(cabin_2);

     System.out.println("Finding cabin to see it has been updated with a merge(
) on server");
           Cabin cabin_3 = dao.findCabin(4);
     System.out.println("new bed count is: " + cabin_3.getBedCount());
       }
       catch (Exception ne)
       {
     ne.printStackTrace();
  }
   }


}


My Business Interface:

@(protected)
public interface TravelAgentRemote
{
  public void createCabin(Cabin cabin) throws java.rmi.RemoteException Source code of java.rmi.RemoteException;
  public Cabin findCabin(int pKey) throws java.rmi.RemoteException Source code of java.rmi.RemoteException;
  public void updateCabin(Cabin cabin) throws java.rmi.RemoteException Source code of java.rmi.RemoteException;
  public void flushModeExample() throws java.rmi.RemoteException Source code of java.rmi.RemoteException;
}


Bean Implementation:

package com.titan.travelagent;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceUnit;
import javax.persistence.FlushModeType;

import com.titan.domain.Cabin;

@(protected)
public class TravelAgentBean implements TravelAgentRemote
{
  @(protected)(unitName="Test") private EntityManagerFactory factory;
  @(protected)(unitName="Test") private EntityManager manager;
   
  public void createCabin(Cabin cabin)
  {
     manager.persist(cabin);
  }

  public Cabin findCabin(int pKey)
  {
     return manager.find(Cabin.class, pKey);
  }
 
  public void updateCabin(Cabin cabin)
  {
     manager.merge(cabin);
  }
 
  public void flushModeExample()
  {
     EntityManager createdManager = factory.createEntityManager();
       
     try
     {
        Cabin newCabin2 = new Cabin();
        newCabin2.setId(2);
        newCabin2.setName("Another Cabin");
        newCabin2.setBedCount(1);
        createdManager.persist(newCabin2);

        Cabin cabin2 = manager.find(Cabin.class, 2);
        if (cabin2 != null)
        {
           throw new RuntimeException("newCabin2 should not be flushed yet");
        }

        Cabin cabin1 = (Cabin)createdManager.createQuery("FROM Cabin c WHERE c
.id = 1").getSingleResult();
           
        cabin2 = manager.find(Cabin.class, 2);
        if (cabin2 == null)
        {
           throw new RuntimeException("newCabin2 should be flushed now");
        }

        createdManager.setFlushMode(FlushModeType.COMMIT);
        newCabin2.setBedCount(99);

        cabin1 = (Cabin)createdManager.createQuery("FROM Cabin c WHERE c.id =
1").getSingleResult();

        manager.refresh(cabin2);
        if (cabin2.getBedCount() == 99)
        {
           throw new RuntimeException("should not be 99 yet with COMMIT and a
query");
        }

        createdManager.flush();

        manager.refresh(cabin2);
        if (cabin2.getBedCount() != 99)
        {
           throw new RuntimeException("should be 99 yet with a flush");
        }
     }
     finally
     {
        createdManager.close();
     }
  }
}


Entity Code

package com.titan.domain;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Column;
import javax.persistence.Id;

@(protected)
@(protected)(name="CABIN")
public class Cabin implements java.io.Serializable Source code of java.io.Serializable
{
   private int id;
   private String name;
   private int deckLevel;
   private int shipId;
   private int bedCount;

   @(protected)
   @(protected)(name="CABIN_ID")
   public int getId()
   {
  return id;
   }
   public void setId(int pk)
   {
  id = pk;
   }

   @(protected)(name="CABIN_NAME")
   public String getName()
   {
       return name;
   }
   public void setName(String str)
   {
  name = str;
   }

   @(protected)(name="CABIN_DECK_LEVEL")
   public int getDeckLevel()
   {
  return deckLevel;
   }
   public void setDeckLevel(int level)
   {
  deckLevel = level;
   }

   @(protected)(name="CABIN_SHIP_ID")
   public int getShipId()
   {
  return shipId;
   }
   public void setShipId(int sid)
   {
  shipId = sid;
   }

   @(protected)(name="CABIN_BED_COUNT")
   public int getBedCount()
   {
  return bedCount;
   }
   public void setBedCount(int bed)
   {
  bedCount = bed;
   }
}



If somebody can help me out..would be a great help...

Thanks
   

   




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic
&p=4052974#4052974

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode
=reply&p=4052974
__ ____ ____ ____ ____ ____ ____ ____ ____ ____
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user

©2008 junlu.com - Jax Systems, LLC, U.S.A.