Re: [Resin-interest] More on include()/forward() issue.

2008-03-12 Thread Mattias Jiderhamn

Ilya Kasnacheev wrote (2008-03-11 11:35):
or would increasing the 
buffer (response.setBufferSize()) prevent the response from being

comitted until the included forward has been issued???


This way is too like hack. What if we'll fill this buffer prematurely anyway?
  
If the amount of data written before any forwards is deterministic there 
is no problem. But if you cannot know beforehand how many forwards there 
will be, or how much data there will be in each, it's risky.



  

What about my anonymous wrapper? See reply to original post.
  

It may work if you are certain there will be no flushing to the client
before a forward().


Nope, there would be a lot of flushing before forward().
Because, forward() final destination isn't going to print page from scratch. 
Instead it is going to print a fragment of page to be include()d.

After it will return, the rest of page() will be printed.
Also, there can be quite a few such (include() - forward() - forward() - 
print()) sessions.
  
What I meant was whether there will under any circumstances be a forward 
on the original - non-dispatched - request. (Such as displaying an error 
page if an error occurs deep within the include hierarchy)



___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] small question about entity ejb

2008-03-12 Thread Scott Ferguson

On Mar 11, 2008, at 6:28 AM, Riccardo Cohen wrote:

 After some new tests, I found something that works :

 if I do :

 homeobj=m_manager.find(homeinfo.class,theid);
 homeobj.setTitle(title);

 the object is saved
 but if I use the homeobj that comes from

 Query hqr=m_manager.createQuery(select h from homeinfo h where
 h.id_user=+id_user);

 and I try to call setTitle, then the object is not saved.

 I don't understand why, can somebody explain me please ? (or give a  
 link
 to the right doc...)

Can you turn on the log for this to make sure it's in a transaction?   
The @TransactionAttribute must be on a protected or public method, by  
the way.  There was a missing validation that didn't report an error  
on a private method.

I've just tested that case for the Query inside a transaction and the  
changed data is getting properly updated in my example.

e.g.

@In UserTransaction _ut;

void foo()
{
   _ut.begin();

   query = ...
   homeobj = (Home) query.getSingleResult();
   homeobj.setTitle(new-title);

   _ut.commit();
}

or

@TransactionAttribute
protected void foo()
{
   query = ...;
   homeobj = (Home) query.getSingleResult();
   homeobj.setTitle(new-title);
}

-- Scott



 Thanks a lot.



 Riccardo Cohen wrote:
 Hi again,

 I tried @TransactionAnnotation but it generated frequent errors  
 like this :

 [10:44:42.851] {http--8000-2} error: cannot read: mp/ 
 adminservlet.java
 [10:44:42.851] {http--8000-2} 1 error

 the select still work but no update


 I tried then with the UserTransaction method, but there was no  
 update. I
 looked at the amber-basic-field example, and found that even if the
 _uTrans was defined, it was not used, instead I found
 _manager.getTransaction(), so I tried with that, and still no update.

 but now I can see in the finer log for sql :

 [11:18:22.968] {http--8000-10} mp_db_pool.0:setAutoCommit(false)
 [11:18:22.968] {http--8000-10} mp_db_pool.0:commit()
 [11:18:22.969] {http--8000-10} mp_db_pool.0:setAutoCommit(true)

 Which means that the transaction is being used, but no update when  
 doing
 setTitle()

 I must be missing something, because the sample works all right. I
 re-read all conf, and found nothing strange. The only difference  
 seems
 to be that I use jdbc to mysql instead of jdbc/resin embedded db.

 Thanks for any info.
 Attached some files of my little test.

 Scott Ferguson wrote:
 On Mar 10, 2008, at 1:29 AM, Riccardo Cohen wrote:

 Thanks a lot, I understand that I need a transaction now, while  
 before
 it could work without this... I have no idea of how to do that.

 I noticed that in the doc of amber
 (http://caucho.com/resin/doc/amber.xtp) there was a
 @TransactionAnnotation but this makes a syntax error !
 Thanks to eclipse I found a @TransactionAnn, I added it at the
 beginning
 of my function definition, but this does not change (no update
 generated)

 It should be @TransactionAttribute.  I'm fixing the docs.

 The @TransactionAttribute is the easiest method.  You need to put it
 on a Resin-IoC-aware object, e.g. a bean or an EJB stateless bean
 or  a servlet.  If you put it on an arbitrary class, it won't do
 anything.

 You can also use UserTransaction to do essentially the same thing:

 class MyFoo {
   @In UserTransaction _ut;

   void myStuff()
   {
 _ut.begin();
 try {
   ...
 } finally {
   ut.commit();
 }
  }

 That's essentially identical to

   @TransactionAttribute void myStuff()
   {
 ...
   }

 If you turn logging level=fine, you'll see the transaction  
 begin()/
 commit().  So you can use the log to make sure the transactions are
 working properly.

 -- Scott

 Is there any doc about this ?
 Thanks

 Daniel López wrote:
 Hi again,

 Some quick tests show that no persist() or merge() should be   
 necessary
 to update an entity inside a persistent context. I tested with
 Hibernate
 and Amber as persistence providers and in both cases, nothing was
 necessary. That was using Resin 3.1.5 and RESOURCE_LOCAL as
 transaction
 type, which means that the problem might be with the container   
 managed
 transactions.

 S!
 D.

 Daniel López escribió:
 AFAIK, using merge should not be necessary unless the entity  
 has  been
 updated outside a persistent context and then needs to be
 synchronised
 back with the DB contents. persist() is just for new entities so
 reading
 the docs, updating an entity inside a persistent context should
 require
 no action. Unless an exception is thrown, of course ;).

 I'm going to do some tests...

 S!
 D.

 Matt Johnston escribió:
 I think you will need to use either the persist() or merge()
 methods of
 the EntityManager in order to save your data to the database. In
 your
 case since you are updating an existing record, you will need to
 use:

 m_manager.merge(homeobj)


 Matt

 Riccardo Cohen wrote:
 Hi
 I used to play with entity ejb with resin 3.0 with no problem.
 Now in
 3.1.5 I have this code :

  @PersistenceContext(name=public) private 

[Resin-interest] Quercus presentation at SF Java Meetup, April 7

2008-03-12 Thread Emil Ong
I and some of the Quercus engineers will be presenting Quercus at the
San Francisco Java Meetup Group on April 7.  The meetup is at Marakana,
an IT training company, which will let us do a hands-on, interactive
tutorial.  Space is limited, so you'll need to sign up here:

http://java.meetup.com/174/calendar/7458664/

There's more information on that site as well, but to give you the
highlights, we're going to show how to:

  * Set up WordPress on Quercus
  * Expose a Java objects and methods to PHP
  * See how to use the power of Java sessions in PHP 

I hope to see you all there!

Best,
Emil



Emil Ong
Chief Evangelist
Caucho Technology, Inc.
Tel. (858) 456-0300
mailto:[EMAIL PROTECTED]
http://blog.caucho.com/

Caucho: Reliable Open Source
-- Resin: application server
-- Quercus: PHP in Java
-- Hessian Web Services


___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


[Resin-interest] Quercus with phpbb3

2008-03-12 Thread Chris Chen
Scott,

I've been trying multiple times to get Quercus to run phpbb3 properly  
and I continue to have problems with getting the generated cached  
template files to render consistently.

After a server restart, things work for a few pages until it hits some  
sort of snag.  This consistently happens after I tried accessing  
different pages that requires the template caching mechanism to kick  
in.  Once that happens, the comments in the template fails to get  
parsed afterwards.

Turning on full debugging output (finest level) produces exceptions  
that are not entirely helpful:

[2008/03/11 20:18:52.873] idle PoolItem[jdbc/mpm, 
4,ManagedConnectionImpl]
[2008/03/11 20:18:52.874] com.caucho.quercus.QuercusExitException
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.env.Env.exit(Env.java:3852)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.expr.ExitExpr.eval(ExitExpr.java:82)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java: 
99)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.program.Function.callImpl(Function.java:354)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.program.Function.call(Function.java:294)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.expr.FunctionExpr.evalImpl(FunctionExpr.java:182)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.expr.FunctionExpr.eval(FunctionExpr.java:126)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java: 
99)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.program.Function.callImpl(Function.java:354)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.program.Function.call(Function.java:294)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.expr.FunctionExpr.evalImpl(FunctionExpr.java:182)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.expr.FunctionExpr.eval(FunctionExpr.java:126)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java: 
99)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.program.QuercusProgram.execute(QuercusProgram.java: 
239)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.page.InterpretedPage.execute(InterpretedPage.java:70)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.page.QuercusPage.executeTop(QuercusPage.java:119)
[2008/03/11 20:18:52.874]   at  
com 
.caucho 
.quercus.servlet.ResinQuercusServlet.service(ResinQuercusServlet.java: 
146)
[2008/03/11 20:18:52.874]   at  
com.caucho.quercus.servlet.QuercusServlet.service(QuercusServlet.java: 
353)
[2008/03/11 20:18:52.874]   at  
javax.servlet.http.HttpServlet.service(HttpServlet.java:91)
[2008/03/11 20:18:52.874]   at  
com 
.caucho 
.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java: 
103)
[2008/03/11 20:18:52.874]   at  
com 
.caucho 
.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:181)
[2008/03/11 20:18:52.874]   at  
com 
.caucho 
.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
[2008/03/11 20:18:52.874]   at  
com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:435)
[2008/03/11 20:18:52.874]   at  
com.caucho.server.port.TcpConnection.run(TcpConnection.java:603)
[2008/03/11 20:18:52.874]   at com.caucho.util.ThreadPool 
$Item.runTasks(ThreadPool.java:721)
[2008/03/11 20:18:52.874]   at com.caucho.util.ThreadPool 
$Item.run(ThreadPool.java:643)
[2008/03/11 20:18:52.874]   at java.lang.Thread.run(Thread.java:595)

