救命啊!哪位大哥幫幫忙啊 程式出來很大的問題哦
我用eclipse3.0+jbosside+jboss4.0+mysql編了一個BMP,用客戶端進行測試時,總是出錯,大俠們幫我看看吧!
package com.liuyang.bmp.programmer.client;
import java.util.Collection;
import java.util.Iterator;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import com.liuyang.bmp.interfaces.ProgrammerBMP;
import com.liuyang.bmp.interfaces.ProgrammerBMPHome;
public class ProgrammerClient {
public static void main(String[] args) throws Exception {
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
p.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099");
Object ref = new InitialContext(p).lookup("ProgrammerBMP");
ProgrammerBMPHome home = (ProgrammerBMPHome)ref;
ProgrammerBMP liuyang = home.create("liuyang",25,"java","jboss");
ProgrammerBMP weifei = home.create("weifei",25,"java","eclipse");
Collection all = home.findByLanguage("java");
if((all!=null)&&(!all.isEmpty())){
Iterator it = all.iterator();
while(it.hasNext()){
ProgrammerBMP bmp = (ProgrammerBMP) it.next();
System.out.println(bmp.getName()+":"+bmp.getTool());
}
}
}
}
進行測試時總是丟擲以下錯誤是什麼原因啊??
log4j:WARN No appenders could be found for logger (org.jnp.interfaces.NamingContext).
log4j:WARN Please initialize the log4j system properly.
javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1302)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1382)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:579)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.liuyang.bmp.programmer.client.ProgrammerClient.main(ProgrammerClient.java:30)
Caused by: java.net.SocketTimeoutException: Receive timed out
at java.net.PlainDatagramSocketImpl.receive(Native Method)
at java.net.DatagramSocket.receive(DatagramSocket.java:711)
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1272)
... 5 more
Exception in thread "main"
請大俠們指點迷精,萬分感謝!!
ejb-jar.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!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 >
<description><![CDATA[No Description.]]></description>
<display-name>Generated by XDoclet</display-name>
<enterprise-beans>
<!-- Session Beans -->
<!--
To add session beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called session-beans.xml that contains
the <session></session> markup for those beans.
-->
<!-- Entity Beans -->
<entity >
<description><![CDATA[Description for ProgrammerBMP]]></description>
<display-name>ProgrammerBMPBean</display-name>
<ejb-name>ProgrammerBMP</ejb-name>
<home>com.liuyang.bmp.interfaces.ProgrammerBMPHome</home>
<remote>com.liuyang.bmp.interfaces.ProgrammerBMP</remote>
<ejb-class>com.liuyang.bmp.programmer.ProgrammerBMPBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<resource-ref >
<res-ref-name>datasource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</entity>
<!--
To add entity beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called entity-beans.xml that contains
the <entity></entity> markup for those beans.
-->
<!-- Message Driven Beans -->
<!--
To add message driven beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called message-driven-beans.xml that contains
the <message-driven></message-driven> markup for those beans.
-->
</enterprise-beans>
<!-- Relationships -->
<!-- Assembly Descriptor -->
<assembly-descriptor >
<!--
To add additional assembly descriptor info here, add a file to your
XDoclet merge directory called assembly-descriptor.xml that contains
the <assembly-descriptor></assembly-descriptor> markup.
-->
<!-- finder permissions -->
<!-- transactions -->
<!-- finder transactions -->
</assembly-descriptor>
</ejb-jar>
jboss-xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
<jboss>
<enterprise-beans>
<!--
To add beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called jboss-beans.xml that contains
the <session></session>, <entity></entity> and <message-driven></message-driven>
markup for those beans.
-->
<entity>
<ejb-name>ProgrammerBMP</ejb-name>
<jndi-name>ejb/ProgrammerBMP</jndi-name>
<resource-ref>
<res-ref-name>datasource</res-ref-name>
<jndi-name>java:/MySQLDS</jndi-name>
</resource-ref>
<method-attributes>
</method-attributes>
</entity>
</enterprise-beans>
<resource-managers>
</resource-managers>
</jboss>
package com.liuyang.bmp.programmer.client;
import java.util.Collection;
import java.util.Iterator;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import com.liuyang.bmp.interfaces.ProgrammerBMP;
import com.liuyang.bmp.interfaces.ProgrammerBMPHome;
public class ProgrammerClient {
public static void main(String[] args) throws Exception {
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
p.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099");
Object ref = new InitialContext(p).lookup("ProgrammerBMP");
ProgrammerBMPHome home = (ProgrammerBMPHome)ref;
ProgrammerBMP liuyang = home.create("liuyang",25,"java","jboss");
ProgrammerBMP weifei = home.create("weifei",25,"java","eclipse");
Collection all = home.findByLanguage("java");
if((all!=null)&&(!all.isEmpty())){
Iterator it = all.iterator();
while(it.hasNext()){
ProgrammerBMP bmp = (ProgrammerBMP) it.next();
System.out.println(bmp.getName()+":"+bmp.getTool());
}
}
}
}
進行測試時總是丟擲以下錯誤是什麼原因啊??
log4j:WARN No appenders could be found for logger (org.jnp.interfaces.NamingContext).
log4j:WARN Please initialize the log4j system properly.
javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1302)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1382)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:579)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.liuyang.bmp.programmer.client.ProgrammerClient.main(ProgrammerClient.java:30)
Caused by: java.net.SocketTimeoutException: Receive timed out
at java.net.PlainDatagramSocketImpl.receive(Native Method)
at java.net.DatagramSocket.receive(DatagramSocket.java:711)
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1272)
... 5 more
Exception in thread "main"
請大俠們指點迷精,萬分感謝!!
ejb-jar.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!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 >
<description><![CDATA[No Description.]]></description>
<display-name>Generated by XDoclet</display-name>
<enterprise-beans>
<!-- Session Beans -->
<!--
To add session beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called session-beans.xml that contains
the <session></session> markup for those beans.
-->
<!-- Entity Beans -->
<entity >
<description><![CDATA[Description for ProgrammerBMP]]></description>
<display-name>ProgrammerBMPBean</display-name>
<ejb-name>ProgrammerBMP</ejb-name>
<home>com.liuyang.bmp.interfaces.ProgrammerBMPHome</home>
<remote>com.liuyang.bmp.interfaces.ProgrammerBMP</remote>
<ejb-class>com.liuyang.bmp.programmer.ProgrammerBMPBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<resource-ref >
<res-ref-name>datasource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</entity>
<!--
To add entity beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called entity-beans.xml that contains
the <entity></entity> markup for those beans.
-->
<!-- Message Driven Beans -->
<!--
To add message driven beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called message-driven-beans.xml that contains
the <message-driven></message-driven> markup for those beans.
-->
</enterprise-beans>
<!-- Relationships -->
<!-- Assembly Descriptor -->
<assembly-descriptor >
<!--
To add additional assembly descriptor info here, add a file to your
XDoclet merge directory called assembly-descriptor.xml that contains
the <assembly-descriptor></assembly-descriptor> markup.
-->
<!-- finder permissions -->
<!-- transactions -->
<!-- finder transactions -->
</assembly-descriptor>
</ejb-jar>
jboss-xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
<jboss>
<enterprise-beans>
<!--
To add beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called jboss-beans.xml that contains
the <session></session>, <entity></entity> and <message-driven></message-driven>
markup for those beans.
-->
<entity>
<ejb-name>ProgrammerBMP</ejb-name>
<jndi-name>ejb/ProgrammerBMP</jndi-name>
<resource-ref>
<res-ref-name>datasource</res-ref-name>
<jndi-name>java:/MySQLDS</jndi-name>
</resource-ref>
<method-attributes>
</method-attributes>
</entity>
</enterprise-beans>
<resource-managers>
</resource-managers>
</jboss>
相關文章
- SPRING整合STRUCTS的小白問題 高手們幫幫忙啊SpringStruct
- 釋出成功了,但客戶段呼叫有問題,幫幫忙啊
- 一個寫xml的問題,高手幫忙啊!XML
- 奇怪!!奇怪!真是不可理解。哪位大哥幫幫忙。
- spring+Hibernate執行時出錯,各位大哥幫忙啊!!!!!!!!!!!!!!!!!!!Spring
- 各位大哥,jboss配置資料來源的問題,幫幫忙!
- iBatis問題,救命啊!!!急急急!!!BAT
- model 與modelform屬性對應問題,誰幫幫我啊ORM
- 各位大哥,幫忙解決一下這個問題
- banq 老師幫忙啊 如何設定log4j???
- 各位高手來幫我看看sql的問題吧,謝謝啦,線上等答案啊SQL
- benq大哥,幫忙,請進入,謝謝!ENQ
- 哪位高手幫幫我
- 一個執行緒的問題。請大俠進來幫幫忙看看執行緒
- synchronized關鍵字問題?各位高手,幫幫忙!synchronized
- 急不理解的問題,大家幫幫忙,關於jive
- Jbuilder 問題,請大俠幫忙!!!UI
- bang救命啊! jbuilder奇怪錯誤UI
- 遇到了java smtp 郵件問題,哪位高手能夠相助啊?Java
- 急!!!高手來幫忙呀!!
- 急!!!高手快來幫忙!!!
- 挑戰高薪機會哦 大家快來看啊高薪
- 做交叉編譯時候的一點問題,麻煩有這方面經驗的人幫個忙,謝謝了啊(轉)編譯
- 請高手幫忙分析一個JSP小程式的問題JS
- NIO Socket的2個問題?請高手幫忙!
- 高手、板主幫忙,一個加密的問題!!!加密
- 請高手幫忙了,關於javamail的問題JavaAI
- 關於petstore的最新版本? 請banq大哥幫忙
- 女性想健康,AI來幫忙AI
- 安裝JPETSTORE出錯,請幫忙看看是哪出了問題.
- 救命啊,剛開始學習rmi,問題不斷,備受打擊
- 熟悉ibatis的請幫幫忙!BAT
- JNDI中Context初始化的問題!請幫幫忙,急需解決!Context
- simplejdonframeworktest 問題啊...Framework
- 高手幫忙
- 高手幫忙!
- 關於Jboss應用ear檔案的釋出問題,幫忙看看:)
- 安裝jivajond3出現的問題,求banq老師幫忙!