Package org.jboss.resource

Examples of org.jboss.resource.JBossResourceException


/*     */       }
/* 312 */       this.con.close();
/*     */     }
/*     */     catch (JMSException e)
/*     */     {
/* 316 */       throw new JBossResourceException("Could not properly close the session and connection", e);
/*     */     }
/*     */   }
View Full Code Here


/* 693 */           if (trace)
/* 694 */             log.trace("Using a non-XA TopicConnection.  It will not be able to participate in a Global UOW");
/*     */         }
/*     */         else
/*     */         {
/* 698 */           throw new JBossResourceException("Connection was not recognizable: " + this.con);
/*     */         }
/* 700 */         if (trace)
/* 701 */           log.trace("xaTopicSession=" + this.xaTopicSession + ", topicSession=" + this.topicSession);
/*     */       }
/* 703 */       else if (this.info.getType() == 1)
/*     */       {
/* 705 */         String jndi = adapter.getQueueFactoryRef();
/* 706 */         if (jndi == null)
/* 707 */           throw new IllegalStateException("No configured 'QueueFactoryRef' on the jms provider " + this.mcf.getJmsProviderAdapterJNDI());
/* 708 */         Object factory = context.lookup(jndi);
/* 709 */         this.con = ConnectionFactoryHelper.createQueueConnection(factory, this.user, this.pwd);
/* 710 */         if (this.info.getClientID() != null)
/* 711 */           this.con.setClientID(this.info.getClientID());
/* 712 */         this.con.setExceptionListener(this);
/* 713 */         if (trace) {
/* 714 */           log.debug("created connection: " + this.con);
/*     */         }
/* 716 */         if ((this.con instanceof XAQueueConnection))
/*     */         {
/* 718 */           this.xaQueueSession = ((XAQueueConnection)this.con).createXAQueueSession();
/*     */
/* 720 */           this.queueSession = this.xaQueueSession.getQueueSession();
/* 721 */           this.xaTransacted = true;
/*     */         }
/* 723 */         else if ((this.con instanceof QueueConnection))
/*     */         {
/* 725 */           this.queueSession = ((QueueConnection)this.con).createQueueSession(transacted, ack);
/*     */
/* 727 */           if (trace)
/* 728 */             log.trace("Using a non-XA QueueConnection.  It will not be able to participate in a Global UOW");
/*     */         }
/*     */         else
/*     */         {
/* 732 */           throw new JBossResourceException("Connection was not reconizable: " + this.con);
/*     */         }
/* 734 */         if (trace)
/* 735 */           log.trace("xaQueueSession=" + this.xaQueueSession + ", queueSession=" + this.queueSession);
/*     */       }
/*     */       else
/*     */       {
/* 739 */         String jndi = adapter.getFactoryRef();
/* 740 */         if (jndi == null)
/* 741 */           throw new IllegalStateException("No configured 'FactoryRef' on the jms provider " + this.mcf.getJmsProviderAdapterJNDI());
/* 742 */         Object factory = context.lookup(jndi);
/* 743 */         this.con = ConnectionFactoryHelper.createConnection(factory, this.user, this.pwd);
/* 744 */         if (this.info.getClientID() != null)
/* 745 */           this.con.setClientID(this.info.getClientID());
/* 746 */         this.con.setExceptionListener(this);
/* 747 */         if (trace) {
/* 748 */           log.trace("created connection: " + this.con);
/*     */         }
/* 750 */         if ((this.con instanceof XAConnection))
/*     */         {
/* 752 */           this.xaSession = ((XAConnection)this.con).createXASession();
/*     */
/* 754 */           this.session = this.xaSession.getSession();
/* 755 */           this.xaTransacted = true;
/*     */         }
/*     */         else
/*     */         {
/* 759 */           this.session = this.con.createSession(transacted, ack);
/* 760 */           if (trace) {
/* 761 */             log.trace("Using a non-XA Connection.  It will not be able to participate in a Global UOW");
/*     */           }
/*     */         }
/*     */
/* 765 */         if (trace) {
/* 766 */           log.debug("xaSession=" + this.xaQueueSession + ", Session=" + this.session);
/*     */         }
/*     */       }
/* 769 */       if (trace)
/* 770 */         log.debug("transacted=" + transacted + ", ack=" + ack);
/*     */     }
/*     */     catch (NamingException e)
/*     */     {
/* 774 */       throw new JBossResourceException("Unable to setup connection", e);
/*     */     }
/*     */     catch (JMSException e)
/*     */     {
/* 778 */       throw new JBossResourceException("Unable to setup connection", e);
/*     */     }
/*     */   }
View Full Code Here

