Hi all!
My environment  is  Apache && Jserv && GunJsp  && Jonas &&Nt && personnal Oracle.
I run successfully examples(sessionbean, entitybean) ,jsp.
I try test. but I have some trouble .....
EjbServer start, call  Notice. jsp.
EJB create well.(Db success to insert record) but record list fail to view.
Notice interface function can't call with error java.sql.SQLException:
Invalid column name.
 
 
error here:
=================================================================================
JSP strat
Connecting to the NoticeHome
beanName :NoticeHome
Getting the list of existing notice in database
after findAll()
Exception getting Notice list: java.rmi.ServerException: RemoteException occurred in server thread; nested
exception is: java.rmi.RemoteException: Failed to load bean from database; nested exception is: java.sql.SQLException:
Invalid column name
Notice terminated
JSP end
================================================================================
Notice.jsp
 
<%@ page contentType="text/html; charset=EUC-KR" %>
<html>
<body>
<%@ page import="javax.servlet.*,javax.servlet.http.*,java.util.*,javax.ejb.*,java.rmi.RemoteException,javax.ejb.*,java.lang.String,org.objectweb.jonas.common.Trace,javax.naming.*,javax.naming.InitialContext,javax.transaction.*,board.*" %>
<p>
JSP start
</p>
<%
 Properties p = new Properties();
 p.put(Context.PROVIDER_URL, "rmi://203.248.69.64:1099");
 p.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.rmi.registry.RegistryContextFactory");
 Context initialContext = null;
  try
 {
  initialContext = new InitialContext(p);
 }
 catch (Exception e1)
 {
  out.println("Cannot get initial context for JNDI: " + e1);
  return;
 }
 UserTransaction utx = null;
 try
 {
  utx = (UserTransaction) initialContext.lookup("javax.transaction.UserTransaction");
 }
 catch (Exception e2)
 {
                out.println("Cannot lookup UserTransaction: "+e2);
  return;
 }
 
 out.println("Connecting to the NoticeHome<br>");
 String beanName = "NoticeHome";
 out.println("beanName :" + beanName + "<br>");
 
 NoticeHome home = null;
 try
 {
  home = (NoticeHome) initialContext.lookup(beanName);
 }
 catch (Exception e)
 {
  out.println("Cannot lookup "+beanName+": " +e);
 }
 
 // Create a  notice
 out.println("Creating a new Notice in database<br>");
 Notice a0 = null;
 try
 {
  TNotice tNotice = new TNotice();
  tNotice.id = 3;
  tNotice.type = 1;  
  tNotice.start_date = "2000/02/08";
  tNotice.end_date= "2000/02/08";
  tNotice.up_date = "2000/02/08";
  tNotice.count = 0;
  tNotice.title = "third";
  tNotice.content = "Test is test3.";
  a0 = home.create(tNotice);
 }
 catch (Exception e)
 {
  out.println("Cannot create Notice: " + e + "<br>");
 }
 
 out.println("Getting the list of existing notice in database<br>");
          
  Enumeration alist;
  Notice  notice;
  
  try
  {
   utx.begin(); // faster if made inside a Tx
   alist = home.findAll();
   out.println("after findAll()<br>");
   while (alist.hasMoreElements())
   {
    notice = (Notice) alist.nextElement();   
    out.println("ID: "+notice.getID()+"<BR>");
    out.println("Type: "+ notice.getType()+"<BR>");
    out.println("Update: " + notice.getUpDate()+"<BR>");
    out.println("StartDate: "+ notice.getStartDate()+"<BR>");
    out.println("EndDate: "+ notice.getEndDate()+"<BR>");
    out.println("Count:  "+ notice.getCount()+"<BR>");
    out.println("Title:  "+ notice.getTitle()+"<BR>");
    out.println("Content: "+ notice.getContent()+"<BR>");
       
   }
   utx.commit();
  }
  catch (Exception e)
  {
   out.println("Exception getting Notice list: " + e);
  }
        
        
 // Exit program
 out.println("Notice terminated");
  
%>
<p>
JSP end
</p>
</body>
</html>
 
===============================================================
My souces, files add.
Please, help me!
Thanks in advance.
Eujene.
 
 
 
 
 

TNotice.java

jonas.properties

Notice.java

Notice.properties

EntityDescriptor {
        BeanHomeName                    = "NoticeHome";
        EnterpriseBeanClassName         = board.NoticeBean;
        HomeInterfaceClassName          = board.NoticeHome;
        RemoteInterfaceClassName        = board.Notice;
        PrimaryKeyClassName             = board.NoticePK;
 
        ControlDescriptors              = {
                {
                        TransactionAttribute = TX_REQUIRED;
                };
        };
        EnvironmentProperties           = "Notice.properties";
        ContainerManagedFields          = {
                id; type; up_date; start_date; end_date; count; title; content; 
        };
}



NoticeBean.java

NoticeHome.java

NoticePK.java

NoticHome.java

compile.sh

Reply via email to