javax.ejb.EJBException: ejbCreate: 将截断字符串或二进制数据。非常像是字符串超长。如firstName、lastName等超过数据库设计的字段长度。
解决方案 »
- 有关doFilter的一个问题
- struts2的select标签如何取得选中的值
- 415.8%23.1为啥会计算错误
- wade
- Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: ja
- 如何用java实现邮件客户端的收件箱、发件箱等功能
- hibernate报错:could not resolve property: roomTypes of:
- Hibernate关于Restrictions.in的查询问题
- 高分求救!
- struct2 如何从一个action跳转到另一个action,并且要带一个参数过去
- 请教一个简单问题,在配置好weblogic7和jbuilder7以后web相关程序入jsp,serverlet报错
- EJB中的remove()方法
import java.sql.*;
import javax.sql.*;
import javax.naming.*;
import java.math.*;
import java.util.*;public class Client2
{ public static void main(String[] args)
{
try
{
String url="t3://localhost:7001";
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, url);
Context ctx=new InitialContext(h);
DataSource ds = (DataSource) ctx.lookup("SavingsAccountDB");
Connection con = ds.getConnection();String insertStatement ="insert into savingsaccount values ( ? , ? , ? , ? )";
PreparedStatement prepStmt =con.prepareStatement(insertStatement);
prepStmt.setString(1, "11");
prepStmt.setString(2, "sdfsdf");
prepStmt.setString(3, "sdfsdfs");
prepStmt.setBigDecimal(4, new BigDecimal(100));
prepStmt.executeUpdate();
prepStmt.close();
}
catch(Exception e)
{
System.out.println("error");
}
}
}
Caught an Exception: EJB Exception:; nested exception is:
javax.ejb.EJBException: ejbCreate: 将截断字符串或二进制数据。 Severity 16, State 2, Procedure 'NW05 null', Line 1Start server side stack trace:
java.rmi.RemoteException: EJB Exception:; nested exception is:
javax.ejb.EJBException: ejbCreate: 将截断字符串或二进制数据。 Severity 16, State 2, Procedure 'NW05 null', Line 1
javax.ejb.EJBException: ejbCreate: 将截断字符串或二进制数据。 Severity 16, State 2, Procedure 'NW05 null', Line 1
at beantest2.SavingsAccountBean.ejbCreate(SavingsAccountBean.java:115)
at beantest2.SavingsAccountBean_d8mx44_Impl.ejbCreate(SavingsAccountBean_d8mx44_Impl.java:172)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.ejb20.manager.DBManager.create(DBManager.java:737)
at weblogic.ejb20.manager.DBManager.remoteCreate(DBManager.java:707)
at weblogic.ejb20.internal.EntityEJBHome.create(EntityEJBHome.java:250)
at beantest2.SavingsAccountBean_d8mx44_HomeImpl.create(SavingsAccountBean_d8mx44_HomeImpl.java:80)
at beantest2.SavingsAccountBean_d8mx44_HomeImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:346)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:114)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:300)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:762)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:295)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
End server side stack trace以下是ejb的客户端:
import java.util.*;
import java.math.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;import beantest2.*;public class Client
{
public static void main(String [] arg)
{
try
{
String url="t3://localhost:7001";
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, url);
Context ctx=new InitialContext(h);
System.out.println("Getting the EJBHome object…");
Object objref = ctx.lookup("SavingsAccountHome");
System.out.println("find ok");
SavingsAccountHome home = (SavingsAccountHome)PortableRemoteObject.narrow(objref, SavingsAccountHome.class);
BigDecimal zeroAmount = new BigDecimal("10.00");
SavingsAccount duke = home.create("12312", "23", "3423", zeroAmount);
duke.credit(new BigDecimal("88.50"));
duke.debit(new BigDecimal("20.25"));
BigDecimal balance = duke.getBalance();
System.out.println("balance = " + balance);
duke.remove(); }
catch (Exception ex) {
System.err.println("Caught an Exception: "
+ ex.getMessage()); }
}
}