Application Exception 999 running Phone Demo

X-Application Version: 4.1.1
Tamino Version : 4.1.4
Platform : Win2k
WebContainer : Tomcat 4.1.18
JDK Version : 1.3.1_07

Use the phone demo/test files from the Tamino directory “…/documentation/examples/phone”, create the Schema using “TelephoneSchema.tsd” and load the data “Telephone.xml” via the Tamino Schema Editor.

Now generate and run using X-Application. Notice the generated initial screen doesn’t show any input fields. When I click on the “create” hyperlink or “search” button I get the following message:

“Exception id: 999
Exception Type: ApplicationException
Stacktrace:


XException: id = 999
com.softwareag.xtools.xapplication.common.AssertionFailed
ambiguous element: Telephone
at com.softwareag.xtools.xapplication.schema.Schema.lookupElementEverywhere(Schema.java:462)
at com.softwareag.xtools.xapplication.businessdocument.SchemaSet.lookup(SchemaSet.java:82)
at com.softwareag.xtools.xapplication.businessdocument.BusinessDocumentWorkspace.getSchema(BusinessDocumentWorkspace.java:589)
at com.softwareag.xtools.xapplication.businessdocument.BusinessDocumentWorkspace.getSchema(BusinessDocumentWorkspace.java:577)
at com.softwareag.xtools.xapplication.businessdocument.BusinessDocumentWorkspace.processQuery(BusinessDocumentWorkspace.java:557)
at com.softwareag.xtools.xapplication.businessdocument.BusinessDocumentWorkspace.xquery(BusinessDocumentWorkspace.java:196)
at com.softwareag.xtools.xapplication.plugin.StandardWorkspacePlugin.xqueryDocuments(StandardWorkspacePlugin.java:424)
at java.lang.reflect.Method.invoke(Native Method)
at com.softwareag.xtools.xapplication.plugin.Action.invoke(Action.java:147)
at com.softwareag.xtools.xapplication.plugin.Dispatcher.execute(Dispatcher.java:153)
at com.softwareag.xtools.xapplication.jsp.SessionContext.processWorkspaceAction(SessionContext.java:376)
at com.softwareag.xtools.xapplication.jsp.taglib.ModuleTag.processDocumentAction(ModuleTag.java:291)
at com.softwareag.xtools.xapplication.jsp.taglib.ModuleTag.doStartTagCore(ModuleTag.java:95)
at com.softwareag.xtools.xapplication.jsp.JspTag.doStartTag(JspTag.java:132)
at org.apache.jsp.browse_jsp._jspx_meth_xapp_module_0(browse_jsp.java:107)
at org.apache.jsp.browse_jsp._jspService(browse_jsp.java:85)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
at java.lang.Thread.run(Thread.java:479)”

Hello,

I had a look at the telephone example and the telephone.tsd file. This schema is not supported by X-Application due to the element definition of ‘telephone’.

There are two definitions ‘telephone’: One to define the root element (doctype) of the documents, another one is nested within the element definition of ‘Address’.

If you edit the existing tsd file and rename the second definition of ‘telephone’ in ‘phone’. Then, this problem would be solved and the generator could produce a running application.

If you just want to try out X-Application and its generator, my propose is to use another example. That will be easier than handle the problem with duplicate element definitions.

However, if you want to use X-Application in context with schemas containing duplicate element definitions, we could give you support for manual adaptations of the generated JSPs. The workaround in this case would be to abandon the schema support of X-Application.

Hope, that responds your question and helps you to proceed with X-Application.

Bye,
Christian.

Hi Christian.

You were right about the embedded element “Telephone”. After removing it, the exception no longer occurs.

The other problem still exists; can you take a look at that? Its where the generated application when it first comes up should show all the elements/attributes of the Schema as input fields. What I get is no fields, just two “Search” buttons. Also, clicking on “Create” doesn’t show any fields either, just a long string of text.

I can send you the Schema and data if required.

Thanks.

KJ

Hello,

please send me your schema and the test data. I will try to reproduce the problem on my PC.

Many thanks.

Bye,
Christian.

Hello,

Thanks for the schema / data file you sent me directly via mail. I have recognized that you renamed the second definition of ‘Telephone’ into ‘Telephone_Number’. I used your modified schema to create an application with X-Application’s generator.

I had the same effect as you described within your post:


  • The search page does not contain any search field.
  • The create page contains add / remove for the content elements of the root element and contains also the links to switch between the alternatives of the entry, but there is no input field.


So, I could reproduce the problem.

The reason for this problem is the definition of the content fields. All element definition (EntryId, LoginName, …) look like this:

  <xs:complexType mixed = "true"></xs:complexType>



The option ‘mixed’ means, that the content of an element could be a mixture of normal text and child elements defined for this complex type. However, the complex type is empty and there are no children the text could be mixed with.

For the generator does not consider this situation. It does not generate an input field for an empty complex type with option mixed=‘true’.

I fixed this problem within the java class ‘StructureBuilder.java’ that is attached to this post. Please, follow the instructions below to add the fix to your X-Application:


  • Extract the attached zip file into the directory where you extracted the X-Application zip file. In this way, the existing java source file will be replaced.
  • Open a console and change to the directory
    …\xapplication_411
  • Invoke the command ‘build quick’
  • Shut down Tomcat if necessary
  • Invoke the command ‘build1 generator’
  • Start Tomcat
  • Generate your application again:
    - Don’t define the schema just enter for
    Schema → Name : ‘TelephoneSchema’
    Schema → Doctype : ‘Telephone’
    and click the ‘Generate’ Button.


Hope, it the fix will work also on your maschine.

Bye,
Christian.
empty_mixed_20030731.zip (3.65 KB)

Hi Christian.

Thanks for the fix, it worked! The Search page now successfully generates and displays elements/attributes from the Schema.

I did notice a couple of cosmetic issues and it would be useful to understand these.

First, did you notice that the Search page shows ‘Choice n’ against each generated field. This might be appropriate for certain cases but is there an easy way to turn this off?

Secondly, if you click on the Search button I get the first 10 documents displayed but with no information other than the document number or ino:id. Clicking on one of these correctly retrieves the document contents but also a whole bunch of unnecessary tags. Again, can this be switch off? I’ve attached a picture of this.

Thanks again,

KJ

Hello,

Yes, you can make individual adaptations for each application to change the default output of the generator. Have a look into the directory of your generated application. There you will find a file ‘structure.xml’. It contains the fields and headings to be displayed on each page. By changing its entries and regenerating the application, you can adapt the content of the JSPs.

There is a chapter within the documentation about the structure file.

Generator - Customization > Customizing the Structure File

For example:
To get rid of the choice output

choice 0:

...

choice 1:
</pre><BR><BR>just remove the choice tag of around the element tag within the section 'search'<BR><BR><pre class="ip-ubbcode-code-pre">
<search>
  <!-- remove the choice tags within this section -->
  ...
</search>
</pre><BR><BR>To modify the content of  the browse page adapt the elements of the section <BR><BR><pre class="ip-ubbcode-code-pre">
<browse>
  <!-- add the fields to be displayed for each browse entry -->
</browse>



Then, enter the directory / schema / doctype of the existing application and use the regenerate option of the generator.

Bye,
Christian.