除錯cmp問題
我在高試我的cmp時出現下如誤:
-- Initializing bean access.
javax.naming.NameNotFoundException: Unable to resolve cmp2Remote. Resolved: '' Unresolved:'cmp2Remote' ; remaining name ''
at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:85)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:253)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:220)-- Failed initializing bean access.
at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35)
at $Proxy0.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:323)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at cmp2.cmp2TestClient2.initialize(cmp2TestClient2.java:36)
at cmp2.cmp2TestClient2.(cmp2TestClient2.java:1
at cmp2.cmp2TestClient2.main(cmp2TestClient2.java:304)
源程如下:
package cmp2;
import javax.naming.*;
import java.util.Properties;
import javax.rmi.PortableRemoteObject;
public class cmp2TestClient2 extends Object
{
private static final String ERROR_NULL_REMOTE = "Remote interface reference is null. It must be created by calling one of the Home interface methods first.";
private static final int MAX_OUTPUT_LINE_LENGTH = 100;
private boolean logging = true;
private cmp2RemoteHome cmp2RemoteHomeObject = null;
private cmp2Remote cmp2RemoteObject = null;
//Construct the EJB test client
public cmp2TestClient2()
{
initialize();
}
public void initialize()
{
long startTime = 0;
if (logging)
{
log("Initializing bean access.");
startTime = System.currentTimeMillis();
}
try
{
//get naming context
Context context = getInitialContext();
//look up jndi name
Object ref = context.lookup("cmp2Remote");
//look up jndi name and cast to Home interface
cmp2RemoteHomeObject = (cmp2RemoteHome) PortableRemoteObject.narrow(ref, cmp2RemoteHome.class);
if (logging)
{
long endTime = System.currentTimeMillis();
log("Succeeded initializing bean access through Home interface.");
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch(Exception e)
{
if (logging)
{
log("Failed initializing bean access.");
}
e.printStackTrace();
}
}
private Context getInitialContext() throws Exception
{
String url = "t3://localhost:7001";
String user = null;
String password = null;
Properties properties = null;
try
{
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url);
if (user != null)
{
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password);
}
return new InitialContext(properties);
}
catch(Exception e)
{
log("Unable to connect to WebLogic server at " + url);
log("Please make sure that the server is running.");
throw e;
}
}
//----------------------------------------------------------------------------
// Methods that use Home interface methods to generate a Remote interface reference
//----------------------------------------------------------------------------
public cmp2Remote create(String userid, String key_letter)
{
long startTime = 0;
if (logging)
{
log("Calling create(" + userid + ", " + key_letter + ")");
startTime = System.currentTimeMillis();
}
try
{
cmp2RemoteObject = cmp2RemoteHomeObject.create(userid, key_letter);
if (logging)
{
long endTime = System.currentTimeMillis();
log("Succeeded: create(" + userid + ", " + key_letter + ")");
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch(Exception e)
{
if (logging)
{
log("Failed: create(" + userid + ", " + key_letter + ")");
}
e.printStackTrace();
}
if (logging)
{
log("Return value from create(" + userid + ", " + key_letter + "): " + cmp2RemoteObject + ".");
}
return cmp2RemoteObject;
}
public cmp2Remote findByPrimaryKey(String userid)
{
long startTime = 0;
if (logging)
{
log("Calling findByPrimaryKey(" + userid + ")");
startTime = System.currentTimeMillis();
}
try
{
cmp2RemoteObject = cmp2RemoteHomeObject.findByPrimaryKey(userid);
if (logging)
{
long endTime = System.currentTimeMillis();
log("Succeeded: findByPrimaryKey(" + userid + ")");
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch(Exception e)
{
if (logging)
{
log("Failed: findByPrimaryKey(" + userid + ")");
}
e.printStackTrace();
}
if (logging)
{
log("Return value from findByPrimaryKey(" + userid + "): " + cmp2RemoteObject + ".");
}
return cmp2RemoteObject;
}
//----------------------------------------------------------------------------
// Methods that use Remote interface methods to access data through the bean
//----------------------------------------------------------------------------
public String getUserid()
{
String returnValue = "";
if (cmp2RemoteObject == null)
{
System.out.println("Error in getUserid(): " + ERROR_NULL_REMOTE);
return returnValue;
}
long startTime = 0;
if (logging)
{
log("Calling getUserid()");
startTime = System.currentTimeMillis();
}
try
{
returnValue = cmp2RemoteObject.getUserid();
if (logging)
{
long endTime = System.currentTimeMillis();
log("Succeeded: getUserid()");
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch(Exception e)
{
if (logging)
{
log("Failed: getUserid()");
}
e.printStackTrace();
}
if (logging)
{
log("Return value from getUserid(): " + returnValue + ".");
}
return returnValue;
}
public void setKey_letter(String key_letter)
{
if (cmp2RemoteObject == null)
{
System.out.println("Error in setKey_letter(): " + ERROR_NULL_REMOTE);
return ;
}
long startTime = 0;
if (logging)
{
log("Calling setKey_letter(" + key_letter + ")");
startTime = System.currentTimeMillis();
}
try
{
cmp2RemoteObject.setKey_letter(key_letter);
if (logging)
{
long endTime = System.currentTimeMillis();
log("Succeeded: setKey_letter(" + key_letter + ")");
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch(Exception e)
{
if (logging)
{
log("Failed: setKey_letter(" + key_letter + ")");
}
e.printStackTrace();
}
}
public String getKey_letter()
{
String returnValue = "";
if (cmp2RemoteObject == null)
{
System.out.println("Error in getKey_letter(): " + ERROR_NULL_REMOTE);
return returnValue;
}
long startTime = 0;
if (logging)
{
log("Calling getKey_letter()");
startTime = System.currentTimeMillis();
}
try
{
returnValue = cmp2RemoteObject.getKey_letter();
if (logging)
{
long endTime = System.currentTimeMillis();
log("Succeeded: getKey_letter()");
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch(Exception e)
{
if (logging)
{
log("Failed: getKey_letter()");
}
e.printStackTrace();
}
if (logging)
{
log("Return value from getKey_letter(): " + returnValue + ".");
}
return returnValue;
}
//----------------------------------------------------------------------------
// Utility Methods
//----------------------------------------------------------------------------
private void log(String message)
{
if (message == null)
{
System.out.println("-- null");
return ;
}
if (message.length() > MAX_OUTPUT_LINE_LENGTH)
{
System.out.println("-- " + message.substring(0, MAX_OUTPUT_LINE_LENGTH) + " ...");
}
else
{
System.out.println("-- " + message);
}
}
//Main method
public static void main(String[] args)
{
cmp2TestClient2 client = new cmp2TestClient2();
// Use the client object to call one of the Home interface wrappers
// above, to create a Remote interface reference to the bean.
// If the return value is of the Remote interface type, you can use it
// to access the remote interface methods. You can also just use the
// client object to call the Remote interface wrappers.
}
}
請問是什麼原因?
-- Initializing bean access.
javax.naming.NameNotFoundException: Unable to resolve cmp2Remote. Resolved: '' Unresolved:'cmp2Remote' ; remaining name ''
at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:85)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:253)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:220)-- Failed initializing bean access.
at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35)
at $Proxy0.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:323)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at cmp2.cmp2TestClient2.initialize(cmp2TestClient2.java:36)
at cmp2.cmp2TestClient2.(cmp2TestClient2.java:1
at cmp2.cmp2TestClient2.main(cmp2TestClient2.java:304)
源程如下:
package cmp2;
import javax.naming.*;
import java.util.Properties;
import javax.rmi.PortableRemoteObject;
public class cmp2TestClient2 extends Object
{
private static final String ERROR_NULL_REMOTE = "Remote interface reference is null. It must be created by calling one of the Home interface methods first.";
private static final int MAX_OUTPUT_LINE_LENGTH = 100;
private boolean logging = true;
private cmp2RemoteHome cmp2RemoteHomeObject = null;
private cmp2Remote cmp2RemoteObject = null;
//Construct the EJB test client
public cmp2TestClient2()
{
initialize();
}
public void initialize()
{
long startTime = 0;
if (logging)
{
log("Initializing bean access.");
startTime = System.currentTimeMillis();
}
try
{
//get naming context
Context context = getInitialContext();
//look up jndi name
Object ref = context.lookup("cmp2Remote");
//look up jndi name and cast to Home interface
cmp2RemoteHomeObject = (cmp2RemoteHome) PortableRemoteObject.narrow(ref, cmp2RemoteHome.class);
if (logging)
{
long endTime = System.currentTimeMillis();
log("Succeeded initializing bean access through Home interface.");
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch(Exception e)
{
if (logging)
{
log("Failed initializing bean access.");
}
e.printStackTrace();
}
}
private Context getInitialContext() throws Exception
{
String url = "t3://localhost:7001";
String user = null;
String password = null;
Properties properties = null;
try
{
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url);
if (user != null)
{
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password);
}
return new InitialContext(properties);
}
catch(Exception e)
{
log("Unable to connect to WebLogic server at " + url);
log("Please make sure that the server is running.");
throw e;
}
}
//----------------------------------------------------------------------------
// Methods that use Home interface methods to generate a Remote interface reference
//----------------------------------------------------------------------------
public cmp2Remote create(String userid, String key_letter)
{
long startTime = 0;
if (logging)
{
log("Calling create(" + userid + ", " + key_letter + ")");
startTime = System.currentTimeMillis();
}
try
{
cmp2RemoteObject = cmp2RemoteHomeObject.create(userid, key_letter);
if (logging)
{
long endTime = System.currentTimeMillis();
log("Succeeded: create(" + userid + ", " + key_letter + ")");
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch(Exception e)
{
if (logging)
{
log("Failed: create(" + userid + ", " + key_letter + ")");
}
e.printStackTrace();
}
if (logging)
{
log("Return value from create(" + userid + ", " + key_letter + "): " + cmp2RemoteObject + ".");
}
return cmp2RemoteObject;
}
public cmp2Remote findByPrimaryKey(String userid)
{
long startTime = 0;
if (logging)
{
log("Calling findByPrimaryKey(" + userid + ")");
startTime = System.currentTimeMillis();
}
try
{
cmp2RemoteObject = cmp2RemoteHomeObject.findByPrimaryKey(userid);
if (logging)
{
long endTime = System.currentTimeMillis();
log("Succeeded: findByPrimaryKey(" + userid + ")");
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch(Exception e)
{
if (logging)
{
log("Failed: findByPrimaryKey(" + userid + ")");
}
e.printStackTrace();
}
if (logging)
{
log("Return value from findByPrimaryKey(" + userid + "): " + cmp2RemoteObject + ".");
}
return cmp2RemoteObject;
}
//----------------------------------------------------------------------------
// Methods that use Remote interface methods to access data through the bean
//----------------------------------------------------------------------------
public String getUserid()
{
String returnValue = "";
if (cmp2RemoteObject == null)
{
System.out.println("Error in getUserid(): " + ERROR_NULL_REMOTE);
return returnValue;
}
long startTime = 0;
if (logging)
{
log("Calling getUserid()");
startTime = System.currentTimeMillis();
}
try
{
returnValue = cmp2RemoteObject.getUserid();
if (logging)
{
long endTime = System.currentTimeMillis();
log("Succeeded: getUserid()");
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch(Exception e)
{
if (logging)
{
log("Failed: getUserid()");
}
e.printStackTrace();
}
if (logging)
{
log("Return value from getUserid(): " + returnValue + ".");
}
return returnValue;
}
public void setKey_letter(String key_letter)
{
if (cmp2RemoteObject == null)
{
System.out.println("Error in setKey_letter(): " + ERROR_NULL_REMOTE);
return ;
}
long startTime = 0;
if (logging)
{
log("Calling setKey_letter(" + key_letter + ")");
startTime = System.currentTimeMillis();
}
try
{
cmp2RemoteObject.setKey_letter(key_letter);
if (logging)
{
long endTime = System.currentTimeMillis();
log("Succeeded: setKey_letter(" + key_letter + ")");
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch(Exception e)
{
if (logging)
{
log("Failed: setKey_letter(" + key_letter + ")");
}
e.printStackTrace();
}
}
public String getKey_letter()
{
String returnValue = "";
if (cmp2RemoteObject == null)
{
System.out.println("Error in getKey_letter(): " + ERROR_NULL_REMOTE);
return returnValue;
}
long startTime = 0;
if (logging)
{
log("Calling getKey_letter()");
startTime = System.currentTimeMillis();
}
try
{
returnValue = cmp2RemoteObject.getKey_letter();
if (logging)
{
long endTime = System.currentTimeMillis();
log("Succeeded: getKey_letter()");
log("Execution time: " + (endTime - startTime) + " ms.");
}
}
catch(Exception e)
{
if (logging)
{
log("Failed: getKey_letter()");
}
e.printStackTrace();
}
if (logging)
{
log("Return value from getKey_letter(): " + returnValue + ".");
}
return returnValue;
}
//----------------------------------------------------------------------------
// Utility Methods
//----------------------------------------------------------------------------
private void log(String message)
{
if (message == null)
{
System.out.println("-- null");
return ;
}
if (message.length() > MAX_OUTPUT_LINE_LENGTH)
{
System.out.println("-- " + message.substring(0, MAX_OUTPUT_LINE_LENGTH) + " ...");
}
else
{
System.out.println("-- " + message);
}
}
//Main method
public static void main(String[] args)
{
cmp2TestClient2 client = new cmp2TestClient2();
// Use the client object to call one of the Home interface wrappers
// above, to create a Remote interface reference to the bean.
// If the return value is of the Remote interface type, you can use it
// to access the remote interface methods. You can also just use the
// client object to call the Remote interface wrappers.
}
}
請問是什麼原因?
相關文章
- Laravel+xdebug 除錯問題Laravel除錯
- SQLServer2008 除錯問題SQLServer除錯
- 關於 swoole 除錯問題除錯
- [20221107]除錯crontab問題.txt除錯
- this問題 以及 webstorm 除錯介面WebORM除錯
- VS - 打斷點/本地除錯/遠端除錯 問題斷點除錯
- VSCode除錯Flutter的問題解決VSCode除錯Flutter
- Linux MIPI 除錯中常見的問題Linux除錯
- Xcode斷點除錯出現的問題XCode斷點除錯
- 解決codeblocks無法除錯的問題BloC除錯
- 幽默:除錯程式碼問題的最佳方法除錯
- vscode與chrome除錯配置與常見問題VSCodeChrome除錯
- 『開源』大半夜除錯TCP延遲問題除錯TCP
- 除錯433M模組遇到的問題除錯
- [20231102]除錯bash shell指令碼遇到的問題.txt除錯指令碼
- 樹莓派除錯PCF8591遇到的小問題樹莓派除錯
- [文件教程]解決SAE下本地除錯相關問題除錯
- 如何分析 SAP Spartacus 路由問題之 CheckoutAuthGuard 單步除錯路由除錯
- [20230329]記錄除錯sql語句遇到的問題.txt除錯SQL
- 錯排問題
- 除錯篇——除錯物件與除錯事件除錯物件事件
- 提問:如何使用 chrome 除錯 iPhoneChrome除錯iPhone
- React-Native 新版本無法Debug無法除錯問題React除錯
- Jekyll 本地除錯部落格遇到的問題及解決辦法除錯
- Swift 首次除錯斷點慢的問題解法 | 優酷 Swift 實踐Swift除錯斷點
- Angular 內容投影 content projection 的一個問題的單步除錯AngularProject除錯
- No debuggable processes(Android Studio沒有可除錯應用)問題解決方案Android除錯
- Linux基礎命令---cmpLinux
- Ubuntu 下使用 ADB 除錯 Android 應用時的裝置識別問題Ubuntu除錯Android
- 關於 Angular view Query 的 id 選擇器問題的單步除錯AngularView除錯
- Windows windbg kernel debug 雙機核心除錯 - USB3.0 除錯 USB除錯 除錯線Windows除錯
- mysql checksum 報錯問題。MySql
- composer require 報錯問題UI
- ZanProxy —— 原生程式碼除錯線上頁面,環境再也不是問題除錯
- GDB 除錯 .NET 程式實錄 - .NET 呼叫 .so 出現問題怎麼解決除錯
- STM32F334用keil5的debug除錯時出現問題除錯
- Angular 內容投影 content projection 關於選擇器問題的單步除錯AngularProject除錯
- Angular 內容投影 content projection 關於條件渲染問題的單步除錯AngularProject除錯
- Python 程式碼除錯—使用 pdb 除錯Python除錯