/*     */   private XADataSource createXaDataSource(Properties xaProps)
/*     */     throws JBossResourceException
/*     */   {
/* 146 */     if (getXADataSourceClass() == null)
/*     */     {
/* 148 */       throw new JBossResourceException("No XADataSourceClass supplied!");
/*     */     }
/*     */     XADataSource xads;
/*     */     try
/*     */     {
/* 154 */       clazz = Thread.currentThread().getContextClassLoader().loadClass(getXADataSourceClass());
/* 155 */       xads = (XADataSource)clazz.newInstance();
/* 156 */       NOCLASSES = new Class[0];
/* 157 */       for (i = xaProps.keySet().iterator(); i.hasNext(); )
/*     */       {
/* 159 */         String name = (String)i.next();
/* 160 */         String value = xaProps.getProperty(name);
/*     */
/* 166 */         Class type = null;
/*     */         try
/*     */         {
/* 169 */           Method getter = clazz.getMethod("get" + name, NOCLASSES);
/* 170 */           type = getter.getReturnType();
/*     */         }
/*     */         catch (NoSuchMethodException e)
/*     */         {
/* 174 */           type = String.class;
/*     */         }
/*     */
/* 177 */         Method setter = clazz.getMethod("set" + name, new Class[] { type });
/* 178 */         PropertyEditor editor = PropertyEditorManager.findEditor(type);
/* 179 */         if (editor == null)
/*     */         {
/* 181 */           throw new JBossResourceException("No property editor found for type: " + type);
/*     */         }
/* 183 */         editor.setAsText(value);
/* 184 */         setter.invoke(xads, new Object[] { editor.getValue() });
/*     */       }
/*     */     }
/*     */     catch (ClassNotFoundException cnfe)
/*     */     {
/*     */       Class clazz;
/*     */       Class[] NOCLASSES;
/*     */       Iterator i;
/* 190 */       throw new JBossResourceException("Class not found for XADataSource " + getXADataSourceClass(), cnfe);
/*     */     }
/*     */     catch (InstantiationException ie)
/*     */     {
/* 194 */       throw new JBossResourceException("Could not create an XADataSource: ", ie);
/*     */     }
/*     */     catch (IllegalAccessException iae)
/*     */     {
/* 198 */       throw new JBossResourceException("Could not set a property: ", iae);
/*     */     }
/*     */     catch (IllegalArgumentException iae)
/*     */     {
/* 203 */       throw new JBossResourceException("Could not set a property: ", iae);
/*     */     }
/*     */     catch (InvocationTargetException ite)
/*     */     {
/* 208 */       throw new JBossResourceException("Could not invoke setter on XADataSource: ", ite);
/*     */     }
/*     */     catch (NoSuchMethodException nsme)
/*     */     {
/* 212 */       throw new JBossResourceException("Could not find accessor on XADataSource: ", nsme);
/*     */     }
/*     */
/* 215 */     return xads;
/*     */   }
View Full Code Here

/*     */       {
/* 369 */         this.xaProps.load(is);
/*     */       }
/*     */       catch (IOException ioe)
/*     */       {
/* 373 */         throw new JBossResourceException("Could not load connection properties", ioe);
/*     */       }
/*     */     }
/* 376 */     initSelector();
/*     */   }
View Full Code Here

/* 424 */         this.xadsSelector.failedUrlObject(xaData);
/*     */       }
/*     */
/*     */     }
/*     */
/* 429 */     throw new JBossResourceException("Could not create connection using any of the URLs: " + this.xadsSelector.getAllUrlObjects());
/*     */   }
View Full Code Here

/*     */
/* 447 */       return newXAManagedConnection(props, xaConnection);
/*     */     }
/*     */     catch (Exception e) {
/*     */     }
/* 451 */     throw new JBossResourceException("Could not create connection", e);
/*     */   }
View Full Code Here

