File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes Code setup to use WebSphere APIs Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "Code setup to use WebSphere APIs" Watch "Code setup to use WebSphere APIs" New topic
Author

Code setup to use WebSphere APIs

Syed Hasan
Greenhorn

Joined: Apr 09, 2004
Posts: 1
I am trying to write some code using WebSphere APIs
specifically trying to get a list of application Servers.
I believe I have not set things up correctly in WSAD as I am
getting an exception in the first line of code. Any ideas on what I
need to do to get this code to work. Thanks.

/*
* Created on Apr 9, 2004
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
/**
* @author shasan
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
import com.ibm.websphere.management.application.AppManagement;
import com.ibm.websphere.management.application.AppManagementProxy;
import com.ibm.websphere.management.application.AppConstants;
import com.ibm.websphere.management.application.AppManagementProxy;
import java.util.Vector;
import java.util.Hashtable;
import java.util.Locale;
public class CRoot {
private AppManagement appMgmt = null;

public CRoot()
{
try{
appMgmt = AppManagementProxy.getLocalProxy ();
}
catch(Throwable t)
{
System.out.println(t.getMessage());
}/*
catch(Exception e)
{
System.out.println(e.getMessage());
}*/
}

public Vector getInstalledApplications()
{
Vector appsList = null;
try
{
Hashtable prefs = new Hashtable();
prefs.put(AppConstants.APPDEPL_LOCALE, Locale.getDefault());
appsList = appMgmt.listApplications(prefs, null);
}
catch(Exception e)
{
System.out.println("Problem Admin");
}
return appsList;
}
public static void main(String [] args)
{
try
{
CRoot root = new CRoot();
System.out.println(root.getInstalledApplications().toString());
}
catch(Exception e)
{
System.out.println("Wassup" + e.getMessage());
}
}
}

Any help will be much appreciated.
Ali Hasan
 
 
subject: Code setup to use WebSphere APIs
 
Threads others viewed
HOW TO ADD LDAP ENTRIES USING JNDI?
Please help me. This is for my graduation
Null data issue
little application, but important, Please help, it is for my graduation
Problem running JMS client java program accessing Websphere 5.0 jms server
IntelliJ Java IDE