I'm not sure which exact forum this belongs in so I'll just put this here.

I am having some problems getting this copied web service for a system health check. The original worked for the original author. All I did was copy the files and have the imports point to the right files since they were just copies. I was thinking if this worked for the original, if I could copy the same files it can work for me as well. But everytime I start JBoss EAP 6.0.1 and put this link into my browser to access the webservice, it always gives me the error "Requested resource is not available." Can anyone help me on this?

How I'm trying to call the webservice:

http://localhost:8080/myproject/rest...plication/json

Code:

@Path("/systemcheck")
@Produces({"application/xml", "application/json", "text/xml"})
@Consumes({"application/xml", "application/json", "text/xml"})
public class SystemCheck {
private static final Logger LOGGER = LoggerFactory.getLogger(SystemCheck.class);
private static final MBeanServer MBEAN_SERVER = ManagementFactory.getPlatformMBeanServer();

@Inject
@Preferred
private HttpServletRequest request;

@Inject
private ApplicationStartup applicationStartup;

@Inject
@ApplicationConfiguration
private Configuration config;

@GET
@Path("/")
public HealthStatus getHealthCheck() {
LOGGER.debug("Request from " + HttpUtils.getClientIp(request));

final HealthStatus status = new HealthStatus();
status.setName(applicationStartup.getName());
status.setVersion(applicationStartup.getVersion()) ;
status.setBuild(applicationStartup.getBuild());
status.setRunningSince(applicationStartup.getStart upDate());

status.setJvmVersion(System.getProperty("java.vm.v ersion"));
status.setJvmRuntime(System.getProperty("java.runt ime.version"));
status.setCharacterSet(System.getProperty("file.en coding"));
status.setHostDetails(hostDetails());
setJbossDetails(status);
setConfigurationProperties(status);

LOGGER.debug("Return result to: " + HttpUtils.getClientIp(request));
return status;
}

private HostDetails hostDetails() {
final HostDetails hostDetails = new HostDetails();
hostDetails.setName(NetworkUtils.getHostname());
hostDetails.setManagementIPs(hostIPs(NetworkUtils. getNetworkInterface(NetworkUtils.MANAGEMENT)));
hostDetails.setServicesIPs(hostIPs(NetworkUtils.ge tNetworkInterface(NetworkUtils.SERVICES)));
hostDetails.setPublicIPs(hostIPs(NetworkUtils.getN etworkInterface(NetworkUtils.PUBLIC)));

return hostDetails;
}

private HostIPs hostIPs(final NetworkInterface item) {
final HostIPs hostIPs = new HostIPs();
hostIPs.setIP4(showIP(item.getIP4()));
hostIPs.setIP6(showIP(item.getIP6()));
hostIPs.setBCast(showIP(item.getBroadcastMask()));
hostIPs.setSMask(showIP(item.getSubnetMask()));
return hostIPs;
}

private String showIP(final String[] ip) {
if ((ip == null) || (ip.length == 0)) {
return "";
}
return ip[0];
}

private void setConfigurationProperties(final HealthStatus status) {
final Map<String, String> details = new HashMap<String, String>();
try {
for (final Iterator<String> iterator = config.getKeys(); iterator.hasNext();) {
final String k = iterator.next();
final String v = config.getProperty(k).toString();
details.put(k, v);
}
final String[] keys = details.keySet().toArray(new String[details.keySet().size()]);
Arrays.sort(keys);
final ArrayList<ConfigurationProperty> result = new ArrayList<ConfigurationProperty>();
for (String k : keys) {
final ConfigurationProperty configurationProperty = new ConfigurationProperty();
configurationProperty.setName(k);
configurationProperty.setValue(details.get(k));
result.add(configurationProperty);
}
status.setConfigurationProperties(result);
} catch (Exception e) {
throw new RuntimeException(e);
}
}

private void setJbossDetails(final HealthStatus status) {
try {
final ObjectName name = new ObjectName("jboss.as:management-root=server");
status.setJbossProductName(MBEAN_SERVER.getAttribu te(name, "productName").toString());
status.setJbossProductVersion(MBEAN_SERVER.getAttr ibute(name, "productVersion").toString());
status.setJbossReleaseVersion(MBEAN_SERVER.getAttr ibute(name, "releaseVersion").toString());
status.setJbossReleaseCodename(MBEAN_SERVER.getAtt ribute(name, "releaseCodename").toString());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}