use of java.rmi.UnmarshalException in project Payara by payara.
the class EjbContainerPostHandler method handleRequest.
@Override
public boolean handleRequest(MessageContext context) {
EJBInvocation inv = null;
try {
WebServiceContractImpl wscImpl = WebServiceContractImpl.getInstance();
InvocationManager invManager = wscImpl.getInvocationManager();
inv = EJBInvocation.class.cast(invManager.getCurrentInvocation());
Method webServiceMethodInPreHandler = inv.getWebServiceMethod();
if (webServiceMethodInPreHandler != null) {
// Now that application handlers have run, do another method
// lookup and compare the results with the original one. This
// ensures that the application handlers have not changed
// the message context in any way that would impact which
// method is invoked.
Method postHandlerMethod = wsUtil.getInvMethod((com.sun.xml.rpc.spi.runtime.Tie) inv.getWebServiceTie(), context);
if (!webServiceMethodInPreHandler.equals(postHandlerMethod)) {
throw new UnmarshalException("Original method " + webServiceMethodInPreHandler + " does not match post-handler method ");
}
}
} catch (Exception e) {
wsUtil.throwSOAPFaultException(e.getMessage(), context);
}
return true;
}
use of java.rmi.UnmarshalException in project cuba by cuba-platform.
the class JmxControlBean method getManagedBeans.
@Override
public List<ManagedBeanInfo> getManagedBeans(JmxInstance instance) {
checkNotNullArgument(instance);
// noinspection UnnecessaryLocalVariable
List<ManagedBeanInfo> infos = withConnection(instance, (jmx, connection) -> {
Set<ObjectName> names = connection.queryNames(null, null);
List<ManagedBeanInfo> infoList = new ArrayList<>(names.size());
for (ObjectName name : names) {
MBeanInfo info;
try {
info = connection.getMBeanInfo(name);
} catch (UnmarshalException | InstanceNotFoundException e) {
// unable to use this bean, may be ClassNotFoundException
continue;
}
ManagedBeanInfo mbi = createManagedBeanInfo(jmx, name, info);
loadOperations(mbi, info);
infoList.add(mbi);
}
infoList.sort(new MBeanComparator());
return infoList;
});
return infos;
}
use of java.rmi.UnmarshalException in project jmxtrans by jmxtrans.
the class Query method fetchResults.
public Iterable<Result> fetchResults(MBeanServerConnection mbeanServer, ObjectName queryName) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException {
ObjectInstance oi = mbeanServer.getObjectInstance(queryName);
List<String> attributes;
if (attr.isEmpty()) {
attributes = new ArrayList<>();
MBeanInfo info = mbeanServer.getMBeanInfo(queryName);
for (MBeanAttributeInfo attrInfo : info.getAttributes()) {
attributes.add(attrInfo.getName());
}
} else {
attributes = attr;
}
try {
if (!attributes.isEmpty()) {
logger.debug("Executing queryName [{}] from query [{}]", queryName.getCanonicalName(), this);
AttributeList al = mbeanServer.getAttributes(queryName, attributes.toArray(new String[attributes.size()]));
return new JmxResultProcessor(this, oi, al.asList(), oi.getClassName(), queryName.getDomain()).getResults();
}
} catch (UnmarshalException ue) {
if ((ue.getCause() != null) && (ue.getCause() instanceof ClassNotFoundException)) {
logger.debug("Bad unmarshall, continuing. This is probably ok and due to something like this: " + "http://ehcache.org/xref/net/sf/ehcache/distribution/RMICacheManagerPeerListener.html#52", ue.getMessage());
} else {
throw ue;
}
}
return ImmutableList.of();
}
use of java.rmi.UnmarshalException in project Payara by payara.
the class WebServiceInvocationHandler method invoke.
private Object invoke(Method method, Object[] args, EjbInvocation inv) throws Exception {
try {
inv.ejbObject = this;
// find the right method object on the SIB.
if (endpoint_.getServiceEndpointInterface().equals(ejbClass_.getName())) {
// we need to substiture the method object
method = ejbClass_.getMethod(method.getName(), method.getParameterTypes());
}
inv.method = method;
inv.clientInterface = serviceEndpointIntfClass_;
inv.invocationInfo = (InvocationInfo) invocationInfoMap_.get(inv.method);
if (inv.invocationInfo == null) {
throw new EJBException("Web service Invocation Info lookup failed for method " + inv.method);
}
inv.transactionAttribute = inv.invocationInfo.txAttr;
// special handling of jaxrpc endpoints (identfied by mapping file)
if (endpoint_.getWebService().hasMappingFile()) {
if (hasHandlers_) {
// Handler performed method authorization already
} else {
final boolean authorized = container.authorize(inv);
if (!authorized) {
throw new AccessLocalException("Client not authorized to access " + inv.method);
}
}
} else if (hasHandlers_) {
// jaxws enpoint
// authorization was done in security pipe
// Now that application handlers have run, do
// another method lookup and compare the results
// with the original one. This ensures that the
// application handlers have not changed
// which method is invoked.
final Method methodBefore = inv.getWebServiceMethod();
if (methodBefore != null && !methodBefore.equals(inv.method)) {
inv.exception = new UnmarshalException(localStrings.getLocalString("enterprise.webservice.postHandlerMethodMismatch", "Original Method {0} does not match post-handler method {1}", new Object[] { methodBefore, inv.method }));
throw inv.exception;
}
}
final ComponentContext ctx = container.getContext(inv);
inv.context = ctx;
inv.ejb = ctx.getEJB();
inv.instance = inv.ejb;
container.preInvokeTx(inv);
// Enterprise Bean class doesn't necessarily implement
// web service endpoint interface, so we can't directly
// dispatch through the given method object.
final Method beanClassMethod = ejbClass_.getMethod(method.getName(), method.getParameterTypes());
inv.beanMethod = beanClassMethod;
inv.methodParams = args;
return container.intercept(inv);
} catch (NoSuchMethodException nsme) {
inv.exception = nsme;
return null;
} catch (InvocationTargetException ite) {
inv.exception = ite.getCause();
return null;
} catch (Throwable c) {
inv.exception = c;
return null;
} finally {
if (inv.ejb != null) {
// Do post invoke tx processing so that a commit failure
// will be visible to web service client.
container.postInvokeTx(inv);
}
}
}
Aggregations