Re: forwarding JDOM-Objects

2006-01-16 Thread Christian Stalp

Im still hanging on this problem:

The calling servlet receives data from the web-interface and builds a 
JDOM-object call mydoc. Then I build a ServletContext-object and put the 
JDOM-object into it:


ServletContext con = this.getServletContext();
   con.setAttribute("jdom_object",mydoc);
   // Und das Datenbank-Servlet aufgerufen
   RequestDispatcher rq = 
con.getRequestDispatcher("/DBAccessor/datenbankeingabe");


So far everthing works fine, at least doesn't creat an exception!

The called servlet receives this JDOM-object from the ServletContext:

import org.jdom.*;
.
...

Document mydoc = (Document) 
this.getServletContext().getAttribute("jdom_object");

and this seems to be okay.
But if I put this mydoc into a Tamino XML-Object:

TXMLObject tobj = TXMLObject.newInstance ( mydoc );

I get this dump:

java.lang.NullPointerException

com.softwareag.tamino.db.api.objectModel.TXMLObjectFactory.newXMLObject(Unknown 
Source)
com.softwareag.tamino.db.api.objectModel.TXMLObject.newInstance(Unknown 
Source)
DatenbankEingabe.doGet(DatenbankEingabe.java:28)
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

BUT, when I do this in just one servlet ( creating a JDOM-object and put 
it into this Tamino-Object ) it works!!!


Where ist the problem?

Thank you.

Gruss Christian

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: forwarding JDOM-Objects

2006-01-13 Thread Christian Stalp

David Delbecq schrieb:


Your class in not available for your servlet.
Check in you war that com/softwareag/tamino/db/api/accessor/TInsertException 
is either in WEB-INF/classes, either in a .jar in WEB-INF/lib 



 

Mercy, this was really the problem. After I copied all .jar-files I need 
into the lib-folder I only get this error:


java.lang.NullPointerException

com.softwareag.tamino.db.api.objectModel.TXMLObjectFactory.newXMLObject(Unknown 
Source)
com.softwareag.tamino.db.api.objectModel.TXMLObject.newInstance(Unknown 
Source)
DatenbankEingabe.doGet(DatenbankEingabe.java:29)
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


But why, a NullPointerException ? The servlet gets now all it need and 
the XMLObject is part of TaminoAPI4J.jar! I have no clue, what is the 
cause of this exception.


Gruss Christian


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: forwarding JDOM-Objects

2006-01-13 Thread David Delbecq
Your class in not available for your servlet.
Check in you war that com/softwareag/tamino/db/api/accessor/TInsertException 
is either in WEB-INF/classes, either in a .jar in WEB-INF/lib 


Le Vendredi 13 Janvier 2006 15:44, Christian Stalp a écrit :
> So I wrote this servlet, it gets a JDOM-object from another servlet and 
> returns with a another attribute.
> 
> Document mydoc = (Document) 
> this.getServletContext().getAttribute("jdom_object");
> 
> TXMLObject tobj = TXMLObject.newInstance ( mydoc);
> ServletContext sercon = this.getServletContext();
> String giveback = "Tamino_returnvalue";
> try {
> TConnection connection = 
> TConnectionFactory.getInstance().newConnection( 
> "http://localhost/tamino/chris"; );
> TXMLObjectAccessor xmlObjectAccessor = 
> connection.newXMLObjectAccessor(
> TAccessLocation.newInstance( "test1" ),
> TJDOMObjectModel.getInstance() );
> TResponse myret = xmlObjectAccessor.insert( tobj );
> connection.close();
> sercon.setAttribute( giveback , myret );
> } catch ( TConnectionException te ) { te.getCause(); } 
>   catch ( TInsertException ie ) { ie.toString(); };
> 
> But something doesn't fit. Because I got this dump:
> 
> javax.servlet.ServletException: Error instantiating servlet class 
DatenbankEingabe
>   
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>   
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>   
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
>   
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
>   
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>   
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>   
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> 
>   java.lang.Thread.run(Unknown Source)
> 
> 
> *root cause*
> 
> java.lang.NoClassDefFoundError: 
com/softwareag/tamino/db/api/accessor/TInsertException
>   java.lang.Class.getDeclaredConstructors0(Native Method)
>   java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
>   java.lang.Class.getConstructor0(Unknown Source)
>   java.lang.Class.newInstance0(Unknown Source)
>   java.lang.Class.newInstance(Unknown Source)
>   
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>   
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>   
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
>   
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
>   
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>   
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>   
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> 
> Is this caused by the single thread? I wortk with Eclipse, and this has no 
problem finding a class. Hmmm but maybe tomcat.
> Anyway I send this mail away.
> 
> Gruss Christian
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

-- 
David Delbecq
Royal Meteorological Institute of Belgium

-
Pingouins dans les champs, hiver méchant

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: forwarding JDOM-Objects

2006-01-13 Thread Christian Stalp
So I wrote this servlet, it gets a JDOM-object from another servlet and 
returns with a another attribute.


Document mydoc = (Document) 
this.getServletContext().getAttribute("jdom_object");


   TXMLObject tobj = TXMLObject.newInstance ( mydoc);
   ServletContext sercon = this.getServletContext();
   String giveback = "Tamino_returnvalue";
   try {
   TConnection connection = 
TConnectionFactory.getInstance().newConnection( 
"http://localhost/tamino/chris"; );
   TXMLObjectAccessor xmlObjectAccessor = 
connection.newXMLObjectAccessor(

   TAccessLocation.newInstance( "test1" ),
   TJDOMObjectModel.getInstance() );
   TResponse myret = xmlObjectAccessor.insert( tobj );
   connection.close();
   sercon.setAttribute( giveback , myret );
   } catch ( TConnectionException te ) { te.getCause(); } 
 catch ( TInsertException ie ) { ie.toString(); };


But something doesn't fit. Because I got this dump:

javax.servlet.ServletException: Error instantiating servlet class 
DatenbankEingabe

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)

org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)

org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)

org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)

org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)

org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)

java.lang.Thread.run(Unknown Source)


*root cause*

java.lang.NoClassDefFoundError: 
com/softwareag/tamino/db/api/accessor/TInsertException
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
java.lang.Class.getConstructor0(Unknown Source)
java.lang.Class.newInstance0(Unknown Source)
java.lang.Class.newInstance(Unknown Source)

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)

org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)

org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)

org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)

org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)

org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)

Is this caused by the single thread? I wortk with Eclipse, and this has no 
problem finding a class. Hmmm but maybe tomcat.
Anyway I send this mail away.

Gruss Christian



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: forwarding JDOM-Objects

2006-01-09 Thread Sriram Narayanan
On 1/9/06, Christian Stalp <[EMAIL PROTECTED]> wrote:
> Hello again, sorry for my late answer to this thread.
>
> I desided to forward the JDOM-Object via tge servelt-context.
> This solution wrote me Frode Halvorsen of the jdom-interest mailling list.
>
> He wrote:
>
> >Hello.
> >
> >Why don't you put it as an attribute to the servletcontext. Since both
> > revlets runs in the same container, they both have access to the same
> > servlet-context, and can exchange objects there ?
> >
> >the sending one :
> >Document o = new Document();
> >this.getServletContext().setAttribute("jdom_object",o);
> >
> >
> >the recieving one :
> >
> >Document o = (Document) this.getServletContext().getAttribute("jdom_object);
> >
> >Frode Halvorsen
>
>
> My only question now is, after I wrote this object, somewhere any
> servelt on that container can access on to it, how I can call the other
> servlet to start and process? With an URL?
>

I'm jumping into your thread without reading previous messages on this thread.

I think you want on servlet to create and set a JDom object that
another servlet should be able to use. Further, you want the other
servlet to get activated once this servlet has set the object into the
session.

You could call the other servlet explicitly with a RequestDispatcher.forward().

-- Sriram

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: forwarding JDOM-Objects

2006-01-09 Thread Christian Stalp

Hello again, sorry for my late answer to this thread.

I desided to forward the JDOM-Object via tge servelt-context.
This solution wrote me Frode Halvorsen of the jdom-interest mailling list.

He wrote:


Hello.

Why don't you put it as an attribute to the servletcontext. Since both
revlets runs in the same container, they both have access to the same
servlet-context, and can exchange objects there ?

the sending one :
Document o = new Document();
this.getServletContext().setAttribute("jdom_object",o);


the recieving one :

Document o = (Document) this.getServletContext().getAttribute("jdom_object);

Frode Halvorsen



My only question now is, after I wrote this object, somewhere any 
servelt on that container can access on to it, how I can call the other 
servlet to start and process? With an URL?


Gruss Christian


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: forwarding JDOM-Objects

2006-01-06 Thread Duan, Nick
By type casting I mean:

Document mydoc = (Document) req.getAttribute("yourobjname");

Viel Glueck!

ND

-Original Message-
From: Christian Stalp [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 06, 2006 11:16 AM
To: Tomcat Users List
Subject: Re: forwarding JDOM-Objects

Duan, Nick schrieb:

>Don't forget type casting the object.
>
>  
>
String mystring = req.getAttribute("Object").toString();
Document mydoc = mystring.?

Casting from String to JDOM doesn't work!!!
So which way you prefer?

Thank you...

Gruss Christian


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: forwarding JDOM-Objects

2006-01-06 Thread Giuseppe Briotti
> ==
> Date: Fri, 06 Jan 2006 17:15:45 +0100
> From: Christian Stalp <[EMAIL PROTECTED]>
> To: Tomcat Users List 
> Subject: Re: forwarding JDOM-Objects
> ==
> 
> Duan, Nick schrieb:
> 
> >Don't forget type casting the object.
> >
> >
> >
> String mystring = req.getAttribute("Object").toString();
> Document mydoc = mystring.?
> 
> Casting from String to JDOM doesn't work!!!
> So which way you prefer?
> 
> Thank you...
> 
> Gruss Christian

I'm not sure... but I remember that it is possible to build
a JDOM document from a stream... 

G.

--

Giuseppe Briotti
[EMAIL PROTECTED]

"Alme Sol, curru nitido diem qui 
promis et celas aliusque et idem 
nasceris, possis nihil urbe Roma 
visere maius."
(Orazio)





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: forwarding JDOM-Objects

2006-01-06 Thread Christian Stalp

Len Popp schrieb:


What type of object is the "Object" attribute supposed to be? If you
have a Document, you can do
   req.setAttribute("Object", mydoc);
in one servlet and
   Document mydoc = req.getAttribute("Object");
in the other.

If the "Object" attribute is a string representation of a Document,
you will have to do whatever is necessary to create a Document from
that string. (I don't know how JDOM works.)
--
 


Hi Len, thank you for your answer,
I would like to abdicate to transform the JDOM-Object into a String and 
later retransfer it to JDOM again.
I just thought that's the way. So if there is a way to send JDOM-objects 
directly, I will choose it ;-)


Gruss Christian


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: forwarding JDOM-Objects

2006-01-06 Thread Len Popp
On 1/6/06, Christian Stalp <[EMAIL PROTECTED]> wrote:
> Duan, Nick schrieb:
>
> >Don't forget type casting the object.
> >
> >
> >
> String mystring = req.getAttribute("Object").toString();
> Document mydoc = mystring.?
>
> Casting from String to JDOM doesn't work!!!
> So which way you prefer?
>
> Thank you...
>
> Gruss Christian

What type of object is the "Object" attribute supposed to be? If you
have a Document, you can do
req.setAttribute("Object", mydoc);
in one servlet and
Document mydoc = req.getAttribute("Object");
in the other.

If the "Object" attribute is a string representation of a Document,
you will have to do whatever is necessary to create a Document from
that string. (I don't know how JDOM works.)
--
Len

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: forwarding JDOM-Objects

2006-01-06 Thread Christian Stalp

Duan, Nick schrieb:


Don't forget type casting the object.

 


String mystring = req.getAttribute("Object").toString();
   Document mydoc = mystring.?

Casting from String to JDOM doesn't work!!!
So which way you prefer?

Thank you...

Gruss Christian


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: forwarding JDOM-Objects

2006-01-06 Thread Duan, Nick
Don't forget type casting the object.

ND

-Original Message-
From: Christian Stalp [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 06, 2006 10:06 AM
To: Tomcat Users List
Subject: Re: forwarding JDOM-Objects

Duan, Nick wrote:

>You shouldn't use req.getParameter(..).  Instead, use the setAttribute
>and getAttribute methods in HttpServletRequest.  No need to pack/unpack
>JDOM.  You can pass an object via request.
>
>  
>
So...
String mystring = req.getAttribute("Object")
Document mydoc = mystring.?   <--- and now?

Thank you...

Gruss Christian


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: forwarding JDOM-Objects

2006-01-06 Thread Christian Stalp

Duan, Nick wrote:


You shouldn't use req.getParameter(..).  Instead, use the setAttribute
and getAttribute methods in HttpServletRequest.  No need to pack/unpack
JDOM.  You can pass an object via request.

 


So...
String mystring = req.getAttribute("Object")
   Document mydoc = mystring.?   <--- and now?

Thank you...

Gruss Christian


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: forwarding JDOM-Objects

2006-01-06 Thread Duan, Nick
You shouldn't use req.getParameter(..).  Instead, use the setAttribute
and getAttribute methods in HttpServletRequest.  No need to pack/unpack
JDOM.  You can pass an object via request.

ND

-Original Message-
From: Christian Stalp [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 06, 2006 9:21 AM
To: Tomcat Users List
Subject: forwarding JDOM-Objects

Hello again,
now I have another question. I want to forward a JDOM-object from one 
servlet to another in the same servlet-container. I thought I write this

JDOM to a string, transfer it and unpack it at the other side.

BUT I cannot find a way to extract a JDOM from a String delivered by a 
HttpServletRequest.
I tried it this way:
String mystring = req.getParameter("Objekt");
Document mydoc = mystring.?  <- no method found
I thought there was a method anyway. What can I do here?

Thank you and...

Gruss Christian



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



forwarding JDOM-Objects

2006-01-06 Thread Christian Stalp

Hello again,
now I have another question. I want to forward a JDOM-object from one 
servlet to another in the same servlet-container. I thought I write this 
JDOM to a string, transfer it and unpack it at the other side.


BUT I cannot find a way to extract a JDOM from a String delivered by a 
HttpServletRequest.

I tried it this way:
String mystring = req.getParameter("Objekt");
   Document mydoc = mystring.?  <- no method found
I thought there was a method anyway. What can I do here?

Thank you and...

Gruss Christian



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]