JBuilder 9 自动生成CMP后添加一个finder方法报错
JBuilder 9 自动生成CMP后编译、部署到weblogic 8.1,然后自动生成客户端测试程序main方法中添加
InfoTable1TestClient1 client = new InfoTable1TestClient1();
client.findByPrimaryKey("7421311");
System.out.println("姓名:"+client.getSName());
运行结果没有任何问题!
然后通过JBuilder手工添加一个finder 方法--findByName,查询语句
select object(i) from info_table1 as i where i.s_name = ?1
重新编译报错如下:
"Cmp.jar": Spaces in the temporary directory path may cause WebLogic APPC utility to produce fatal compile errors.
"Cmp.jar": Spaces in the classpath may cause WebLogic APPC utility to produce fatal compile errors.
"Cmp.jar": C:\bea\jdk141_03\bin\javaw -classpath "D:\study\J2EE\j2ee\classes;C:\bea\weblogic81\server\lib\weblogic_sp.jar;C:\bea\weblogic81\server\lib\weblogic.jar;C:\bea\weblogic81\server\lib\webservices.jar;D:\D\新建文件夹 (2)\工程2\myomni\lib\log4j-1.2.8.jar;D:\D\新建文件夹 (2)\工程2\myomni\lib\weblogic_sp.jar;D:\D\新建文件夹 (2)\工程2\myomni\lib\weblogic.jar;D:\D\新建文件夹 (2)\工程2\myomni\lib\webservices.jar;C:\JBuilder9\thirdparty\junit3.8\junit.jar;C:\JBuilder9\lib\unittest.jar;C:\JBuilder9\lib\mail.jar;C:\JBuilder9\lib\activation.jar;C:\JBuilder9\lib\ext\classes12.zip;C:\JBuilder9\lib\ext\msbase.jar;C:\JBuilder9\lib\ext\mssqlserver.jar;C:\JBuilder9\lib\ext\msutil.jar;C:\JBuilder9\lib\ext\mysql-connector-java-2.0.14-bin.jar;" weblogic.appc -keepgenerated -forceGeneration -compiler C:/bea/jdk141_03/bin/javac D:/study/J2EE/j2ee/Cmp.jar.jar -output D:/study/J2EE/j2ee/Cmp.jar
"Cmp.jar": <2005-5-17 上午10时19分52秒 CST> <Warning> <EJB> <BEA-010054> <EJB Deployment: InfoTable1 has a class com.hjq.j2ee.EJB.CMP.InfoTable1Bean that is in the classpath. This class should only be located in the ejb-jar file.>
"Cmp.jar": <2005-5-17 上午10时19分52秒 CST> <Warning> <EJB> <BEA-010054> <EJB Deployment: InfoTable1 has a class com.hjq.j2ee.EJB.CMP.InfoTable1RemoteHome that is in the classpath. This class should only be located in the ejb-jar file.>
"Cmp.jar": <2005-5-17 上午10时19分52秒 CST> <Warning> <EJB> <BEA-010054> <EJB Deployment: InfoTable1 has a class com.hjq.j2ee.EJB.CMP.InfoTable1Remote that is in the classpath. This class should only be located in the ejb-jar file.>
"Cmp.jar": <2005-5-17 上午10时19分52秒 CST> <Warning> <EJB> <BEA-010054> <EJB Deployment: InfoTable1 has a class com.hjq.j2ee.EJB.CMP.InfoTable1Home that is in the classpath. This class should only be located in the ejb-jar file.>
"Cmp.jar": <2005-5-17 上午10时19分52秒 CST> <Warning> <EJB> <BEA-010054> <EJB Deployment: InfoTable1 has a class com.hjq.j2ee.EJB.CMP.InfoTable1 that is in the classpath. This class should only be located in the ejb-jar file.>
"Cmp.jar": [J2EE:160121]Errors encountered while compiling module 'D:\study\J2EE\j2ee\Cmp.jar.jar':
"Cmp.jar": [EJB:011017]Error while reading 'META-INF/weblogic-cmp-rdbms-jar.xml'. The error was:
"Cmp.jar":
"Cmp.jar": Query:
"Cmp.jar": EJB Name: InfoTable1
"Cmp.jar": Method Name: findByName
"Cmp.jar": Parameter Types: (java.lang.String)
"Cmp.jar": select object(i ) from =>> info_table1 <<= as i where i.s_name = ?1
"Cmp.jar": EJB QL compilation encountered error: [EJB:013015]Could not find an entity EJB for abstract schema name, 'info_table1', which is declared in a range variable declaration. Verify that an EJB is defined in the ejb-jar.xml descriptor with this abstract schema name.
"Cmp.jar": .
请各位大虾帮忙看一下,感谢!!!
问题点数:70、回复次数:17Top
1 楼wenchaohu213(夏吾)回复于 2005-05-17 10:43:50 得分 0
UPTop
2 楼boyhjq(椰风)回复于 2005-05-18 09:11:44 得分 0
请各位大虾帮忙!急!
一定给你加分!
Top
3 楼sgdb(神天月晓)回复于 2005-05-18 09:18:25 得分 0
D\新建文件夹 (2)
看到没有,有空格,把空格去掉Top
4 楼sibuliao(尚勇军)回复于 2005-05-18 10:48:10 得分 0
upTop
5 楼boyhjq(椰风)回复于 2005-05-18 11:21:33 得分 0
回复:: sgdb(神天月晓)
没有空格,自动生成的findByPrimaryKey方法一样运行都能查询到结果
client.findByPrimaryKey("7421311");
System.out.println("姓名:"+client.getSName());
但是通过JBuilder手工添加一个finder 方法--findByName
编译时候就出现上面的问题Top
6 楼sgdb(神天月晓)回复于 2005-05-18 13:14:49 得分 0
select object(i) from info_table1 as i where i.s_name = ?1
info_table1 换成你entity bean的名字InfoTable1
Top
7 楼boyhjq(椰风)回复于 2005-05-18 16:59:48 得分 0
回复: sgdb(神天月晓)
为什么要换呢〉?info_table1是表名呀!换了编译时候还是出错!
请教!!!!!!!!Top
8 楼boyhjq(椰风)回复于 2005-05-18 17:02:24 得分 0
把查询的SQL语句select object(i) from info_table1 as i where i.s_name = ?1
替换成空,编译出的错一样呀!
真是纳闷了!!!
Top
9 楼sleepingsprite()回复于 2005-05-19 00:09:28 得分 70
应该是select object(i) from InfoTable1 as i where i.s_name = ?1
在EJB QL 中不是使用的数据库表名,而是你的实体Bean名字,所以的实体Bean是什么名字就应该放到from后面
Top
10 楼boyhjq(椰风)回复于 2005-05-19 10:22:59 得分 0
回复: sleepingsprite()
应该是select object(i) from InfoTable1 as i where i.s_name = ?1
在EJB QL 中不是使用的数据库表名,而是你的实体Bean名字,所以的实体Bean是什么名字就应该放到from后面
EJB QL 修改和你所说得一样,但是还是编译出一样的错误!
其实EJB QL 为空也是可以的吧,编译出同样错误!
但是把添加的Finder方法去掉,就可以正常运行,通过findByPrimaryKey("123")方法查询出对应学生的姓名!
添加Finder方法,需要什么特别的设置么???
谢谢!!!!!Top
11 楼boyhjq(椰风)回复于 2005-05-19 10:31:02 得分 0
关键是这个错误,不知道怎么来的?
"Cmp.jar": <2005-5-19 上午10时27分12秒 CST> <Warning> <EJB> <BEA-010054> <EJB Deployment: InfoTable1 has a class com.hjq.j2ee.EJB.CMP.InfoTable1Bean that is in the classpath. This class should only be located in the ejb-jar file.>
Top
12 楼sleepingsprite()回复于 2005-05-19 10:54:34 得分 0
把你的工程发到我邮箱里sleeping_sprite@163.comTop
13 楼sgdb(神天月晓)回复于 2005-05-19 13:29:33 得分 0
又回到了一开始的地方,你的classpath里有空格
D:\D\新建文件夹 (2)\工程2\myomni\lib\weblogic_sp.jar;
D:\D\新建文件夹 (2)\工程2\myomni\lib\weblogic.jar;
D:\D\新建文件夹 (2)\工程2\myomni\lib\webservices.jar;
...............
看看,那么多空格,你的weblogic是不是装在“新建文件夹 (2)”啊?如果是就重装,如果不是,就把相应jar放到没有空格的地方,然后在project里重新引入Top
14 楼boyhjq(椰风)回复于 2005-05-19 14:02:53 得分 0
回复: sleepingsprite()
我已经把工程发到你的邮箱里面,谢谢帮忙看看!Top
15 楼szy8110(过路人)回复于 2005-05-19 14:46:25 得分 0
info_table 改为database-schema的名字就ok了Top
16 楼szy8110(过路人)回复于 2005-05-19 14:48:54 得分 0
"Cmp.jar": select object(i ) from =>> info_table1 <<= as i where i.s_name = ?1
你在部署描述里面可以看到一个schema,把info_tablel替换成这个值包你okTop
17 楼boyhjq(椰风)回复于 2005-05-20 09:47:43 得分 0
非常感谢大家积极支持和帮助,已经找到编译错误的原因。
我会给你们加分!!
Top




