(excuse the delay - vacation)

On Nov 22, 2008, at 6:54 AM, JensToerber wrote:

Hint:
If you try to run it as openejb-3.1.war you get trouble with the
installer.jsp, because the install-Button there expects ContextPath
/openejb. It's better to run it as openejb.xml, because otherwise you get
several config files (openejb.xml and openejb-3.1.xml) in
conf/Catalina/localhost.

We'll have to make note of that somewhere.

Still have to test this for persistent Messages. But this is the step after
the next step.

Let us know how that went.

In the Examples i could change the JpaServlet to

public class JpaServlet extends HttpServlet {
   @Resource(name = "OracleORCL", type = javax.sql.DataSource.class)
   private javax.sql.DataSource ds;

   @PersistenceUnit(name = "jpa-example")
   private EntityManagerFactory emf; // only injected if not in a
container?

   @PersistenceContext(name = "jpa-example")
   private EntityManager em;
...

Now the DataSource ds is injected and working on Oracle.

Great.

But i don't get the EntityManager injected. It is always null. Don't know
why.

Per spec, servlets aren't allowed @PersistenceContext injection as the context propagation models (TRANSACTION and EXTENDED) don't really fit for a servlet. Definitely something we should add a validation message for so at the least you would get a warning saying it won't work and why.

But my call to categoryDaoLocal.persist(category) fails with no ending
exceptions like:

http://localhost:8080/HotelWebProject/servlet/TestServletilterChain.java:206)
       at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:233)
[...]
       at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44
7)
       at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.IllegalArgumentException: can't parse argument number
       at java.text.MessageFormat.makeFormat(MessageFormat.java:1330)
       at java.text.MessageFormat.applyPattern(MessageFormat.java:450)
       at java.text.MessageFormat.<init>(MessageFormat.java:350)
       at org.apache.openejb.util.Logger$4.compute(Logger.java:108)
       at org.apache.openejb.util.Logger$4.compute(Logger.java:107)
       at org.apache.openejb.util.Memoizer$1.call(Memoizer.java:42)
       at
[...]

An invalidly formatted i18n message text slipped into one of our Messages.properties files right before the release went out. This has been fixed in the coming 3.1.1 (https://issues.apache.org/jira/browse/OPENEJB-950 )

A workaround is to set the related logging category to ERROR:

  log4j.category.Transaction = ERROR

Next steps then are:
- Get our application work (MyFaces 1.2, Facelets, Timer, MDBs with
persistent Messages on Tomcat Cluster hopefully with Openejb)
- try to change JPA-Provider to Hibernate (still haven't looked for
automatically database schema update in OpenJPA-Provider)

Let us know if you need any help with those.

-David

Reply via email to