org.apache.webbeans.exception.WebBeansException.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中org.apache.webbeans.exception.WebBeansException.<init>()方法的一些代码示例,展示了WebBeansException.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebBeansException.<init>()方法的具体详情如下:
包路径:org.apache.webbeans.exception.WebBeansException
类名称:WebBeansException
方法名:<init>

WebBeansException.<init>介绍

暂无

代码示例

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl

@Override
  public T create(CreationalContext<T> context)
  {
    throw new WebBeansException("You must not create an Interceptor instance of a self-intercepted bean!");
  }
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-jms

/**
 * Gets jms related object.
 * @param jmsComponent jms bean
 * @param intf injection point class
 * @return proxy object
 */
public static Object createNewJmsProxy(JmsBean<?> jmsComponent, Class<?> intf)
{
  try
  {
    Class<?>[] interfaces = {Closable.class, Serializable.class, intf};
    //X TODO do we still need this?
    throw new WebBeansException("Support got temporarily removed while moving from Javassist to ASM");
  }
  catch (Exception e)
  {
    throw new WebBeansException(e);
  }
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-openejb

public GeronimoResourceInjectionService(WebBeansContext webBeansContext) {
  try {
    this.context = new InitialContext();
    this.webBeansContext = webBeansContext;
  } catch (NamingException e) {
    throw new WebBeansException("could not set up naming context", e);
  }
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-jms

public static void clearConnections()
{
  try
  {
    connectionFactory = null;
    for (Connection connection : connections.values())
    {
      connection.close();
    }
    connections = null;
    dests.clear();
    dests = null;
  }
  catch (Exception e)
  {
    throw new WebBeansException(e);
  }
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl

@Override
public void error(SAXParseException exception) throws SAXException
{
  logger.log(Level.SEVERE, exception.getMessage(), exception.getCause());
  throw new WebBeansException(exception);
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl

@Override
public void fatalError(SAXParseException exception) throws SAXException
{
  logger.log(Level.SEVERE, exception.getMessage(), exception.getCause());
  throw new WebBeansException(exception);
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-openejb

@Override
public <X, T extends Annotation> X getResourceReference(ResourceReference<X, T> resourceReference) {
  String jndiName = resourceReference.getJndiName();
  Class<X> type = resourceReference.getResourceType();
  try {
    return type.cast(context.lookup(jndiName));
  } catch (NamingException e) {
    throw new WebBeansException("Could not get resource of type " + type + " at jndi name " + jndiName, e);
  }
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl

@SuppressWarnings("unchecked")
public static <T> T lookup(String name, Class<? extends T> expectedClass) throws WebBeansException
{
  Asserts.assertNotNull(name, "name");
  try
  {
    return (T) new InitialContext().lookup(name);
  }
  catch (NamingException e)
  {
    LOGGER.log(Level.SEVERE, e.getMessage(), e);
    throw new WebBeansException(WebBeansLoggerFacade.getTokenString(OWBLogConst.EXCEPT_0010) + name, e);
  }
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl

private Object get(String singletonName)
{
  //Load class
  Class<?> clazz = ClassUtil.getClassFromName(singletonName);
  if (clazz == null)
  {
    throw new WebBeansException("Class not found exception in creating instance with class : " + singletonName,
        new ClassNotFoundException("Class with name: " + singletonName + " is not found in the system"));
  }
  return get(clazz);
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl

/**
 * Call method on the instance with given arguments.
 * 
 * @param method method instance
 * @param instance object instance
 * @param args arguments
 * @return the method result
 */
public static Object callInstanceMethod(Method method, Object instance, Object[] args)
{
  Asserts.nullCheckForMethod(method);
  try
  {
    if (args == null)
    {
      args = new Object[] {};
    }
    return method.invoke(instance, args);
  }
  catch (Exception e)
  {
    throw new WebBeansException("Exception occurs in the method call with method : " + method.getName() + " in class : " + instance.getClass().getName(), e);
  }
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-web

/**
 * Returns servelt context otherwise throws exception.
 * @param object object
 * @return servlet context
 */
private ServletContext getServletContext(Object object)
{
  if(object != null)
  {
    if(object instanceof ServletContextEvent)
    {
      object = ((ServletContextEvent) object).getServletContext();
      return (ServletContext)object;
    }
    else
    {
      throw new WebBeansException(WebBeansLoggerFacade.getTokenString(OWBLogConst.EXCEPT_0018));
    }
  }
  throw new IllegalArgumentException("ServletContextEvent object but found null");
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-jms

private Session createSession()
{
  Connection connection = null;
  try
  {
    connection = createOrReturnQueueOrTopicConnection();
    return connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
  }
  catch (JMSException e)
  {
    ensureConnectionClosing(connection);
    throw new WebBeansException("Unable to create jms session", e);
  }
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl

public static void unbind(String name)
{
  Asserts.assertNotNull(name, "name");
  try
  {
    new InitialContext().unbind(name);
  }
  catch (NamingException e)
  {
    LOGGER.log(Level.SEVERE, e.getMessage(), e);
    throw new WebBeansException(WebBeansLoggerFacade.getTokenString(OWBLogConst.EXCEPT_0009) + name, e);
  }
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-jms

private MessageProducer createMessageProducers()
{
  Connection connection = null;
  try
  {
    connection = createOrReturnQueueOrTopicConnection();
    return connection.createSession(false, Session.AUTO_ACKNOWLEDGE).createProducer(createOrReturnQueueOrTopic());
  }
  catch (JMSException e)
  {
    ensureConnectionClosing(connection);
    throw new WebBeansException("Unable to create jms message producer", e);
  }
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-jms

private MessageConsumer createMessageConsumers()
{
  Connection connection = null;
  try
  {
    connection = createOrReturnQueueOrTopicConnection();
    return connection.createSession(false, Session.AUTO_ACKNOWLEDGE).createConsumer(createOrReturnQueueOrTopic());
  }
  catch (JMSException e)
  {
    ensureConnectionClosing(connection);
    throw new WebBeansException("Unable to create jms message producer", e);
  }
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-tomcat7

@Override
public void attributeAdded(ServletContextAttributeEvent servletContextAttributeEvent)
{
  if (InstanceManager.class.getName().equals(servletContextAttributeEvent.getName()))
  { // used as a hook to know we can override eagerly the InstanceManager
    try
    {
      StandardContext context = (StandardContext) getContext(servletContextAttributeEvent.getServletContext());
      wrapInstanceManager(context);
    }
    catch (NoSuchFieldException e)
    {
      throw new WebBeansException(e.getMessage(), e);
    }
    catch (IllegalAccessException e)
    {
      throw new WebBeansException(e.getMessage(), e);
    }
  }
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-jms

private void close()
{
  try
  {
    if(this.jmsObject != null)
    {
      Method method = this.jmsObject.getClass().getMethod("close");
      
      if(!method.isAccessible())
      {
        jmsComponent.getWebBeansContext().getSecurityService().doPrivilegedSetAccessible(method, true);
      }
      
      method.invoke(this.jmsObject);
    }
    
  }
  catch (Exception e)
  {
    throw new WebBeansException("Unable to close JMS resources");
  }
  
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl

@Override
public T get()
{
  if (webBeansContext == null)
  {
    webBeansContext = WebBeansContext.currentInstance();
  }
  try
  {
    ResourceInjectionService resourceService = webBeansContext.getService(ResourceInjectionService.class);
    return resourceService.getResourceReference(resourceReference);
  }
  catch (Exception e)
  {
    throw new WebBeansException(e);
  }
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-impl

/**
 * Creates the instance from the constructor. Each constructor parameter
 * instance is resolved using the resolution algorithm.
 */
public T doInjection()
{
  try
  {
    if(!con.isAccessible())
    {
      getWebBeansContext().getSecurityService().doPrivilegedSetAccessible(con, true);
    }
    
    instance = con.newInstance(createParameters());
    transientCreationalContext.release();
    return instance;
  }
  catch (Exception e)
  {
    throw new WebBeansException(e);
  }
}

代码示例来源:origin: org.apache.openwebbeans/openwebbeans-ejb-common

@SuppressWarnings({"unchecked"})
  public static <T> T defineEjbBeanProxy(BaseEjbBean<T> bean, Class<?> iface, CreationalContext<?> creationalContext)
  {
    try
    {
      T proxyInstance = null;            
      Class<?> clazz = JavassistProxyFactory.getInstance().getEjbBeanProxyClass(bean, iface);
      if(clazz == null)
      {
        ProxyFactory factory = new ProxyFactory();
        factory.setInterfaces(new Class[]{iface});
        clazz = JavassistProxyFactory.getInstance().defineEjbBeanProxyClass(bean, iface, factory);
      }
      
      proxyInstance = (T) ClassUtil.newInstance(clazz);
      
      EjbBeanProxyHandler handler = new EjbBeanProxyHandler(bean, creationalContext);
      ((ProxyObject)proxyInstance).setHandler(handler);
      
      return proxyInstance;
      
    }
    catch(Exception e)
    {
      throw new WebBeansException(e);
    }
  }
}

相关文章

WebBeansException类方法