Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: where to put 'applicationContext.xml' for access from SLSB+DAO (using JBoss3)

  1. #11
    Join Date
    Aug 2005
    Location
    la florida
    Posts
    66

    Default

    Thanks.. I am going to extend the AbstractStatelessSessionBean class and see where things go.

    Can I use hibernate with Spring with applicationContext.xml kept in META-INF?
    I am gonna try to...but if you know something I don't know regards using hibernate from applicationContext.xml (within the ejb-side META-INF), please howl. Begs the question...can I pretty much do the same things(other than presentation-side manipulations) on ejb-side of things with applicationContext.xml in META-INF as I am able to do with WEB-INF/applicationContext.xml

  2. #12
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    I'm not sure I understand what your connection between hibernate and the application context is in this question. But surely you can use hibernate with spring and you can do your initialization of the SessionFactory in the application context.

    From a conceptual point of view there is no difference between an application context used on the ejb layer and one used for web applications. It is realized by the same means anyway.

    Regards,
    Andreas

  3. #13
    Join Date
    Dec 2004
    Location
    London
    Posts
    51

    Default Trouble getting this to work

    Hi

    I am having a little difficulty getting the business/service pojo implementation to inject into the interface declared in the SLSB.

    I have followed the advice in the manual and this thread but am getting a null pointer exception at runtime when I make a call to the SLSB business method which attempts to access the pojo instance.

    Here is a snippet from my SLSB:
    <slsb>
    * @ejb.interface local-extends="javax.ejb.EJBLocalObject,uk.co.mycom.cbs. ejb.CBSJCTestBI" extends="javax.ejb.EJBObject"
    * @ejb.home local-extends="javax.ejb.EJBLocalHome" extends="javax.ejb.EJBHome"
    *
    * @ejb:env-entry name="ejb/BeanFactoryPath" type="java.lang.String" value="applicationContextBE.xml"
    * @ejb:bean name="CBSJCTest"
    * display-name="CBS JCTest session Bean"
    * type="Stateless"
    * transaction-type="Container"
    * view-type="both"
    * jndi-name="ejb/cbs/Remote/CBSJCTest"
    * local-jndi-name="ejb/cbs/CBSJCTest"
    * @ejb.permission unchecked="True"
    * @ejb:transaction type="Required"
    *
    */
    public abstract class CBSJCTestEJB extends AbstractStatelessSessionBean implements
    CBSJCTestBI{

    CBSJCTestBI bizPojo;

    protected void onEjbCreate() throws CreateException {
    bizPojo = (CBSJCTestBI) getBeanFactory().getBean("testBizPojo");
    }

    /**
    * @ejb:interface-method view-type="both"
    */
    public String testGetSomething() throws BasicException {
    return bizPojo.testGetSomething(); //"test string returned from ejb!";
    }
    </slsb>

    And my applicationContextBE.xml:

    <quote>
    <bean id="testBizPojo" class="uk.co.mycom.cbs.ejb.JCTestPojo" singleton="false"/>
    </quote>

    I have put my applicationContextBE.xml file in the cbs-ejb.jar root. The ejb jar file is deployed as part of an ear file (not sure if that would affect things).

    The exception stack trace is as follows:
    16:23:13,393 INFO [Server] JBoss (MX MicroKernel) [3.2.6 (build: CVSTag=JBoss_3_2_6 date=200410140106)] Started in 1m:8s:953
    ms
    16:23:24,518 WARN [SessionImpl] unclosed connection
    16:23:33,299 INFO [TilesRequestProcessor] Tiles definition factory found for request processor ''.
    16:23:33,424 INFO [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.bean.LocalStrings ', returnNull=t
    rue
    16:23:33,471 INFO [PropertyMessageResources] Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
    16:23:33,471 INFO [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.html.LocalStrings ', returnNull=t
    rue
    16:23:33,471 INFO [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.html.LocalStrings ', returnNull=t
    rue
    16:23:35,487 INFO [PropertyMessageResources] Initializing, config='org.apache.struts.actions.LocalStrings', returnNull=true
    16:23:35,549 ERROR [LogInterceptor] RuntimeException in method: public abstract java.lang.String uk.co.mycom.cbs.ejb.CBSJC
    TestLocal.testGetSomething() throws uk.co.mycom.cbs.common.BasicException
    java.lang.NullPointerException
    at uk.co.mycom.cbs.ejb.CBSJCTestEJB.testGetSomething( CBSJCTestEJB.java:52)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.jboss.ejb.StatelessSessionContainer$ContainerI nterceptor.invoke(StatelessSessionContainer.java:6 83)
    at org.jboss.resource.connectionmanager.CachedConnect ionInterceptor.invoke(CachedConnectionInterceptor. java:186)
    at org.jboss.ejb.plugins.StatelessSessionInstanceInte rceptor.invoke(StatelessSessionInstanceInterceptor .java:72)
    at org.jboss.ejb.plugins.AbstractTxInterceptor.invoke Next(AbstractTxInterceptor.java:84)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTran sactions(TxInterceptorCMT.java:315)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxIn terceptorCMT.java:148)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(S ecurityInterceptor.java:111)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInt erceptor.java:191)
    at org.jboss.ejb.plugins.ProxyFactoryFinderIntercepto r.invoke(ProxyFactoryFinderInterceptor.java:122)
    at org.jboss.ejb.StatelessSessionContainer.internalIn voke(StatelessSessionContainer.java:331)
    at org.jboss.ejb.Container.invoke(Container.java:709)
    at org.jboss.ejb.plugins.local.BaseLocalProxyFactory. invoke(BaseLocalProxyFactory.java:419)
    at org.jboss.ejb.plugins.local.StatelessSessionProxy. invoke(StatelessSessionProxy.java:83)
    at $Proxy125.testGetSomething(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)

    Any help is much appreciated.

    Jim

  4. #14
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    At first glance I see no problem here. However, I'm noticing that you use XDoclet. I remember a similar case where by using XDoclet somehow an empty ejbCreate()-Method has been created. This, in fact, overrides the method provided by Spring, which causes your onEjbCreateMethod() to never being invoked.

    Maybe you can check this out?

    Regards,
    Andreas

  5. #15
    Join Date
    Dec 2004
    Location
    London
    Posts
    51

    Thumbs up

    A thousand 'thank-you's! That fixed my problem.

    For anyone else experiencing the same problem here's the original post of the 'similar case' Andreas is referring to:

    http://forum.springframework.org/sho...eate+XDocl et

    (Not too sure, tho', where the ejbCreate method is being generated because it doesn't appear to be in either of my EJB implementation classes.

    Jim

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •