cancel
Showing results for 
Search instead for 
Did you mean: 

Jco Integration issue, no bean named managedConnectionContainer

Former Member
0 Kudos

Hi,

I'm trying to integrate sapjco, I followed the guide:

https://help.hybris.com/6.2.0/hcd/8c4c8fb68669101498abeb351b4a7f5e.html

I have a custom addon where I implemented the rfc call, but when I try to inject JCoManagedConnectionContainer :

 @Resource
 private JCoManagedConnectionContainer managedConnectionContainer;

I get a "no bean named managedconnectioncontainer defined".

In my custom addon I have the sapcorejco required extension in extensioninfo.xml:

 <requires-extension name="sapcorejco"/>

In sapcorejco-spring.xml is defined the bean, I already tried to overwrite that bean definition in myaddon-spring.xml but it didnt work

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello, and Are you sure that managedConnectionContainer bean exists?

I think the bean that you need is "sapCoreManagedConnectionContainer" Check sapcorejco-spring.xml

 <alias alias="sapCoreManagedConnectionContainer" name="sapCoreDefaultManagedConnectionContainer" />
     <bean
         class="de.hybris.platform.sap.core.jco.connection.impl.DefaultJCoManagedConnectionContainer"
         id="sapCoreDefaultManagedConnectionContainer" scope="sapSession"
         destroy-method="destroy">
         <property name="managedConnectionFactory" ref="sapCoreJCoManagedConnectionFactory" />
     </bean>

bye

Former Member
0 Kudos

Hello Pablo thanks, actually you right, in sapcorejco-spring.xml 'managedConnectionContainer' bean doesn't exist , so I tryied to name my resource like that:

Former Member
0 Kudos

@Resource private JCoManagedConnectionContainer sapCoreManagedConnectionContainer;

After that the server doesn't startup: Error initializing global application context!... BeanCreationException: Error creating bean name 'mycustomserviceclass' : injection of resource dependencies failed; nested exception is java.lang.NullPointerException...

The only connection between mycustomaddon and sajcorejco is requires-extension name="sapcorejco" I don't know if its enought,

Former Member
0 Kudos

Hi , requires-extension name="sapcorejco" is ok, but the problem is the bean definition of mycustomserviceclass.

Check the bean properties and setters in java file.
But, if you use @Resource in some attribute you mustn't define this attribute in bean configuration (xml file).

If you don't find the way, try to inject sapCoreManagedConnectionContainer without @Resource, with setter and in the bean:

 <property name="sapCoreManagedConnectionContainer" ref="sapCoreManagedConnectionContainer" />
Former Member
0 Kudos

Hi Pablo thanks I've already tried your suggestion:

 private JCoManagedConnectionContainer managedConnectionContainer;

...

 setManagedConnectionContainer(final JCoManagedConnectionContainer managedConnectionContainer) 
 {
          this.managedConnectionContainer = managedConnectionContainer;
  }

And in spring xml:

 <bean id="italikaReplicationController"
         class="de.hybris.platform.italika.controller.ItalikaReplicationController">
 <property name="managedConnectionContainer" ref="sapCoreManagedConnectionContainer" />  
     </bean>

But I still have the same creation bean excetion, nullpointer

Former Member
0 Kudos

I recommend you to call JCO from a service, not from a controller, and setManagedConnectionContainer must be "public".

For more help I need logs.

Answers (3)

Answers (3)

Former Member
0 Kudos

You can use sapCoreJCoManagedConnectionFactory bean instead of connectionContainer.

 JCoConnection managedConnection = sapCoreJCoManagedConnectionFactory.getManagedConnection("JCoStateless", "Hybris");

Former Member
0 Kudos

I am getting the same issue. Did you managed to find solution for this issue?

Former Member
0 Kudos

Dear Leonardo, Can you please give below three required extensions

 <requires-extension name="sapcorebol"/> 
   <requires-extension name="sapmodel"/> 
   <requires-extension name="sapcoreconfiguration"/>
Former Member
0 Kudos

Hi , I tried it, Null Pointer exception occurs every way.