I wish the exception output would be a bit more information so I know  
where the exception occurred.

Aside from that, I've tried different file caching mechanisms that is  
supported by phpbb3's newest SVN trunk source tree. I tried out APC  
and Memcache.  APC is still giving me similar problems but appeared  
more consistent than the default file one.  Memcache has problems  
starting up so it appears that memcache is still not fully implemented  
yet.

Tried with compile off and on.  That didn't work either.

Are there any plans to get phpbb3 to work properly?

I guess if I get some time, the only way is to run quercus within  
Eclipse or Idea and do a full break debug to see what's wrong.

Thanks,
Chris


___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


[Resin-interest] Resin-3.1 Eclipse Plugin

2008-03-12 Thread Steffen Busch
Sam, Scott,
I'm looking for the Eclipse Plugin for Resin-3.1 from Caucho.
In the Bug 1292 there is a note:
q
sam 11-01-07 09:12
Caucho will provide an eclipse plugin that integrates with the jst and
wst projects of eclipse.
Installation instructions included in the release notes for 3.1.4
/q

But on the Release Notes page for 3.1.4 (
http://caucho.com/resin/changes/resin-3.1.4.xtp) there is nothing mentioned
about it.


The only thing I was able to find in the Caucho Wiki was this Link
  http://wiki.caucho.com/Integrating_with_Eclipse
which refers to two non Caucho pages.
The first link opens a page where a raw JSP is served and the second link
only offers an Eclipse plugin for 3.0 (qNote: This plug-in needs some
update for Resin 3.1. It only supports Resin 3.0./q)


So, where can I find appropriate information about the Caucho Eclipse
Plugin?


Regards,
Steffen
___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] small question about entity ejb

2008-03-12 Thread Riccardo Cohen
I found what was wrong, the begin() was not at the right place :

 query = ...
 homeobj = (Home) query.getSingleResult();
 _ut.begin();
 homeobj.setTitle(new-title);
 _ut.commit();

Sorry for the trouble. I'll write a little sample to clarify all that 
(for me at least)

The @TransactionAttribute still does the error cannot read: 
mp/adminservlet.java

this is the function :

@TransactionAttribute
   public boolean set_homeinfo(int id_user,String title)

Scott Ferguson wrote:
 Can you turn on the log for this to make sure it's in a transaction?   
 The @TransactionAttribute must be on a protected or public method, by  
 the way.  There was a missing validation that didn't report an error  
 on a private method.
 
 I've just tested that case for the Query inside a transaction and the  
 changed data is getting properly updated in my example.
 
 e.g.
 
 @In UserTransaction _ut;
 
 void foo()
 {
_ut.begin();
 
query = ...
homeobj = (Home) query.getSingleResult();
homeobj.setTitle(new-title);
 
_ut.commit();
 }
 
 or
 
 @TransactionAttribute
 protected void foo()
 {
query = ...;
homeobj = (Home) query.getSingleResult();
homeobj.setTitle(new-title);
 }
 
 -- Scott
 

-- 
Très cordialement,

Riccardo Cohen
---
Articque
http://www.articque.com
149 av Général de Gaulle
37230 Fondettes - France
tel : 02-47-49-90-49
fax : 02-47-49-91-49



___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest