EclipseLink 1.0 & Spring 2.5 - Exception entity extending @MappedSuperclass

Hi All
I'm attempting to leverage EclipseLink in combination with Spring 2.5 using J2SE (via Jetty server). I've adapted the petclinic/eclipselink sample found at http://blog.springsource.com/main/2008/07/17/using-eclipselink-on-the-springsource-application-platform .
I'm getting an exception with an entity object that extends a superclass marked with @MappedSuperclass.
The superclasses provide the name and id attributes respectively. The entity that is failing, does not actually introduce any additional attributes (id/name are sufficient for it).
Anyway, I have an extremely cutdown version of the petclinic project with just the domain objects and a business interface at the following location that can quickly reproduce the error. (33k in size) http://rapidshare.com/files/136814768/petclinic_oracle.zip
The zip file contains a maven2 project - so all the dependencies should download automatically - assuming one has maven2 configured.
It is configured to work with an Oracle Database. The readme file in the zip contains 4 simple steps to try the thing out.
I would be greateful if anyone can take a quick look and see if they can work out what is at fault - spring configuration or eclipselink.
Here is the exception:-
2008-08-13 02:36:28.633::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
2008-08-13 02:36:29.743::INFO:  jetty-6.1.12rc1
2008-08-13 02:36:29.024::INFO:  No Transaction manager found - if your webapp requires one, please configure one.
2008-08-13 02:36:29.587:/:INFO:  Initializing Spring root WebApplicationContext
2008-08-13 02:36:31.040::WARN:  Failed startup of context org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@1d1082f{/,C:\Documents and Settings\Administrator\Desktop\petclinic on oracle db\target\petclinic-1.0-SNAPSHOT}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in ServletContext resource [/WEB-INF/applicationContext-persistence.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext-persistence.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 1.0 (Build 1.0 - 20080707)): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [PetClinic] failed.
Internal Exception: Exception [EclipseLink-7161] (Eclipse Persistence Services - 1.0 (Build 1.0 - 20080707)): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Entity class [class org.springframework.petclinic.domain.PetType] has no primary key specified. It should define either an @Id, @EmbeddedId or an @IdClass. If you have defined PK using any of these annotations then please make sure that you do not have mixed access-type (both fields and properties annotated) in your entity class hierarchy.
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
     at java.security.AccessController.doPrivileged(Native Method)
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
     at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:881)
     at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:597)
     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:366)
     at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
     at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
     at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
     at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:547)
     at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
     at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1233)
     at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:516)
     at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:459)
     at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:110)
     at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:42)
     at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
     at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
     at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:42)
     at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
     at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:42)
     at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
     at org.mortbay.jetty.Server.doStart(Server.java:222)
     at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:42)
     at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
     at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:371)
     at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:307)
     at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:203)
     at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
     at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
     at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
     at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:512)
     at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:482)
     at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
     at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
     at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
     at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:585)
     at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
     at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
     at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
     at org.codehaus.classworlds.Launcher.main(Launcher.java:375)cheers
Matt.

Hello,
This could be related to bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=240679 which is fixed in the 1.0.1 and 1.1 streams.
Can you try using the latest build?
Best Regard,
Chris

Similar Messages

  • ToyStore Unexpected exception / Entity Level validation check question.

    Hi,
    JDev 10..1.2
    I'm using the ToyStore Exception/Error handler.
    I added an Entity level validation test by adding following test in the validateEntity method of my entity:
    protected void validateEntity()
    super.validateEntity();
    if (this.getAccountStatus() != null && this.getAccountStatus().compareTo(Constants.NUMBER_20) < 0)
    throw new JboException(ErrorMessages.class,"14000",null);
    In the ErrorMessages class I added following line to the message array:
    { "14000", "Entity validation ERROR" }
    I would have expected to see this error in the "global error section" but the exception was handled as a "unexpected exception" and was shown in the stack trace but not in the generated page.
    Could you please tell me how to write an entity level validation error in the validateEntity method so that it gets displayed in the global error section?
    I succesfully added attribute level validation and it gets displayed at the attribute level.
    Here's the stack trace, notice that the message is retrieved from my ErrorMessages.class:
    05/08/10 11:28:03 com.photoswing.webview.actions.AccountCreateAction.reportErrors userLocale: English (United States)
    oracle.jbo.JboException: Entity validation ERROR
         at com.photoswing.model.site.AccountTestImpl.validateEntity(AccountTestImpl.java:83)
         at oracle.jbo.server.EntityImpl.validate(EntityImpl.java:1506)
         at oracle.jbo.server.DBTransactionImpl.validate(DBTransactionImpl.java:3944)
         at oracle.adf.model.bc4j.DCJboDataControl.validate(DCJboDataControl.java:958)
         at oracle.adf.model.binding.DCBindingContainer.validateInputValues(DCBindingContainer.java:1681)
         at oracle.adf.controller.lifecycle.PageLifecycle.validateModelUpdates(PageLifecycle.java:465)
         at oracle.adf.controller.struts.actions.DataAction.validateModelUpdates(DataAction.java:328)
         at oracle.adf.controller.struts.actions.DataAction.validateModelUpdates(DataAction.java:519)
         at oracle.adf.controller.lifecycle.PageLifecycle.handleLifecycle(PageLifecycle.java:115)
         at oracle.adf.controller.struts.actions.DataAction.handleLifecycle(DataAction.java:223)
         at com.photoswing.webview.actions.BaseDataForwardAction.handleLifecycle(BaseDataForwardAction.java:209)
         at oracle.adf.controller.struts.actions.DataAction.execute(DataAction.java:155)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1485)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:527)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:768)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
         at com.photoswing.filter.LocaleFilter.doFilter(LocaleFilter.java:191)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:235)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:600)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
    Thanks
    Fred

    More info:
    If I write:
    <html-el:errors/>
    I get all the errors displayed.
    My purpose is to display the attribute level errors next is to each attribute and the Entity level errors at the top.
    So at the top I wrote:
    <html:errors property="<%= ActionErrors.GLOBAL_ERROR %>"/>
    I added following trace:
    At the beginning of the processException method:
    System.out.println(getClass().getName()+".processException, ex: "+ex.toString()+", ex.getClass().getName(): "+ex.getClass().getName());
    In the if block:
    if (attrName == null) {
    String errorCode = jboex.getErrorCode();
    globalErrs.add(jboex.getLocalizedMessage(locale));
    System.out.println("attrName == null, errorCode: "+errorCode+", jboex.getLocalizedMessage(locale): "+jboex.getLocalizedMessage(locale));
    My trace:
    05/08/10 12:19:44 com.photoswing.webview.actions.AccountCreateAction.processException, ex: oracle.jbo.RowValException: Failed to validate a row with key null of type WebAccountAM.AccountTestView1, ex.getClass().getName(): oracle.jbo.RowValException
    05/08/10 12:19:44 com.photoswing.webview.actions.AccountCreateAction.processException, ex: oracle.jbo.JboException: Entity validation ERROR, ex.getClass().getName(): oracle.jbo.JboException
    05/08/10 12:19:44 attrName == null, errorCode: 14000, jboex.getLocalizedMessage(locale): Entity validation ERROR
    Remark:
    AccountId => pk, not mandatory,refresh after insert => sequence fetched in pre-insert trigger
    Thanks
    Fred

  • Exception: Entity must be managed to call remove

    hello guys, I'm still here. I have another problem with toplink and jpa.
    I have the following method:
    +private void eliminaCliente(Evento evento) {+
    + Cliente cliente = this.finestraCliente.getCliente();+
    + ClienteFacade facade = new ClienteFacade();+
    + try {+
    + facade.getEm().getTransaction().begin();+
    + facade.getEm().merge(cliente);+
    + facade.getEm().remove(cliente);+
    + facade.getEm().flush();+
    + } catch(PersistenceException e) {+
    + String messaggio;+
    + if(e.getCause() instanceof ConstraintViolationException) { // vincolo di integrit&agrave; violato+
    + messaggio = "Impossibile completare l'operazione a causa della violazione di un vincolo di integrit&agrave;:\n---&gt; ";+
    + messaggio += e.getCause().getCause().getMessage();+
    + } else // errore generico+
    + messaggio = e.getMessage();+
    + apriFinestraMessaggio(evento, e.getMessage());+
    + } finally {+
    + facade.getEm().close();+
    + }+
    + }+
    Its duty is to get an entity from the gui, and remove it. The problem is that on the line in wich I call the remove method, it generate this exception:
    java.lang.IllegalArgumentException: Entity must be managed to call remove: Abba Pino, try merging the detached and try the remove again.
    why?

    The call to merge will return a managed instance that you can use in your remove call.
    private void eliminaCliente(Evento evento) {
            Cliente cliente = this.finestraCliente.getCliente();
            ClienteFacade facade = new ClienteFacade();
            try {
                facade.getEm().getTransaction().begin();
                Cliente managedCliente = facade.getEm().merge(cliente);
                facade.getEm().remove(managedCliente);
            ...Doug

  • Registering attribute Exception in extended VO!!!

    Hi!
    I have extended PoRequisitionLinesVO --> PoRequisitionLinesVOex
    and I need to do some checks to Attribute7 before setting it.
    I have tried to throw Exception without success.
    I am trying now to use
    this.registerAttributeException(getViewObject().getAttributeDef(ATTRIBUTE7)
    , attrValue
    , attr7exception);
    where attrValue is Object
    and attr7Exception is OAexception
    but when running with values that should go to this part of the code I get only java.lang.NullPointerException.
    I am trying with gettin xml from Puchout and validating that something in one of the elements is ok. If not I run the registerAttributeException but I get the following:
    Error
    sfe: The connection to the supplier website cannot be established.
    Click here to view additional technical details of this failure.
    And when I click to view addtional details of the failure:
    Error Code: 100 Unexpected Error
    Unexpected exception occured
    java.lang.NullPointerException
         at oracle.apps.fnd.framework.OAException.getAllMessageStackTraces(OAException.java:844)
         at oracle.apps.fnd.framework.OAException.getAllMessageStackTraces(OAException.java:847)
         at oracle.apps.fnd.framework.OAException.getAllMessageStackTraces(OAException.java:847)
         at oracle.apps.icx.por.common.server.ErrorUtil.handleFatalException(ErrorUtil.java:636)
         at oracle.apps.icx.por.req.server.RequisitionAMImpl.createReqLine(RequisitionAMImpl.java:324)
         at oracle.apps.icx.por.req.server.AddToCartSvrCmd.execute(AddToCartSvrCmd.java:135)
         at oracle.apps.icx.punchout.server.PunchoutAMImpl.addToCart(PunchoutAMImpl.java:1232)
         at oracle.apps.icx.punchout.server.PunchoutAMImpl.populateItemsAndAddToCart(PunchoutAMImpl.java:1102)
         at oracle.apps.icx.punchout.server.PunchoutAMImpl.handleShoppingCart(PunchoutAMImpl.java:935)
         at oracle.apps.icx.punchout.server.PunchoutAMImpl.performCallback(PunchoutAMImpl.java:722)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:190)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:707)
         at oracle.apps.icx.por.common.webui.ClientUtil.invokeMethod(ClientUtil.java:964)
         at oracle.apps.icx.por.common.webui.PorBaseCOImpl.invokeMethod(PorBaseCOImpl.java:194)
         at oracle.apps.icx.punchout.webui.PunchoutCallbackCO.performCallback(PunchoutCallbackCO.java:422)
         at oracle.apps.icx.punchout.webui.PunchoutCallbackCO.processRequest(PunchoutCallbackCO.java:89)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:587)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1136)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:959)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:926)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:646)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:959)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:926)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:646)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353)
         at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2335)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1734)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:508)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:429)
         at oa_html._OA._jspService(_OA.java:85)
         at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
         at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417)
         at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267)
         at oracle.jsp.JspServlet.internalService(JspServlet.java:186)
         at oracle.jsp.JspServlet.service(JspServlet.java:156)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
         at oracle.jsp.provider.Jsp20RequestDispatcher.forward(Jsp20RequestDispatcher.java:162)
         at oracle.jsp.runtime.OraclePageContext.forward(OraclePageContext.java:187)
         at oa_html._OA._jspService(_OA.java:95)
         at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
         at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417)
         at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267)
         at oracle.jsp.JspServlet.internalService(JspServlet.java:186)
         at oracle.jsp.JspServlet.service(JspServlet.java:156)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
         at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456)
         at org.apache.jserv.JServConnection.run(JServConnection.java:294)
         at java.lang.Thread.run(Thread.java:534)
    My code is working fine when the data is ok in the Attribute.
    Please, some advice!
    //Patricia

    Patricia ,
    Seeing at your 2 threads, I will advice u to read Devlopers guide properly, you will get solution for all scenarios.For any error message, you need to write code in CO.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Exception in extended class does not raise

    I have extended a seeded class and raised an exception in the extended class.
    Exception is raised if i modify seeded class. If i extend the class and then raise the exception it is not working.
    Any pointers.

    Is the code reaching the extended class and is the exception condition being met ??
    Thanks
    Tapash

  • EclipseLink JPA 2: Missing Descriptor

    Hi All,
    I have a SessionBean that, when initialized, also initializes a LookupJpaController class. Here is the code for LookupJpaController:
    public class LookupJpaController {
    private static final String _QueryGetLookupForUI =
    "SELECT l "
    + "FROM lookup l "
    + "WHERE l.lookup_type = :LookupType "
    + "AND lookup_domain = :Domain";
    public List<SelectItem> getLookupForUI(enumLookupType lookupType, String domain) throws Exception {
    if (domain == null || domain.trim().equals(""))
    throw new Exception("Parameter domain cannot be null or empty.");
    else if (!this.isInitialized())
    throw new Exception("Entity Manager not set.");
    Query query = this._EM.createNativeQuery(_QueryGetLookupForUI, Lookup.class);
    query.setParameter("LookupType", lookupType.toString());
    query.setParameter("Domain", domain.trim());
    List<SelectItem> selectItems = null;
    List<Lookup> lookupList = (List<Lookup>) query.getResultList();
    if (lookupList == null || lookupList.size() < 1)
    return null;
    else {
    selectItems = new ArrayList<SelectItem>(lookupList.size());
    for (Lookup lookUp : lookupList) {
    selectItems.add(new SelectItem(lookUp.getLookupValue(), lookUp.getLookupName()));
    return selectItems;
    When LookupJpaController is called with the following parameters ("Global", "Compound/Project Code"), it fails with the following exception:
    Caused by: Exception [EclipseLink-6007] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.QueryException
    Exception Description: Missing descriptor for [class Novartis.OTM.Data.Db.Entities.Lookup].
    Query: ReadAllQuery(referenceClass=Lookup sql="SELECT l FROM lookup l WHERE l.lookup_type = :LookupType AND lookup_domain = :Domain")
    at org.eclipse.persistence.exceptions.QueryException.descriptorIsMissing(QueryException.java:433)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.checkDescriptor(ObjectLevelReadQuery.java:660)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.prePrepare(ObjectLevelReadQuery.java:1895)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.checkPrePrepare(ObjectLevelReadQuery.java:748)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.checkEarlyReturn(ObjectLevelReadQuery.java:681)
    at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:619)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:958)
    at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:432)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1021)
    at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2857)
    at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1225)
    at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1207)
    at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1181)
    at org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:453)
    at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getResultList(EJBQueryImpl.java:681)
    at Novartis.OTM.Data.Db.Controllers.LookupJpaController.getLookupForUI(LookupJpaController.java:92)
    at Novartis.OTM.Data.DataManager.getLookupForUI(DataManager.java:59)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1056)
    at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1128)
    at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5292)
    at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:615)
    at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
    at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:567)
    at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:157)
    at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:139)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:858)
    at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:797)
    at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:367)
    at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5264)
    at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5252)
    at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:201)
    ... 81 more
    I don't understand what is going on here as my entity Lookup is there and this code also jives with Pro JPA 2.0, written by Oracle gurus. Thanks!
    Chris
    Edited by: user10773481 on Feb 11, 2011 8:37 AM
    Edited by: user10773481 on Feb 11, 2011 8:43 AM
    Edited by: user10773481 on Feb 11, 2011 12:10 PM

    Chris,
    At first glance, your code looks fine. I assume that you are injecting your (this._EM) entityManager on your session bean via the @PersistenceContext DI annotation. If so can you verify that your entity is getting processed on the predeploy of your ear. Or check the metamodel on the EM or EMF (you don't need to enable JPA 2 in persistence.xml) and see if your model is loaded there correctly.
    From your logs and the fact that you are using SVN rev# 6600 (2.0.1.v20100213-r6600) - it looks like you are using GlassFish 3.0.1.
    The following changes to your persistence.xml will enable finer logs so that you can see metadata processing and verify that your descritors are being loaded (they should be if you are running on the container - unless you are using multiple locations)
          <property name="eclipselink.logging.level" value="FINEST"/>
          <!-- enable SQL parameter binding visibility logging to override ER 329852 -->
          <property name="eclipselink.logging.parameters" value="true"/>thank you
    Michael O'Brien
    http://www.eclipselink.org

  • EJB3.0 Entity cannot get attributes of extended class

    Hi ,
    Have a very simple issue ..quite baisc one. So hopefully I"ll get an answer !
    Am using EJB3.0 with WL10.3. Like any other application , every entity has id and version column. So I decided to put these fields in EntityBase.java
    Other Entities will extend this entity .
    For EG : Entity Organisation extends EntityBase. Organisation will have only other setter/getter for attributes. Setter/Getter for id/version will be in EntityBase. Application is deployed sucessfully and I dont get any exception, But when I try to getOrganisation Entity , id and version is null. Looks like WL is not able set id and version in EntityBase.
    Am I missing something here ? How can we make an Entity extends any other class and at the same time tell the container to set/get inhertied values ? Code for EntityBase and Organisation goes something like below
    public class EntityBase implements Serializable{
         private static final long serialVersionUID = 1L;
         // ---- Entity id
         @Id     
         @GeneratedValue(strategy=GenerationType.SEQUENCE ,generator="ID_SEQ")
         @SequenceGenerator(name="ID_SEQ" ,sequenceName="OBJECT_ID_SEQ" )
         @Column(name="ID")
         private int id ;
         public int getId() {
              return this.id;
         // ---- Entity version
         @Version
         private int version ;
         public int getVersion() { return this.version; }
    Organisation.java is
    @Entity
    @Table(name="TYPED_T")
    @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
    public class Organisation extends EntityBase{
         private static final long serialVersionUID = 1L;
    ..setter/getter for other attributes
    Thanks in advance

    Hi, if you want your entity to inherit from a superclass that provides persistent entity state and mapping information, please use @MappedSuperclass.
    You can find the definition and example from EJB3.0 Spec, chapter 2.1.9.2.
    E.g.
    @MappedSuperclass
    public class Employee {
    @Id protected Integer empId;
    @Version protected Integer version;
    @ManyToOne @JoinColumn(name="ADDR")
    protected Address address;
    public Integer getEmpId() { ... }
    public void setEmpId(Integer id) { ... }
    public Address getAddress() { ... }
    public void setAddress(Address addr) { ... }
    // Default table is FTEMPLOYEE table
    @Entity
    public class FTEmployee extends Employee {
    // Inherited empId field mapped to FTEMPLOYEE.EMPID
    // Inherited version field mapped to FTEMPLOYEE.VERSION
    // Inherited address field mapped to FTEMPLOYEE.ADDR fk
    // Defaults to FTEMPLOYEE.SALARY
    protected Integer salary;
    public FTEmployee() {}
    public Integer getSalary() { ... }
    public void setSalary(Integer salary) { ... }
    Thanks,
    Amy

  • EJB Exception Layer Design Feedback

    I am in the process of creating a EJB layer talking to EIS Tier via JCA adapter. The EJBs are all stateless. The EJBs would be used by servlets, ejbs, or jsps. The EJBs are stateless in nature. I would like to make sure the exception hierarchy I have is considered good design practice and if there are suggestions on how I may improve it. I decided to go for unchecked exception all through my design (this I don't want to change -- pretty sure about this).
    So, here is how I designed my exception class. One of my goals was to keep the exception handling very simple at the client-side and not inundate customers with too many types of exceptions. I decided to go for a has-A type relationship to model much of the exceptions because I couldn’t really classify some of them to be a is-A. All exceptions thrown by my EJB layer would be contained within MyApplicationException. A getCause() will give insight into the cause at a very fine level. A getMessage() would suffice for most situations. Whereever exceptions are being thrown, the cause is being stored.
    java.lang.Exception
    --java.lang.RuntimeException
    ___ --MyBaseException
    _______+----MyApplicationException (this is the container for all my exceptions)
    _______+----MyConfigException
    I created a exceptionhelper class that handles most of the exceptions and throws the right exception depending on the cause. For brevity sake, I am not including all code details in the sample below.
    At the EIS Tier level, we have AutomationExceptions or Windows exception being thrown. These exceptions get thrown by the Windows code that is running in the EIS Tier (server). These exceptions are caught by the EJB code, then we do some processing like looking up the windows error code and producing the right message. The exception is then thrown back to the client with more information (MyApplicationException->getCause() would return AutomationException)
    In the EJB code I have something like this….
    try {
    serverConn.connectToEISTier()
    } catch (AutomatedException e) {
    throw new MyApplicationException(“Custom Message.”, ExceptionHelper.handleAutomatedException(e)); }
    At the EJB level
    •we have create, and naming exceptions thrown either on failed lookup or something failing when creating the ejbs or there might be programming errors or there might be missing resources when EJB is trying to connect and possibly encounters data retrieval failures or Some sort of configuration error might be there in the deployment descriptor (user did soemthing wrong - wrong value for environment entry). All these are caught, and converted into runtime exception namely MyApplicationException. Where classification is deemed necessary we for e.g convert then contained exception to say configexception.
    try {  
         lookup the context()
    } catch(NamingException ex){
    Cause = new myConfigException(“lookup failed because ….”);
    Throw new MyApplicationException(cause);
    At the transport level: some communication exception happened.
    At the client level:
    Client might be calling the apis wrongly and breaching the contract, or possibly supplied wrong credentials.
    Please share feedback / thoughts.

    There is an interesting article that discusses EJB Exception Layering:
    http://www-128.ibm.com/developerworks/java/library/j-ejbexcept.html
    As a rule of thumb: in every layer, create two types of exceptions that extend from the appropriate class (application exceptions and system exceptions). The next layer catches these and handles them appropriately. This way, you hide the implementation of the layers. An example where this is implemented is Spring.
    To summarize, I like your idea, but I define exceptions for every layer and not put them in one hiearchy.
    Regards,
    Lonneke

  • How to create xml entity in java?????

    public Document createXml(String Error,String src,String trg)
                 DocumentBuilderFactory docBuilderFactory = null;
                DocumentBuilder docBuilder = null;
            //    src= src.replaceAll("&","I want this ");
               //  trg= trg.replaceAll("&","Yse !!!;");
                 try {
                      docBuilderFactory = DocumentBuilderFactory.newInstance();
                      docBuilder = docBuilderFactory.newDocumentBuilder();
                      xmlDoc = docBuilder.newDocument();
                     //create the root element
                     Element errorLog = xmlDoc.createElement("errorLog");
                     //all it to the xml tree
                       xmlDoc.appendChild(errorLog);
                      Entity e1=(Entity) xmlDoc.createEntityReference("amit");
                        xmlDoc.appendChild(e1);
                       Entity e2=(Entity) xmlDoc.createEntityReference("chch");
                       xmlDoc.appendChild(e2);
                          Element error = xmlDoc.createElement("error");
                             error.setAttribute("Type",Error);
                             errorLog.appendChild(error);
                             Element source = xmlDoc.createElement("source");
                             source.appendChild(xmlDoc.createTextNode(src));
                             error.appendChild(source);
                             Element target = xmlDoc.createElement("target");
                             target.appendChild(xmlDoc.createTextNode(trg));
                             error.appendChild(target);
                 } catch (Exception ex) {
                 return xmlDoc;
            }It seem to be failing in creating entities Help plzzzzzzzzzzzzzzzzzzzzzz

    I want out put like
    <?xml version="1.0"?>
    <!ENTITY amit ' xyz'>
    <errorLog>
    <error Type="Error">
    <source> this is </source>
    <target>Yes</target>
    </error></errorLog>
    bUT iT gives rest except Entity part
    Help!!!!!!!!!!!!

  • EjbAccessException with Spring remote-slsb and wlthint3client.jar

    Hallo,
    i have a standalone application based on Spring 3.0.4. I use Spring to access
    a Stateless Session Bean (2.x) on a weblogic 10.3.1 Application server.
    Weblogic offers several options when it comes to client development.
    -> http://download.oracle.com/docs/cd/E...717/basics.htm
    I tested my application with the full client option, and using the generated wlfullclient.jar my application runs fine.
    But i prefer to use the new wlthint3client (since 10.3.3) because it is lightweight and offers all features i need. If i replace the wlfullclient.jar with the wlthint3client.jar
    i get the following exception during spring container startup:
    Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'resultEjb': Invocation of init method failed; nested exception is org.springframework.ejb.access.EjbAccessException: EJB home [ClusterableRemoteRef(8236058267066320550S:127.0.0. 1:[7001,7001,-1,-1,-1,-1,-1]:myapp:myapp-instance [8236058267066320550S:127.0.0.1:[7001,7001,-1,-1,-1,-1,-1]:myapp:myapp-instance/292])/292] has no no-arg create() method
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1420)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:519)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 91)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:288 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:563)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:425)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:139)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:83)
    at de.bdr.persotec.dataprep.ipserver.jms.TestBootstra p.startContext(TestBootstrap.java:46)
    at de.bdr.persotec.dataprep.ipserver.jms.TestBootstra p.main(TestBootstrap.java:37)
    Caused by: org.springframework.ejb.access.EjbAccessException: EJB home [ClusterableRemoteRef(8236058267066320550S:127.0.0. 1:[7001,7001,-1,-1,-1,-1,-1]:myapp:myapp-instance [8236058267066320550S:127.0.0.1:[7001,7001,-1,-1,-1,-1,-1]:myapp:myapp-instance/292])/292] has no no-arg create() method
    at org.springframework.ejb.access.AbstractSlsbInvoker Interceptor.getCreateMethod(AbstractSlsbInvokerInt erceptor.java:142)
    at org.springframework.ejb.access.AbstractRemoteSlsbI nvokerInterceptor.getCreateMethod(AbstractRemoteSl sbInvokerInterceptor.java:126)
    at org.springframework.ejb.access.AbstractSlsbInvoker Interceptor.refreshHome(AbstractSlsbInvokerInterce ptor.java:125)
    at org.springframework.ejb.access.SimpleRemoteSlsbInv okerInterceptor.refreshHome(SimpleRemoteSlsbInvoke rInterceptor.java:163)
    at org.springframework.ejb.access.AbstractSlsbInvoker Interceptor.afterPropertiesSet(AbstractSlsbInvoker Interceptor.java:109)
    at org.springframework.ejb.access.SimpleRemoteStatele ssSessionProxyFactoryBean.afterPropertiesSet(Simpl eRemoteStatelessSessionProxyFactoryBean.java:100)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1477)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1417)
    ... 13 more
    Theoretically the wlthint3client option should be backward compatible with my app server version 10.3.1 and EJB access is supported as well. Might this be an issue with the Spring code or is it weblogic related?
    Thanks for any help/clarification!

    I assume you are using wlthint3client.jar in the 10.3.3.0 release. This client is certified to run in multiple environments such as a standalone client or inside foreign app servers (e.g. JBOSS, OC4J and WAS) as WebLogic connectivity library. The behavior difference you noticed is due to "network class loading" in the rmi stack. The wlfullclient.jar will do network class loading automatically. However, the wlthint3client.jar doesn't do that and that is because when running inside foreign app server that is not desirable. For instance, WebLogic server itself doesn't support network class loading in the server side rmi stack.

  • Issue with EclipseLink "ValidationException"

    Hi folks,
    we do use EclipseLink 2.4.1 in a SE Environment.
    Sometimes when we start our application the following error occures:
    |31.07.2015 06:05:23:112|WARN|pool-7-thread-1|eclipselink|log:144| -- ServerSession(22497564)
    Local Exception Stack:
    Exception [EclipseLink-7092] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.ValidationException
    Exception Description: Cannot add a query whose types conflict with an existing query. Query To Be Added: [ReadAllQuery(name="BauplanStueckliste_findByMandantKtrAndModellAndCatiaId" referenceClass=BauplanStueckliste jpql="SELECT s FROM BauplanStueckliste s where s.mandant = :mandant AND s.kostentraeger = :kostentraeger AND s.modell like :modell AND s.catiaId = :catiaId")] is named: [BauplanStueckliste_findByMandantKtrAndModellAndCatiaId] with arguments [[class java.lang.String, class java.lang.String, class java.lang.String, int]].The existing conflicting query: [ReadAllQuery(name="BauplanStueckliste_findByMandantKtrAndModellAndCatiaId" referenceClass=BauplanStueckliste jpql="SELECT s FROM BauplanStueckliste s where s.mandant = :mandant AND s.kostentraeger = :kostentraeger AND s.modell like :modell AND s.catiaId = :catiaId")] is named: [BauplanStueckliste_findByMandantKtrAndModellAndCatiaId] with arguments: [[class java.lang.String, class java.lang.String, class java.lang.String, int]].
    at org.eclipse.persistence.exceptions.ValidationException.existingQueryTypeConflict(ValidationException.java:919)
    at org.eclipse.persistence.internal.sessions.AbstractSession.addQuery(AbstractSession.java:456)
    at org.eclipse.persistence.internal.sessions.AbstractSession.addQuery(AbstractSession.java:421)
    at org.eclipse.persistence.internal.sessions.AbstractSession.processJPAQueries(AbstractSession.java:2246)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:540)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:777)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:735)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:217)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:542)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:186)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:278)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:304)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:282)
    at de.meyerwerft.common.db.helper.PersistenceService.getEntityManager(PersistenceService.java:160)
    at de.meyerwerft.common.db.helper.PersistenceService.begin(PersistenceService.java:219)
    at de.meyerwerft.it.infotexte.DF_InfotexteImpl.holenInfotexte(DF_InfotexteImpl.java:49)
    at de.meyerwerft.ui.swing.komponenten.supportcenter.presenter.Supportcenter_dlg_Presenter$Runnable_auslesenInfotexte.run(Supportcenter_dlg_Presenter.java:513)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    |31.07.2015 06:05:23:113|WARN|pool-3-thread-1|eclipselink|log:144| -- ServerSession(22497564)
    javax.persistence.PersistenceException: Exception [EclipseLink-28019] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.EntityManagerSetupException
    Exception Description: Deployment of PersistenceUnit [pu.jlm12] failed. Close all factories for this PersistenceUnit.
    Internal Exception: Exception [EclipseLink-7092] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.ValidationException
    Exception Description: Cannot add a query whose types conflict with an existing query. Query To Be Added: [ReadAllQuery(name="BauplanStueckliste_findByMandantKtrAndModellAndCatiaId" referenceClass=BauplanStueckliste jpql="SELECT s FROM BauplanStueckliste s where s.mandant = :mandant AND s.kostentraeger = :kostentraeger AND s.modell like :modell AND s.catiaId = :catiaId")] is named: [BauplanStueckliste_findByMandantKtrAndModellAndCatiaId] with arguments [[class java.lang.String, class java.lang.String, class java.lang.String, int]].The existing conflicting query: [ReadAllQuery(name="BauplanStueckliste_findByMandantKtrAndModellAndCatiaId" referenceClass=BauplanStueckliste jpql="SELECT s FROM BauplanStueckliste s where s.mandant = :mandant AND s.kostentraeger = :kostentraeger AND s.modell like :modell AND s.catiaId = :catiaId")] is named: [BauplanStueckliste_findByMandantKtrAndModellAndCatiaId] with arguments: [[class java.lang.String, class java.lang.String, class java.lang.String, int]].
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createDeployFailedPersistenceException(EntityManagerSetupImpl.java:616)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:596)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:186)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:278)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:304)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:282)
    at de.meyerwerft.common.db.helper.PersistenceService.getEntityManager(PersistenceService.java:160)
    at de.meyerwerft.common.db.helper.PersistenceService.begin(PersistenceService.java:219)
    at de.meyerwerft.it.infotexte.DF_InfotexteImpl.holenInfotexte(DF_InfotexteImpl.java:49)
    at de.meyerwerft.ui.swing.komponenten.supportcenter.presenter.Supportcenter_dlg_Presenter$Runnable_auslesenInfotexte.run(Supportcenter_dlg_Presenter.java:513)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: Exception [EclipseLink-28019] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.EntityManagerSetupException
    Exception Description: Deployment of PersistenceUnit [pu.jlm12] failed. Close all factories for this PersistenceUnit.
    Internal Exception: Exception [EclipseLink-7092] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.ValidationException
    Exception Description: Cannot add a query whose types conflict with an existing query. Query To Be Added: [ReadAllQuery(name="BauplanStueckliste_findByMandantKtrAndModellAndCatiaId" referenceClass=BauplanStueckliste jpql="SELECT s FROM BauplanStueckliste s where s.mandant = :mandant AND s.kostentraeger = :kostentraeger AND s.modell like :modell AND s.catiaId = :catiaId")] is named: [BauplanStueckliste_findByMandantKtrAndModellAndCatiaId] with arguments [[class java.lang.String, class java.lang.String, class java.lang.String, int]].The existing conflicting query: [ReadAllQuery(name="BauplanStueckliste_findByMandantKtrAndModellAndCatiaId" referenceClass=BauplanStueckliste jpql="SELECT s FROM BauplanStueckliste s where s.mandant = :mandant AND s.kostentraeger = :kostentraeger AND s.modell like :modell AND s.catiaId = :catiaId")] is named: [BauplanStueckliste_findByMandantKtrAndModellAndCatiaId] with arguments: [[class java.lang.String, class java.lang.String, class java.lang.String, int]].
    at org.eclipse.persistence.exceptions.EntityManagerSetupException.deployFailed(EntityManagerSetupException.java:229)
    ... 13 more
    Caused by: Exception [EclipseLink-7092] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.ValidationException
    Exception Description: Cannot add a query whose types conflict with an existing query. Query To Be Added: [ReadAllQuery(name="BauplanStueckliste_findByMandantKtrAndModellAndCatiaId" referenceClass=BauplanStueckliste jpql="SELECT s FROM BauplanStueckliste s where s.mandant = :mandant AND s.kostentraeger = :kostentraeger AND s.modell like :modell AND s.catiaId = :catiaId")] is named: [BauplanStueckliste_findByMandantKtrAndModellAndCatiaId] with arguments [[class java.lang.String, class java.lang.String, class java.lang.String, int]].The existing conflicting query: [ReadAllQuery(name="BauplanStueckliste_findByMandantKtrAndModellAndCatiaId" referenceClass=BauplanStueckliste jpql="SELECT s FROM BauplanStueckliste s where s.mandant = :mandant AND s.kostentraeger = :kostentraeger AND s.modell like :modell AND s.catiaId = :catiaId")] is named: [BauplanStueckliste_findByMandantKtrAndModellAndCatiaId] with arguments: [[class java.lang.String, class java.lang.String, class java.lang.String, int]].
    at org.eclipse.persistence.exceptions.ValidationException.existingQueryTypeConflict(ValidationException.java:919)
    at org.eclipse.persistence.internal.sessions.AbstractSession.addQuery(AbstractSession.java:456)
    at org.eclipse.persistence.internal.sessions.AbstractSession.addQuery(AbstractSession.java:421)
    at org.eclipse.persistence.internal.sessions.AbstractSession.processJPAQueries(AbstractSession.java:2246)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:540)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:777)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:735)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:217)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:542)
    ... 11 more
    This error is very hard to reproduce and occures randomly... Maybe this is a bug in the implementation of EclipseLink 2.4.1 ?
    Does this error message lead to a common recipe for working around it? As in, "oh, right, when you see that error, look for a different syntactically invalid query" or something along those lines? I can tell you there are no duplicates.
    Maybe someone already faced this dilemma, and I would like to know how he/she/they solved it.
    Thanks in advance
    Reiner

    Hi,
    finally our team has solved this issue - there was a problem with our swing application and the asynchronous instatiation of the EntityManagerFactory.
    KR,
    Reiner

  • Which type of exceptions must be caught?

    Hello,
    could somebody give me a clue why some exceptions must be caught while others must not?
    i.e. java.lang.Class.getMethod() throws NoSuchMethodException...
    must be caught while
    java.lang.Integer.parseInt(String s) throws NumberFormatException
    does go by unnoticed by the compiler.
    Thanks in advance,
    Stephan

    Classes that extend Error and RuntimeException do not need to be caught. (Technically, you do not have to declare them in the throws clause or catch them in the method, but you probably do want to handle these errors somewhere, unless you are working in a J2EE container.)
    All other subclasses of Throwable must be declared in a throws clause or caught.
    Throwable (extends Object) - checked exception
    Exception (extends Throwable) - checked exception
    Error (extends Throwable) - un-checked exception
    RuntimeException (extends Exception) - un-checked exception
    - Saish

  • Raising exceptions in event handlers?

    Hi
    Is it possible to raise exceptions in event handler? As an example, I added a listener to a UnitOfWork, and implemented the preCommitUnitOfWork() method. In the method, I'm performing some operations, and if something goes wrong, I need to roll back the entire UnitOfWork. Is this possible to raison an exception, or is there some other way to acheive this?
    Thanks
    Regards
    Eric

    Hi
    Is it possible to raise exceptions in event handler? As an example, I added a listener to a UnitOfWork, and implemented the preCommitUnitOfWork() method. In the method, I'm performing some operations, and if something goes wrong, I need to roll back the entire UnitOfWork. Is this possible to raison an exception, or is there some other way to acheive this?Eric,
    I tried this and had some success with a simple test case. I created an exception that extends the oracle.toplink.exceptions.TopLinkException class. Then I added the throws clause to the preCommitUnitOfWork event handler. Throwing my custom exception (that extends TopLinkException) from the event handler works fine and should allow you to retry your update, etc. Note that as long as the exception is thrown at "preCommit" time you should not need to roll anything back as the updates were not applied to the cache or DB. Also, if you applied updates to your registered clones instead of the original objects, the original objects state should be unchanged.
    Hope this helps,
    Pete Farkas

  • Is there a way to handle custom java exception in OSB?

    For example, i created a exception that extends RuntimeException.
    My exception has a new field called "code".
    I want to handle this exception in Oracle Service Bus process and retrieve this code to throws another exception with a XML structure that includes the code.
    Is there a way to do that ?
    <con:fault xmlns:con="http://www.bea.com/wli/sb/context">
         <con:errorCode>BEA-382515</con:errorCode>
         <con:reason>Callout to java method "public static org.apache.xmlbeans.XmlObject ...</con:reason>
         <con:java-exception xmlns:con="http://www.bea.com/wli/sb/context">
             <con:java-content ref="jcid:33a6c126:14006f3df18:-7fd9"/>
         </con:java-exception>
         <con:location xmlns:con="http://www.bea.com/wli/sb/context">
             <con:node>optmusPipeline</con:node>                    
             <con:pipeline>optmusPipeline_request</con:pipeline>
             <con:stage>processStage</con:stage>
             <con:path>request-pipeline</con:path>   
         </con:location>
    </con:fault>
    it is not enough to recover the information i needed.

    Hi Sandro,
    I've got the same situation. I agree that returning xml from function is not a best choice as you have to manually check if return status is an error or not. Processing exception in error handler is better and this is how I do it:
    I am doing a java callout to a function that can throw exception. Then I add ErrorHandler to stage containing this callout (all the exception are caught here).
    In the error handler I check if $fault/ctx:java-exception is not null. If not then I pass thrown exception to my utility function that converts it to xml similar to yours:
    import org.apache.xmlbeans.XmlException;
    import org.apache.xmlbeans.XmlObject;
    public static XmlObject exceptionToXML(Throwable exception)
      throws XmlException {
      String xmlString = exceptionToString(exception);
      return XmlObject.Factory.parse(xmlString);
    public static String exceptionToString(Throwable exception) {
      String cause = "";
      if (exception.getCause() != null) {
      cause = exceptionToString(exception.getCause());
      return String
      .format("<exception><name>%s</name><description>%s</description>%s</exception>",
      exception.getClass().getName(), exception.getMessage(),
      cause);
    Calling exceptionToXML with $fault/ctx:java-exception/ctx:java-content returns:
    <exception>
         <name>pl.app.MyException</name>
         <description>Exception message</description>
    </exception>
    Then you can check the exception class (IF action: $exception/name/text() = "pl.app.MyException") and handle it accordingly.
    Good luck,
    Krzysiek

  • Problem calling Stored Procedure returning SETOF UDT (Using Spring)

    I am using Spring's StoredProcedure class to call a stored procedure from a PostgreSql database. It returns a set of user defined data types. I'm having a problem in parsing the results returned.
    The user defined data type :
    CREATE TYPE process_states AS (
    process_name text,
    process_type text
    The stored procedure returns a SET of "process_state" :
    CREATE FUNTION inquire_process_state (.....)
    RETURNS SETOF process_state AS '
    SELECT ....
    I hava a Java class extending the Spring StoredProcedure classs.
    public MyProcStats extends StoredProcedure {
    private class ProcStateCallBackHandler implements RowCallBackHandler {
    public void processRow(ResultSet rs) throws SQLException {
    System.out.println(rs.getString(1));
    public MyProcStats (DataSource ds) {
    super(ds, "inquire_process_state");
    super.setFunction(true);
    declareParameter(new SqlOutparameter("rs", Types.OTHER, new ProcStateCallBackHandler());
    declareParameter(new SqlParameter("family_name", Types.VARCHAR) ;
    While testing this class, I get an errormessage
    "java.sql.SQLException:ERROR: cannot display a value of type record"
    I would appreciate if anyone can point out my mistakes. I tried declaring
    new SqlOutParameter("rs", Types.OTHER, "process_state"), but that didn't help.

    As the related posts suggest, you will need to use direct JDBC code for this.
    Also I'm not sure JDBC supports the RECORD type, so you may need to wrap your stored functions with ones that either flatten the record out, or take OBJECT types.

Maybe you are looking for