[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openejb-user
Subject:    Re: UserTransaction injection
From:       "Carlos MacLeod" <carlos.macleod () gmail ! com>
Date:       2008-11-19 21:54:05
Message-ID: 1aaf021c0811191354v3d175a58ne488514e5846184f () mail ! gmail ! com
[Download RAW message or body]

2008/11/18 David Blevins <david.blevins@visi.com>:
> On Nov 11, 2008, at 6:57 PM, Carlos MacLeod wrote:
>>
>> 2008-11-12 00:40:55,155 - ERROR - Error merging OpenEJB JNDI entries
>> in to war /Bunda: Exception: null
>> java.lang.NullPointerException
>>       at java.util.Hashtable.put(Hashtable.java:394)
>>       at
>> org.apache.catalina.deploy.NamingResources.addResourceEnvRef(NamingResources.java:320)
>>       at
>> org.apache.openejb.tomcat.catalina.TomcatJndiBuilder.mergeRef(TomcatJndiBuilder.java:416)
>>       at
>> org.apache.openejb.tomcat.catalina.TomcatJndiBuilder.mergeJndi(TomcatJndiBuilder.java:140)
>>       at
>> org.apache.openejb.tomcat.catalina.TomcatWebAppBuilder.start(TomcatWebAppBuilder.java:270)
>>       at
>> org.apache.openejb.tomcat.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:58)
>
> This seems to be the heart of the issue.  Unfortunately looking at the code
> here what might be going on is not obvious.  Is it possible you could create
> a small app that reproduces the problem so we can try it on our end?
>
> I've created a JIRA here for it:
>  https://issues.apache.org/jira/browse/OPENEJB-960
>
> -David
>
>


Hi David,

I created a simple JSF managed bean and a JSP page, it is the simplest example:


1- Managed bean code:

@Stateless
@TransactionManagement(TransactionManagementType.EJB)
public class MyStatelessBean implements MyStatelessBeanInterface {
    private String title = "Teste";

    @Resource
    private UserTransaction utx = null;

    @Override
    public String getTitle() {
        return title;
    }

    @Override
    public void setTitle(String title) {
        this.title = title;
    }
}


2- JSP page

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<%--
    This file is an entry point for JavaServer Faces application.
--%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <f:view>
            <h:outputText value="#{MyStatelessBean.title}" />
        </f:view>
    </body>
</html>


3- Faces config

<?xml version='1.0' encoding='UTF-8'?>

<!-- =========== FULL CONFIGURATION FILE ================================== -->

<faces-config version="1.2"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
    <managed-bean>
        <managed-bean-name>MyStatelessBean</managed-bean-name>
        <managed-bean-class>test.MyStatelessBean</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
</faces-config>




-- 
Best regards,
Carlos MacLeod

"Java is like violence: if it doesn's solve your problem, you aren't
using enough of it"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic