Demo Insert using JSP

Hello!

I want to insert new document into my db tamino using JSP. I use sample java code from documentation “HTTP Client API for Java”. Compiling in jdk 1.3 and 1.4 works pretty good (javac DemoInsert.java), unfortunately I need to REWRITE this insert code into my Java Server Pages (jsp). Tomcat generated error number 500 with the following lines:

1) class com.docuverse.dom.BasicDocument is an abstract class. It can’t be instantiated.

2) class com.docuverse.dom.BasicElement is an abstract class. It can’t be instantiated (for every line which I use BasicElement class)

How can I insert new document using JSP (needed sample code!)?

Is it possible to use BasicDocument and BasicElement using command “new” in JSP?

Please help me!

Any help will be very appreciated!

Thanks a lot for support!

Best regards,
Dariusz Baumann

Hmmm this is strange because I looked at the javadoc documentation for BasicDocument and it is not abstract. The first thing that comes to mind is: is the domsdk.jar in the \yourapp\WEB-INF\lib directory the same as the one used when compiling a Java program?

If so I can only assume there must be a BasicDocument defined elsewhere that is being picked up when the JSP is being compiled. Maybe you could try Tomcat v4?

A collegue of mine managed to reproduce this little enigma and for me it works fine. I think this is something to do with Tomcat and the way it compiles things. We tried alot of different ways of building the .jsp page but always got a 500 error. If we compile the generated .jsp file outside of Tomcat it works. So the problems seems very specific to internal compilation. I am afraid we have no ideas why this could be happening. If we think of anything I will let you know, hopefully in the meantime someone will have some better ideas.

Hi Dariusz,

Well we got to the bottom of things this end and found what was causing the problem, so maybe the problem you are experiencing is very similar. In Tomcats classpath (see setEnvironment.bat or wrapper.properties if you start Tomcat as a service) the classpath is set to include xerces.jar. By removing this xerces.jar the .JSP compiles successfully. In my case I only had the default tools.jar included and this explained why things work for me.

So my advice is : check setEnvironment.bat or wrapper.properties to check what classpath is being built for starting Tomcat itself. :wink: