I get Exception while displaying optional Attribute

Hi,
I am trying to display an optional Attribute but I get the folowing exception.
My schema and the jsp file is in the attached zip file.

XJspException: com.softwareag.xtools.xapplication.common.PreconditionViolation undefined attribute: ComboTur void com.softwareag.xtools.xapplication.common.XRuntimeException.(java.lang.String) void com.softwareag.xtools.xapplication.common.PreconditionViolation.(java.lang.String) void com.softwareag.xtools.xapplication.businessdocument.ElementNode.(org.eclipse.xsd.XSDElementDeclaration, org.jdom.Element, com.softwareag.xtools.xapplication.businessdocument.BusinessDocument) com.softwareag.xtools.xapplication.businessdocument.ElementNode com.softwareag.xtools.xapplication.businessdocument.BusinessDocument.getElementNode(org.jdom.Element) com.softwareag.xtools.xapplication.businessdocument.BusinessNode com.softwareag.xtools.xapplication.businessdocument.BusinessDocument.getBusinessNode(java.lang.Object) com.softwareag.xtools.xapplication.businessdocument.BusinessNode com.softwareag.xtools.xapplication.businessdocument.BusinessDocument.getRoot() com.softwareag.xtools.xapplication.businessdocument.BusinessNodePage com.softwareag.xtools.xapplication.jsp.taglib.LoopTag.createNewPage(com.softwareag.xtools.xapplication.businessdocument.BusinessDocument) int com.softwareag.xtools.xapplication.jsp.taglib.LoopTag.doStartTagCore() int com.softwareag.xtools.xapplication.jsp.JspTag.doStartTag() boolean org.apache.jsp.vCombo_jsp._jspx_meth_xapp_loop_0(javax.servlet.jsp.tagext.Tag, javax.servlet.jsp.PageContext) void org.apache.jsp.vCombo_jsp._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void org.apache.jasper.runtime.HttpJspBase.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void org.apache.jasper.servlet.JspServletWrapper.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, boolean) void org.apache.jasper.servlet.JspServlet.serviceJspFile(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.Throwable, boolean) void org.apache.jasper.servlet.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void filters.SetCharacterEncodingFilter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) void org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void org.apache.catalina.core.StandardWrapperValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.ContainerBase.invoke(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.StandardContextValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.ContainerBase.invoke(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.StandardContext.invoke(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.StandardHostValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.valves.ErrorDispatcherValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.valves.ErrorReportValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.ContainerBase.invoke(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.StandardEngineValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.ContainerBase.invoke(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.coyote.tomcat4.CoyoteAdapter.service(org.apache.coyote.Request, org.apache.coyote.Response) void org.apache.coyote.http11.Http11Processor.process(java.io.InputStream, java.io.OutputStream) void org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(org.apache.tomcat.util.net.TcpConnection, java.lang.Object) void org.apache.tomcat.util.net.TcpWorkerThread.runIt(java.lang.Object) void org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run() void java.lang.Thread.run()



X-Application Version: 4.1.1
Tamino Version : 4.1.1
Platform : Win2
WebContainer : Tamocat 4.1.1
JDK Version : 1.3.1
files.zip (2.01 KB)

I can’t see anything suspicious in your schema of jsp file …

Can you give an example document that triggers this exception?
Do you get this exception for documents you’ve just created in your application or only for “external” documents?

Michael

Software AG Germany, Darmstadt

The document is not newly created.
It already exists.
The attached xml is all the data in the schema
I get the exception while trying to view any of these documents…
I get similar exception for other schema and nodes too.
Would you want me to send those schemas too ?

Thanks
Server

Hi,

I tried to reproduce your problem but I couldn’t … Here’s what I did:
o defined your schema into Tamino and loaded the Combo.xml data you sent: ok
o generated an application for your schema: ok
o tested the generated application: ok, everything worked fine.
I viewed various documents and none of the crashed the application
o replaced the view page of the generated application with the jsp page you sent:
ok, i clicked various into various documents and none of the crashed the app.

What else could I try? What could be different in your setup?

Michael

Software AG Germany, Darmstadt

I run this java code before the start of my application.
Could this cause the problem?
I am adding the Combo schema to the SchemaSet can this be the problem?

There is also one other difference.
Since I run the following code before the application starts. I get exception saying something like double definition of documenttype Combo.
So I erased the Combo definition from xapplication.xml file.
I dont have this line in my xapplication.xml file


Many thanks
Server


comboBusinessDocument = new Vector();
fillVector(“Combo”,comboBusinessDocument,“for $x in input()/Combo return $x”);



public static void fillVector(String docType, Vector docVector, String qstr)
{
try {
BusinessDocumentWorkspace ws = new BusinessDocumentWorkspace(store);
ws.getSchemaSet().add(SchemaFactory.forTamino(tstore, “Ortopedi”, docType));
AnchorCursor docCursor = ws.xquery(docType,“Ortopedi”,qstr,100);
int counter = 0;
boolean hasNext = true;
while (hasNext) {
hasNext = docCursor.hasNextPage();
BusinessDocument docList = docCursor.getPage();
for (int i = 0; i < docList.length; i++) {
BusinessDocument doc = docList[i];
counter++;
System.out.println( docType+ ": " + doc.getNodeLocation().getId());
docVector.add(doc);
}
if (hasNext)
docCursor.nextPage();
}
} catch (StoreException e) { e.printStackTrace(); }
catch (XException e) { e.printStackTrace(); }
}
X-Application Version: 4.1.1, 3.1.3
Tamino Version : 4.1.1, 3.1
Platform : Win2k, WinXP, Solaris, Linux, …
WebContainer : Tamocat 4.1.1, Tomcat 3.3.1
JDK Version : 1.4.1, 1.3.1

That’s it! It should work if you add to your xappplication.xml.

You define the schema within a newly created workspace in your Java code.
X-Application also creates a new workspace (for every session - i.e. for every user of your application). X-Application does not use your workspace (or SchemaSet) from your Java code. Thus, if you remove the schema element from your xapplication.xml file, workspaces created by X-Applications have no schema defined.

Michael

Software AG Germany, Darmstadt

Hello Michael,
You say that the xapplication does not use schemaset of my java code.
But here is the exception I get when I add schema definition of Combo to the xapplication.xml file :

I get this exception on the browse page after my search
XJspException: com.softwareag.xtools.xapplication.common.AssertionFailed ambiguous element: Combo void com.softwareag.xtools.xapplication.common.XRuntimeException.(java.lang.String) void com.softwareag.xtools.xapplication.common.AssertionFailed.(java.lang.String) com.softwareag.xtools.xapplication.schema.Schema com.softwareag.xtools.xapplication.businessdocument.SchemaSet.lookup(java.lang.String, java.lang.String) com.softwareag.xtools.xapplication.schema.Schema com.softwareag.xtools.xapplication.businessdocument.BusinessDocumentWorkspace.getSchema(java.lang.String) com.softwareag.xtools.xapplication.schema.Schema com.softwareag.xtools.xapplication.businessdocument.BusinessDocumentWorkspace.getSchema(java.lang.String) java.lang.Object com.softwareag.xtools.xapplication.businessdocument.BusinessDocumentWorkspace.processQuery(java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, boolean) com.softwareag.xtools.xapplication.businessdocument.AnchorCursor com.softwareag.xtools.xapplication.businessdocument.BusinessDocumentWorkspace.xquery(java.lang.String, java.lang.String, java.lang.String, int) void com.softwareag.xtools.xapplication.plugin.StandardWorkspacePlugin.xqueryDocuments(com.softwareag.xtools.xapplication.businessdocument.BusinessDocumentWorkspace, java.lang.String, java.lang.String, java.lang.String, java.lang.String, com.softwareag.xtools.xapplication.plugin.VariablesHandler) java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object) java.lang.String com.softwareag.xtools.xapplication.plugin.Action.invoke(com.softwareag.xtools.xapplication.plugin.ActualArguments) java.lang.String com.softwareag.xtools.xapplication.plugin.Dispatcher.execute(java.lang.String, com.softwareag.xtools.xapplication.plugin.ActualArguments) java.lang.String com.softwareag.xtools.xapplication.jsp.SessionContext.processWorkspaceAction(java.lang.String, java.lang.String, com.softwareag.xtools.xapplication.store.NodeLocation, java.lang.String, java.lang.String, java.lang.String) void com.softwareag.xtools.xapplication.jsp.taglib.ModuleTag.processDocumentAction(java.lang.String) int com.softwareag.xtools.xapplication.jsp.taglib.ModuleTag.doStartTagCore() int hitit.HModuleTag.doStartTagCore() int com.softwareag.xtools.xapplication.jsp.JspTag.doStartTag() void org.apache.jsp.lCombo_jsp._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void org.apache.jasper.runtime.HttpJspBase.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void org.apache.jasper.servlet.JspServletWrapper.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, boolean) void org.apache.jasper.servlet.JspServlet.serviceJspFile(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.Throwable, boolean) void org.apache.jasper.servlet.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void filters.SetCharacterEncodingFilter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) void org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void org.apache.catalina.core.StandardWrapperValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.ContainerBase.invoke(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.StandardContextValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.ContainerBase.invoke(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.StandardContext.invoke(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.StandardHostValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.valves.ErrorDispatcherValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.valves.ErrorReportValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.ContainerBase.invoke(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.StandardEngineValve.invoke(org.apache.catalina.Request, org.apache.catalina.Response, org.apache.catalina.ValveContext) void org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.StandardPipeline.invoke(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.catalina.core.ContainerBase.invoke(org.apache.catalina.Request, org.apache.catalina.Response) void org.apache.coyote.tomcat4.CoyoteAdapter.service(org.apache.coyote.Request, org.apache.coyote.Response) void org.apache.coyote.http11.Http11Processor.process(java.io.InputStream, java.io.OutputStream) void org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(org.apache.tomcat.util.net.TcpConnection, java.lang.Object) void org.apache.tomcat.util.net.TcpWorkerThread.runIt(java.lang.Object) void org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run() void java.lang.Thread.run()
X-Application Version: 4.1.1, 3.1.3
Tamino Version : 4.1.1, 3.1
Platform : Win2k, WinXP, Solaris, Linux, …
WebContainer : Tamocat 4.1.1, Tomcat 3.3.1
JDK Version : 1.4.1, 1.3.1

Uff, where do you execute your java code? I thought it’s executed independent from the JSP page, but your exception looks as if it’s executed on the jsp page …

Michael

Software AG Germany, Darmstadt

Hello,
My java code doesnt run on the jsp page.
I have a java class named Hitit
This Hitit class has a static code block which runs once only at the first access to this class.
The code is in this static code block.
The first access to this class is from the index.jsp of my application.

I’m running out of ideas … the behavior of your apps is not what I’d expect.

What happens if you remove the schema-adding from your Java code? And keep the tag in xapplication.xml …

Michael

Software AG Germany, Darmstadt

Hello,
I removed the schema-adding from my Java code but I still get the same exception
(XJspException: com.softwareag.xtools.xapplication.common.AssertionFailed ambiguous element: Combo void com.softwareag.xtools.xapplication.common.XRuntimeException.(java.lang.String) void com.softwareag.xtools.xapplication.common.AssertionFailed.(java.lang.String) )

Whereelse can the schema be added to the Schemaset except xapplication.xml?

Thanks
Server
X-Application Version: 4.1.1, 3.1.3
Tamino Version : 4.1.1, 3.1
Platform : Win2k, WinXP, Solaris, Linux, …
WebContainer : Tamocat 4.1.1, Tomcat 3.3.1
JDK Version : 1.4.1, 1.3.1

Hello,

according to the error message

XJspException: com.softwareag.xtools.xapplication.common.AssertionFailed ambiguous element: Combo 
</pre><BR><BR>I guess you are using more than one schema and there are at least two schemas which contain element declarations for 'Combo'.<BR><BR>In this case you can not load the two schemas because this is a limitation of X-Application: Declarations must be unique even if they are located in different schemas.<BR><BR>A possible workaround is to abandon loading of one of these schemas and to work schemaless with documents of the schema.<BR><BR>Therefore, I was going to the beginning of your problem: the page vCombo.jsp with the optional attribute. To avoid the exception at this place, you could use the following construct.<BR><BR><pre class="ip-ubbcode-code-pre">
<xapp:if select="./@ComboTur">
  <xapp:display select="@ComboTur" />
</xapp:if>
</pre><BR><BR>Independing of working schemabased or schemaless this is necessary for X-Application 4.1.1: nodes must exist if their value is required for a display tag.<BR><BR>However, this is not the reason for your problem. It is the loop tag that requires a schema since it works with BusinessNodes.<BR><BR>Alternatively for a schemaless approach you should use the 'forEach' tag. Try out the following form<BR><BR><pre class="ip-ubbcode-code-pre">
<xapp:forEach select="/Combo/Deger" targetbase="/Combo/Deger">
  ... content of the existing loop tag ...
</xapp:forEach>



I hope, the schemaless approach helps you.

Bye,
Christian.