Package javax.inject

Examples of javax.inject.CreationException


            instance = createInstance(creationalContext);

        }
        catch (RuntimeException re)
        {
            throw new CreationException(re);
        }
        catch (Exception e)
        {
            throw new WebBeansException(e);
        }
View Full Code Here


            Context context = SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext();

            NamingEnumeration<NameClassPair> persUnits = context.list("java:openejb/PersistenceUnit");
            if (persUnits == null)
            {
                throw new CreationException( "No PersistenceUnit found in java:openejb/PersistenceUnit!" );
            }

            String shortestMatch = null;
           
            while (persUnits.hasMore())
            {
                NameClassPair puNc = persUnits.next();
               
                if (puNc.getName().startsWith(unitName))
                {
                    if (shortestMatch == null || shortestMatch.length() > puNc.getName().length())
                    {
                        shortestMatch = puNc.getName();
                    }
                }
               
            }
           
            if (shortestMatch == null)
            {
                throw new CreationException("PersistenceUnit '" + unitName + "' not found");
            }
           
            factory = (EntityManagerFactory) context.lookup("java:openejb/PersistenceUnit/" + shortestMatch);
        } catch (NamingException e) {
            throw new CreationException("PersistenceUnit '" + unitName + "' not found", e );
        }
        return factory;
    }
View Full Code Here

               
                throw rt;
            }
            else
            {
                throw new CreationException(throwable);
            }
           
        }
        finally
        {
View Full Code Here

TOP

Related Classes of javax.inject.CreationException

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.