cancel
Showing results for 
Search instead for 
Did you mean: 

Usage of a J2EE library project in Portal Application

Former Member
0 Kudos

Hello,

I have a Portal Component in which I use Hibernate. I had the librarys included in the lib folder of the Application and it worked fine.

Now I want to put the Hibernate related libraries in a Library Project. I created one, deployed it and set a sharing reference to it like this:

<application-config>
    <property name="PublicSharingReference" value="SAPJ2EE::library:com.myproject.hibernate"/>
  </application-config>

Anyway I get a ClassNotFound Exception all the time

[EXCEPTION]
 java.lang.NoClassDefFoundError: org/hibernate/Session 
at java.lang.Class.forName0(Native Method) 
at java.lang.Class.forName(Class.java:219) 
at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.getInstanceInternal(PortalComponentItemFacade.java:228) 
at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.getComponentInstance(PortalComponentItemFacade.java:160) 
at com.sapportals.portal.prt.core.broker.PortalComponentItem.getComponentInstance(PortalComponentItem.java:732) 
at com.sapportals.portal.prt.component.PortalComponentContext.getComponent(PortalComponentContext.java:103) 
at com.sapportals.portal.prt.component.PortalComponentContext.init(PortalComponentContext.java:242) 
at com.sapportals.portal.prt.core.broker.PortalComponentContextItem.refresh(PortalComponentContextItem.java:271) 
at com.sapportals.portal.prt.core.broker.PortalComponentContextItem.getContext(PortalComponentContextItem.java:316) 
at com.sapportals.portal.prt.component.PortalComponentRequest.getComponentContext(PortalComponentRequest.java:387) 
at com.sapportals.portal.prt.connection.PortalRequest.getRootContext(PortalRequest.java:488) 
at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:607) 
at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:235) 
at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:541) 
at java.security.AccessController.doPrivileged(Native Method) 
at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:430) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) 
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401) 
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266) 
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386) 
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364) 
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039) 
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265) 
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95) 
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175) 
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) 
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) 
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) 
at java.security.AccessController.doPrivileged(Native Method) 
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104) 
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)

When I enter a wrong name for the library in the SharingReference I get a java.lang.NoClassDefFoundError: org/hibernate/Session Exception. That shows me, that at least the reference to the library seems to be correct, but anyway my Portal Component can't use the classes at runtime. Does anybody have an idea on that?

Thanks and best regards,

Dominik

Edited by: Dominik Fried on Jun 21, 2011 6:51 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

sorry, I think I was a little bit confused yesterday.

The problem seems to be, that the jar files, which are included in the sda file are not deployed to the server. In the Visual Admin I can't see any JAR files in the field "JARs Contained" and I can't find them on the file system. Any ideas on that? They are definitly included in the sda file.

Thanks and best regards,

Dominik

Qualiture
Active Contributor
0 Kudos

Hi Dominik,

I believe the property name is SharingReference instead of PublicSharingReference

Best,

Robin

Former Member
0 Kudos

Hi Robin,

thanks for the reply. I tried both PrivateSharingReference as well as SharingReference but both didn't work. As mentioned, I assume the problem is the library itself, which seems not to be deployed properly.

Any further hint?

Thanks and best regards,

dominik

former_member182598
Active Contributor
0 Kudos

You can just quickly check the process for deploying the external library by crosscheking the steps mentioned here

I have two concerns

1. You have checked the run time check bix while adding the public part

2. You can see the library in Visual Administrator.

Thanks

Prashant

Former Member
0 Kudos

Hi Prashant,

sorry for the late reply, I was out of office for a few days.

1. I have not checked the run time box. The library is not a DC, it is just a normal Library Project. The only connection to the library project is in the portalapps.xml

2. In Visual Admin I see the project itself, but I can't see any JAR files in the field "JARs Contained"

Any further idea?

Thanks and best regards,

Dominik

Former Member
0 Kudos

Hello,

in the meantime I managed to deploy the Library project properly (at least now I can see the Jars in the field "JARs Contained" and see them on the filesystem).

However I still get a java.lang.NoClassDefFoundError.

Any further recommendations?

Best regards,

Dominik