cancel
Showing results for 
Search instead for 
Did you mean: 

Please anyone try to complete this EJB3 + Webdynpro tutorial (few minutes)

andre_langhorst
Employee
Employee
0 Kudos

Integrating EJB 3.0 into Web Dynpro Using the EJB Model Importer

http://help.sap.com/saphelp_nwce10/helpdata/en/45/f7f744aea471fae10000000a1553f6/content.htm

I simply cannot get this working with CE 7.1. It seems to have to do with that the model is not being created, when you set cardinality to 1..1 you see that "model must not bet null" and if you set your cardinality differently it still won't work. I also cannot get the whole model mapped into the context, just model classes.

	com.sap.tc.cm.ejb.example.model.MyModel myModel = new com.sap.tc.cm.ejb.example.model.MyModel();   

wdComponentAPI.getModelInstanceMap().putDefaultInstance("com.sap.tc.cm.ejb.example.model.MyModel", myModel);

Cheers, André

Accepted Solutions (1)

Accepted Solutions (1)

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hallo Andre,

what's the exact problem? After model import make sure, that all model node cardinalities under the "root" model node bound to the executable model class are set as 1..1. By default they are 0..1 and consequently the Web Dynpro EJB Model Runtime cannot instantiate the model object graph automatically on its own. Only with 1..1 cardinatlities this generic service (as you must not implement the model object creation and associations on your own via custom coding).

Regards, Bertram

andre_langhorst
Employee
Employee
0 Kudos

I am getting this exception, that is the problem:

[code]

java.lang.IllegalArgumentException: model object must not be null

at com.sap.tc.webdynpro.progmodel.context.ModelNodeElement.<init>(ModelNodeElement.java:63)

at com.sap.demo.wdstuds.studswdapp.comp.wdp.IPrivateStudsWDView$IRequest_StudsLocal_getStudentElement.<init>(IPrivateStudsWDView.java:397)

at com.sap.demo.wdstuds.studswdapp.comp.wdp.IPrivateStudsWDView$IContextNode.doCreateElement(IPrivateStudsWDView.java:66)

at com.sap.tc.webdynpro.progmodel.context.NodeInfo.createElement(NodeInfo.java:1064)

at com.sap.tc.webdynpro.progmodel.context.Node.createElementInternal(Node.java:1047)

... 93 more[/code]

My doinit() is

[code] //@@begin wdDoInit()

com.sap.tc.cm.ejb.example.model.MyModel myModel = new com.sap.tc.cm.ejb.example.model.MyModel();

wdComponentAPI.getModelInstanceMap().putDefaultInstance("com.sap.tc.cm.ejb.example.model.MyModel", myModel);

//@@end[/code]

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Andre,

again: the tutorial coding should be correct. For me the other given comments will not solve your problem.

Possible error reasons:

1.) You imported the model with another fully qualified name than "com.sap.tc.cm.ejb.example.model.MyModel"

- Did you really specify this package "com.sap.tc.cm.ejb.example.model" during model import? Look at your package structure again, or open the imported model in the Web Dynpro Explorer.

- Did you really name your model MyModel or perhaphs MiModel?

2.) Did you follow my previous reply: make sure that all node cardinalities for the request model nodes (bound to the executable model class and its child nodes) are set as 1..1 instead of 0..n. See http://help.sap.com/saphelp_nwce10/helpdata/en/45/f72971af4020fde10000000a1553f6/content.htm step 10.

Regards, Bertram

andre_langhorst
Employee
Employee
0 Kudos

1) package com.sap.tc.cm.ejb.example.model

name MyModel

2) Collection Cardinality 1..1

btw, in my context of StudsWDView there is only one node (Request_StudsLocal_getStudent) accessing the model directly (as in the tutorial)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Sander,

check the answer I gave in your other thread regarding the same issue.

kind regards

Stefanie

Former Member
0 Kudos

Hi Andre,

Did you manage to get an solution for your problem?

I get the same results as you got and can't get is working by using the tutorial.

regards Sander

Former Member
0 Kudos

Hi Andre,

Did you manage to get an solution for your problem?

I get the same results as you got and can't get is working by using the tutorial.

regards Ronald

0 Kudos

Hi Andre,

This seems really strange. Bertram is right - setting collection cardinality 1..1 and registering the model instance should be enough so that the model objects are created impicitly.

Please make sure that you've NOT set collection cardinality 1..1 for the relation Request-Response (this relation should be optional). Can you also check the defaultTrace file(s) on the server (under /usr/sap/<SID>/J<num>/j2ee/cluster/server0/log) for any suspisious exceptions? If any, please post them here.

Best regards,

Vesselin

andre_langhorst
Employee
Employee
0 Kudos

There is only one element in the context, this is:

Request_StudsLocal_getStudent, it has got 1..1 on collection cardinality

the response node within is set to 0..1 (I cannot edit that), if that is what you refer to as request-response relation

In the log this looks really suspicous:

References Test: There are no matching deploy time references (described in META-INF/SAP_MANIFEST.MF) for the following runtime references [sap.com/tc/cm/ejb/api, sap.com/sld, sap.com/tc/wd/api, sap.com/tc/cmi, sap.com/tc/aii/base/offline/facade, sap.com/tc/ddic/runtime/facade, sap.com/tc/graphics/igs, sap.com/tc/bl/jrfc/api, sap.com/tc/je/security/api, demo.sap.com/studsapp, sap.com/com.sap.lcr.api.cimclient, sap.com/tc/je/webservices/lib] (described in the META-INF/application-j2ee-engine.xml)., file: demo.sap.com~wdstuds.ear, column 0, line 0, severity: warning
Web Model Builder: WEB-INF/web.xml is not Java EE 5 compatible, because of this annotations will not be processed., file: demo.sap.com~wdstuds.war#WEB-INF/web.xml, column 0, line 0, severity: warning

#1.5 #00174209816500190000000A0000075C01CA0AE0CF48A8B4#1181124155008#com.sap.engine.services.jndi.implclient#demo.sap.com/wdstuds#com.sap.engine.services.jndi.implclient#Guest#0####077af680141511dcb4a0001742098165#HTTP Worker [0]##0#0#Warning##Plain###Application [demo.sap.com/wdstuds:] with prefix [] [false] performs a CREATE_SUBCONTEXT operation, thus violating the J2EE Specification v.1.3/1.4, section 5.2.4. Change operations, performed in the application namespace are not allowed!#

Regarding server exception, there are some:

<--Localization failed: ResourceBundle='com.sap.engine.services.security.exceptions.SecurityResourceBundle', ID='Handler com.sap.engine.services.jndi.NamingCallbackHandler@ea3e3c does not support a callback.  Unsupported callback! ', Arguments: []--> : Can't find resource for bundle java.util.PropertyResourceBundle, key Handler com.sap.engine.services.jndi.NamingCallbackHandler@ea3e3c does not support a callback.  Unsupported callback! 
	at com.sap.engine.services.security.remoteimpl.login.RemoteCallbackHandlerImpl.handle(RemoteCallbackHandlerImpl.java:63)

#1.5 #0017420981650019000000020000075C01CA0AE0CF48A8B4#1181124151039#com.sap.tc.styles.StyleSheetLinkProvider#demo.sap.com/wdstuds#com.sap.tc.styles.StyleSheetLinkProvider#Guest#0####077af680141511dcb4a0001742098165#HTTP Worker [0]##0#0#Warning#1#/Applications/comsaptcstylesStyleSheetLinkProvider#Java#ThemePartRootURLCalculation##Cannot calculate the theme part root URL. Most probably the LAFService that resides on the portal on the local J2EEEngine is outdated. 
[EXCEPTION]
 {0}#1#com.sap.tc.styles.LAFServiceProxyException
	at com.sap.tc.styles.LAFServiceProxy.invokeMethodOnLafService(LAFServiceProxy.java:86)
	at com.sap.tc.styles.LAFServiceProxy.isRegistered(LAFServiceProxy.java:44)

#1.5 #0017420981650019000000040000075C01CA0AE0CF48A8B4#1181124151180#com.sap.tc.styles.StyleSheetContentProvider#demo.sap.com/wdstuds#com.sap.tc.styles.StyleSheetContentProvider#Guest#0####077af680141511dcb4a0001742098165#HTTP Worker [0]##0#0#Warning#1#/Applications/comsaptcstylesStyleSheetContentProvider#Java#StyleSheetContentDelivery##LAFSerivce is not available or is on a inappropriate version 
[EXCEPTION]
 {0}#1#com.sap.tc.styles.LAFServiceProxyException
	at com.sap.tc.styles.LAFServiceProxy.invokeMethodOnLafService(LAFServiceProxy.java:86)
	at com.sap.tc.styles.LAFServiceProxy.isRegistered(LAFServiceProxy.java:44)

#1.5 #0017420981650019000000080000075C01CA0AE0CF48A8B4#1181124152852#com.sap.tc.webdynpro.serverimpl.wdc.sl.SystemLandscapeFactory#demo.sap.com/wdstuds#com.sap.tc.webdynpro.serverimpl.wdc.sl.SystemLandscapeFactory#Guest#0####077af680141511dcb4a0001742098165#HTTP Worker [0]##0#0#Warning#1#/System/UserInterface#Java###Failed to load client to connect to SLD. Please check your SLD connection settings using the Visual Admin. 
[EXCEPTION]
 {0}#1#com.sap.sldserv.exception.SldServiceRuntimeException: Getting CIMClient failed
	at com.sap.sldserv.SldApplicationService.getCimClient(SldApplicationService.java:94)
	at com.sap.tc.webdynpro.serverimpl.wdc.sl.SystemLandscapeFactory#1.5 #0017420981650019000000080000075C01CA0AE0CF48A8B4#1181124152852#com.sap.tc.webdynpro.serverimpl.wdc.sl.SystemLandscapeFactory#demo.sap.com/wdstuds#com.sap.tc.webdynpro.serverimpl.wdc.sl.SystemLandscapeFactory#Guest#0####077af680141511dcb4a0001742098165#HTTP Worker [0]##0#0#Warning#1#/System/UserInterface#Java###Failed to load client to connect to SLD. Please check your SLD connection settings using the Visual Admin. 
[EXCEPTION]
 {0}#1#com.sap.sldserv.exception.SldServiceRuntimeException: Getting CIMClient failed
	at com.sap.sldserv.SldApplicationService.getCimClient(SldApplicationService.java:94)
	at com.sap.tc.webdynpro.serverimpl.wdc.sl.SystemLandscapeFactory$1.run(SystemLandscapeFactory.java:625).run(SystemLandscapeFactory.java:625)

Former Member
0 Kudos

Hi Andre,

use

wdCotnext.node<mynodename>.<b>bind</b>(myModel);

instead of

wdComponentAPI.getModelInstanceMap().putDefaultInstance("com.sap.tc.cm.ejb.example.model.MyModel", myModel);

Regards

andre_langhorst
Employee
Employee
0 Kudos

1) I don't have a node... method corresponding to that model only those corresponding to the model classes (nodeAdress..., nodeRequest, but NOT nodeMyModel). This is in the component controller code.

2) I don't have any node ... methods in the view controller code

I tried this in wdDoinit()

MyModel m = new MyModel();

Request_StudsLocal_getStudent x = new Request_StudsLocal_getStudent(m);

wdContext.nodeRequest_StudsLocal_getStudent().bind(x);

but this results in another strange exception:

java.lang.NullPointerException

at com.sap.tc.cmiimpl.base.model.BaseGenericModelClass.retrieveTargetRoleInfo(BaseGenericModelClass.java:109)

at com.sap.tc.cmiimpl.base.model.BaseGenericModelClass.getRelatedModelObject(BaseGenericModelClass.java:399)

at com.sap.tc.cm.ejb.example.model.Request_StudsLocal_getStudent.getResponse(Request_StudsLocal_getStudent.java:33)

at com.sap.demo.wdstuds.studswdapp.comp.wdp.IPrivateStudsWDView$IResponseNode.doSupplyElements(IPrivateStudsWDView.java:559)

at com.sap.tc.webdynpro.progmodel.context.DataNode.supplyElements(DataNode.java:95)

... 86 more

Message was edited by:

Andre

monalisa_biswal
Contributor
0 Kudos

You need to bind model node to the helper class instance, not to the class locally created.

Replace the following line

Request_StudsLocal_getStudent x = new Request_StudsLocal_getStudent(m);

with <helper class> ref = new <helper class>();

andre_langhorst
Employee
Employee
0 Kudos

Thanks, but how do I find the name of the helper class?