2013-03-26 92 views
1

我试图创建的WebSphere, 管理客户端程序,但是当我试图连接我碰到下面的信息。WebSphere管理工具

也许我缺少一些库(我在记事本创建我的应用程序)。

at TryConnection1.main(TryConnection1.java:37) Caused by: java.lang.ClassNotFoundException: com.ibm.websphere.security.auth.WSL oginFailedException 
    at java.net.URLClassLoader$1.run(Unknown Source) 
    at java.net.URLClassLoader$1.run(Unknown Source) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.net.URLClassLoader.findClass(Unknown Source) 
    at java.lang.ClassLoader.loadClass(Unknown Source) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) 
    at java.lang.ClassLoader.loadClass(Unknown Source) 
    ... 1 more 

我的代码:

import java.util.Properties; 
import javax.management.MalformedObjectNameException; 
import javax.management.ObjectName; 

import javax.management.*; 
import com.ibm.websphere.management.*; 
import com.ibm.websphere.management.AdminClient; 
import com.ibm.websphere.management.AdminClientFactory; 
import com.ibm.websphere.management.exception.*; 

import com.ibm.websphere.management.exception.ConnectorException; 

public class TryConnection1 { 

    /** * @param args */ 

    public static void main(String[] args) { 

    Properties connectProps = new Properties(); 
    connectProps.setProperty(AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_SOAP); 

    connectProps.setProperty(AdminClient.CONNECTOR_HOST, "hostgoeshere"); 
    connectProps.setProperty(AdminClient.CONNECTOR_PORT, "portgoeshere"); 
    connectProps.setProperty(AdminClient.USERNAME, "usernamegoeshere"); 
    connectProps.setProperty(AdminClient.PASSWORD, "passgoeshere"); 

    AdminClient adminClient = null; 
    try { 
     adminClient = AdminClientFactory.createAdminClient(connectProps); 
    } catch(ConnectorException e) { 
     System.out.println("Exception creating admin client: " + e); } 
    } 
} 

回答

1

尝试添加$ WEBSPHERE_HOME /应用服务器/运行时/ com.ibm.ws.admin.client_8。 5.0.jar或类似的,如果你使用不同的WebSphere版本的话,你的类路径。这是WebSphere Admin Client所需的jar。

0

你应该尝试添加:

import com.ibm.websphere.security.auth.*;