/* 522 */       return xada.xads;
/*     */     }
/* 524 */     if (this.xads == null)
/*     */     {
/* 526 */       if (this.xaDataSourceClass == null)
/* 527 */         throw new JBossResourceException("No XADataSourceClass supplied!");
/*     */       try
/*     */       {
/* 530 */         clazz = Thread.currentThread().getContextClassLoader().loadClass(this.xaDataSourceClass);
/* 531 */         this.xads = ((XADataSource)clazz.newInstance());
/* 532 */         NOCLASSES = new Class[0];
/* 533 */         for (i = this.xaProps.keySet().iterator(); i.hasNext(); )
/*     */         {
/* 535 */           String name = (String)i.next();
/* 536 */           String value = this.xaProps.getProperty(name);
/*     */
/* 542 */           Class type = null;
/*     */           try
/*     */           {
/* 545 */             Method getter = clazz.getMethod("get" + name, NOCLASSES);
/* 546 */             type = getter.getReturnType();
/*     */           }
/*     */           catch (NoSuchMethodException e)
/*     */           {
/* 550 */             type = String.class;
/*     */           }
/*     */
/* 553 */           Method setter = clazz.getMethod("set" + name, new Class[] { type });
/* 554 */           PropertyEditor editor = PropertyEditorManager.findEditor(type);
/* 555 */           if (editor == null)
/* 556 */             throw new JBossResourceException("No property editor found for type: " + type);
/* 557 */           editor.setAsText(value);
/* 558 */           setter.invoke(this.xads, new Object[] { editor.getValue() });
/*     */         }
/*     */       }
/*     */       catch (ClassNotFoundException cnfe)
/*     */       {
/*     */         Class clazz;
/*     */         Class[] NOCLASSES;
/*     */         Iterator i;
/* 563 */         throw new JBossResourceException("Class not found for XADataSource " + this.xaDataSourceClass, cnfe);
/*     */       }
/*     */       catch (InstantiationException ie)
/*     */       {
/* 567 */         throw new JBossResourceException("Could not create an XADataSource: ", ie);
/*     */       }
/*     */       catch (IllegalAccessException iae)
/*     */       {
/* 571 */         throw new JBossResourceException("Could not set a property: ", iae);
/*     */       }
/*     */       catch (IllegalArgumentException iae)
/*     */       {
/* 575 */         throw new JBossResourceException("Could not set a property: ", iae);
/*     */       }
/*     */       catch (InvocationTargetException ite)
/*     */       {
/* 579 */         throw new JBossResourceException("Could not invoke setter on XADataSource: ", ite);
/*     */       }
/*     */       catch (NoSuchMethodException nsme)
/*     */       {
/* 583 */         throw new JBossResourceException("Could not find accessor on XADataSource: ", nsme);
/*     */       }
/*     */     }
/* 586 */     return this.xads;
/*     */   }
View Full Code Here

/*     */         {
/*  92 */           checkException(e);
/*     */         }
/*     */       }
/*     */       else
/*  96 */         throw new JBossResourceException("Trying to begin a nested local tx");
/*     */     }
/*     */   }
View Full Code Here

/*     */   }
/*     */
/*     */   public void associateConnection(Object handle) throws ResourceException
/*     */   {
/* 184 */     if (!(handle instanceof WrappedConnection))
/* 185 */       throw new JBossResourceException("Wrong kind of connection handle to associate" + handle);
/* 186 */     ((WrappedConnection)handle).setManagedConnection(this);
/* 187 */     synchronized (this.handles)
/*     */     {
/* 189 */       this.handles.add(handle);
/*     */     }
View Full Code Here

/*     */   private void checkIdentity(Subject subject, ConnectionRequestInfo cri) throws ResourceException
/*     */   {
/* 472 */     Properties newProps = this.mcf.getConnectionProperties(subject, cri);
/* 473 */     if (!this.props.equals(newProps))
/*     */     {
/* 475 */       throw new JBossResourceException("Wrong credentials passed to getConnection!");
/*     */     }
/*     */   }
View Full Code Here

TOP

Related Classes of org.jboss.resource.JBossResourceException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.