Kay,
Welcome to TomEE, and glad to see someone that is interested in doing what
I did at least one month ago.
Please note/do the following:
1. Download TomEE Plus 1.5.1 (SNAPSHOT) instead of 1.5.0; 1.5.0 did not
work at all for me as my environment is Windows Server 2003 & 2008; 1.5.1
resolves a file/directory/path issue in TomEE.
2. tomEE 1.5.1 comes bundled with MyFaces 2.1.10 (few weeks ago, it was
bundled with MyFaces 2.1.9), and I never had the following 'reference' in
my web.xml; I think I heard/read that you don't need the following i/fsince
you are using servlet 3.0 in web.xml
<listener>
<listener-class>org.apache.**myfaces.webapp.**StartupServletContextListener<
**/listener-class>
</listener>
3. Copy any/all dependencies to your tomee/lib folder; whenever I install a
new SNAPSHOT version of TomEE 1.5.1, I copy the following to tomee /lib
asm-3.3.1.jar (added that when I was evaluating batoo jpa)
derby.jar
eclipselink.jar
el-api-2.2
el-impl-2.2
javax.mail
joda-time-2.0 (to replace joda-time-1.6.2 which already exists in tomee/lib)
juel-2.2.5 (since I'm using JUEL with MyFaces for faster/better EL
performance)
4. take a look at tomee/conf/tomee.xml; at the bottom of that file, you
will see JDBC resources defined there; put your JDBC resources there
5. your persistence.xml, make sure you set your persistence provider, or
TomEE will default it to OpenJPA; i use eclipselink (since Glassfish3.1.2.2
used eclipselink, by default, and my app performs really well with
eclipselink)
6. also, see tomee/conf/tomcat-users.xml; read all the lines below
(copy/pasted from my file), especially the last line...for Netbeans. :)
<!-- Activate those lines to get access to TomEE GUI -->
<!-- *** DO NOT ENABLE THESE!!! SOMEONE TRIED TO HACK INTO MY SERVER!!! ***
<role rolename="tomee-admin" />
<user username="tomee" password="tomee" roles="tomee-admin,manager-gui" />
-->
<!-- *** DO NOT ENABLE THESE!!! SOMEONE TRIED TO HACK INTO MY SERVER!!! ***
Nov 27, 2012 5:48:08 AM org.apache.catalina.realm.LockOutRealm authenticate
WARNING: An attempt was made to authenticate the locked user "tomcat"
Nov 27, 2012 5:48:08 AM org.apache.catalina.realm.LockOutRealm authenticate
WARNING: An attempt was made to authenticate the locked user "tomcat"
Nov 27, 2012 5:48:09 AM org.apache.catalina.realm.LockOutRealm authenticate
WARNING: An attempt was made to authenticate the locked user "both"
Nov 27, 2012 5:48:09 AM org.apache.catalina.realm.LockOutRealm authenticate
WARNING: An attempt was made to authenticate the locked user "both"
Nov 27, 2012 5:48:09 AM org.apache.catalina.realm.LockOutRealm authenticate
WARNING: An attempt was made to authenticate the locked user "both"
localhost_access_log.txt
88.191.100.2 - - [27/Nov/2012:05:47:58 -0500] "HEAD /manager/html HTTP/1.0"
401 -
...
88.191.100.2 - - [27/Nov/2012:05:48:09 -0500] "HEAD /manager/html HTTP/1.0"
401 -
88.191.100.2 - - [27/Nov/2012:05:48:09 -0500] "HEAD /manager/html HTTP/1.0"
401 -
88.191.100.2 - - [27/Nov/2012:05:48:09 -0500] "HEAD /manager/html HTTP/1.0"
401 -
-->
<user password="YourPasswordHereSameAsNetBeans"
roles="manager-script,admin" username="YourUserNameSameAsNetBeans"/>
</tomcat-users>
Hope this helps,
Howard
On Thu, Dec 13, 2012 at 3:12 PM, Kay Wrobel <[email protected]> wrote:
> Hi everybody.
>
> I am new to TomEE and am having problems with the very basics of getting a
> simple CDI Application to work from Netbeans 7.2. I have added TomEE Plus
> 1.5.0 as a server via the Tools->Servers->Add Server... steps. The problem
> I have is as follows:
>
> I create a simple Web Application with Context and Dependency Injection
> enabled and server-supplied JSF 2.1 implementation activated. I proceed to
> adding a very simple WelcomeBean.java file that looks like this:
>
>> package beans;
>>
>> import java.io.Serializable;
>> import javax.enterprise.context.**SessionScoped;
>> import javax.inject.Named;
>>
>> /**
>> *
>> * @author kuw
>> */
>> @Named(value = "welcomeBean")
>> @SessionScoped
>> public class WelcomeBean implements Serializable {
>>
>> private int counter;
>>
>> /**
>> * Creates a new instance of WelcomeBean
>> */
>> public WelcomeBean() {
>> }
>>
>> public String getMessage() {
>> return super.toString() + String.format(" You called me %d
>> times", ++counter);
>> }
>> }
>>
> and then access that bean from the index.xhtml page like this:
>
>> <h:body>
>> <h:form>
>> Message is: <h:outputText value="#{welcomeBean.message}"**/>
>> </h:form>
>> </h:body>
>>
> When I run the project, the page simply shows this: "Message is:" and the
> nothing. I can't see anything in the project files that is missing. I have
> the empty shell of beans.xml file to enable CDI, web.xml is fairly standard
> only that I changed the url-pattern for the Faces Servlet. Here's the
> complete web.xml:
>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <web-app version="3.0"
>> xmlns="http://java.sun.com/**xml/ns/javaee<http://java.sun.com/xml/ns/javaee>"
>> xmlns:xsi="http://www.w3.org/**2001/XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>"
>> xsi:schemaLocation="http://**java.sun.com/xml/ns/javaee<http://java.sun.com/xml/ns/javaee>
>> http://java.sun.com/xml/ns/**javaee/web-app_3_0.xsd<http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd>
>> ">
>> <context-param>
>> <param-name>javax.faces.**PROJECT_STAGE</param-name>
>> <param-value>Development</**param-value>
>> </context-param>
>> <listener>
>> <listener-class>org.apache.**myfaces.webapp.**
>> StartupServletContextListener<**/listener-class>
>> </listener>
>> <servlet>
>> <servlet-name>Faces Servlet</servlet-name>
>> <servlet-class>javax.faces.**webapp.FacesServlet</servlet-**class>
>> <load-on-startup>1</load-on-**startup>
>> </servlet>
>> <servlet-mapping>
>> <servlet-name>Faces Servlet</servlet-name>
>> <url-pattern>*.xhtml</url-**pattern>
>> </servlet-mapping>
>> <session-config>
>> <session-timeout>
>> 30
>> </session-timeout>
>> </session-config>
>> <welcome-file-list>
>> <welcome-file>index.xhtml</**welcome-file>
>> </welcome-file-list>
>> </web-app>
>>
>
> So my question now is: what is going on? I don't see any obvious error
> messages in the different Output tabs in Netbeans.
>
> Btw. If I target the project to the Glassfish server, it works as expected:
>
>> Message is: beans.WelcomeBean@77431c1f You called me 3 times
>>
> (after reloading page two times).
>
> Anyone here have any idea what I am missing? It has to be something
> essential.
>
> Thanks,
>
> Kay
>
>
> --
>
> ------------------------------
> The information in this e-mail is confidential and is intended solely for
> the addressee(s). Access to this email by anyone else is unauthorized. If
> you are not an intended recipient, you may not print, save or otherwise
> store the e-mail or any of the contents thereof in electronic or physical
> form, nor copy, use or disseminate the information contained in the email.
> If you are not an intended recipient, please notify the sender of this
> email immediately.
>