[EJB 3.0] - Re: help getting started with eclipse
by wiggy
I wondered about that also - but i dont think it is that, but just in case i created the table in the mysql db by hand - no difference.
In addition i've not actually deployed the code to the server - as it wont compile - so how could eclipse use the datasource when i'm not running the code ?
what i have at present is
1. hand created catalog and one table crafted by hand using mysql admin
a user account and password created and granted all rights on the catlog which i called 'embed'
2. in the AS i deployed a new JTA datasource call 'jdbc/embedDS and pointed it at the mysql url and catalog.
|
| <datasources>
| <xa-datasource>
| <jndi-name>jdbc/embedDS</jndi-name>
| <use-java-context>false</use-java-context>
| <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class >
| <xa-datasource-property name="URL">jdbc:mysql://localhost:3306/embed</xa-datasource-property>
| <user-name>embed</user-name>
| <password>embed</password>
| <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
| <max-pool-size>5</max-pool-size>
| <min-pool-size>1</min-pool-size>
| <blocking-timeout-millis>2000</blocking-timeout-millis>
| <idle-timeout-minutes>2</idle-timeout-minutes>
| <track-connection-by-tx>true</track-connection-by-tx>
| <no-tx-separate-pools>false</no-tx-separate-pools>
| <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
| <metadata>
| <type-mapping>mySQL</type-mapping>
| </metadata>
| </xa-datasource>
|
that i think is okay (cant test it yet) but it appears in the JMX console as deployed - and i wrote an external jndi lookup to get a connection on theDS and close it (no sql commands) and that didnt error.
3. I have created an EJB project in eclipse for ejb3 and perisistence facets. I've setup the persistence XML ok (i hope) in the meta inf directory and pointed it a
|
| <?xml version="1.0" encoding="UTF-8"?>
| <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
| <persistence-unit name="embedDS" transaction-type="JTA">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>jdbc/embedDS</jta-data-source>
| <class>org.model.Message</class>
| <properties>
| <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
| <property name="hibernate.show_sql" value="true"/>
| </properties>
| </persistence-unit>
| </persistence>
|
4. I have created the entity class in org.model as
|
| package org.model;
|
| import javax.persistence.Column;
| import javax.persistence.Entity;
| import javax.persistence.GeneratedValue;
| import javax.persistence.GenerationType;
| import javax.persistence.Id;
| import javax.persistence.*;
|
| @Entity
| @Table(name="message", catalog="embed")
| public class Message
| {
| private long messageID;
| private String message;
|
| @Id
| @GeneratedValue(strategy=GenerationType.AUTO)
| @Column(name="messageID")
| public long getMessageID() {
| return messageID;
| }
|
| public void setMessageID(long messageID) {
| this.messageID = messageID;
| }
|
| public String getMessage() {
| return message;
| }
|
| public void setMessage(String message) {
| this.message = message;
| }
|
|
|
| }
|
and thats the bit that has these blessed compile errors.
Given the bean hasnt been deployed - and i have set the hibernate properties to "create-drop" the tables i cant see how the compiler could be trying to use the datasource and getting confused. It makes no difference whether i add or remove the table in mysql by hand or otherwise ?
my EJB project has the jboss4.2 jar set, including the mysql adapter jar and the the JRE 6 system library jar set.
Is there anything you can see that i'm doing stupid please
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082020#4082020
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082020
18 years, 7 months
[JBoss Seam] - Is it possible to use richfaces controls in email?
by robin.hultman
Hi! Im trying to add richfaces control to a mail to make it look more like the rest of my application.
| <ui:composition xmlns="http://www.w3.org/1999/xhtml"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:rich="http://richfaces.ajax4jsf.org/rich"
| xmlns:m="http://jboss.com/products/seam/mail">
|
| <m:message>
| <m:from name="Stugbokningen" address="my-email" />
| <m:to name="#{win.user.name}">#{win.email}</m:to>
| <m:subject>Subject</m:subject>
|
| <m:body>
| <rich:panel>
| <f:facet name="header">
| <h:outputText value="testing"/>
| </f:facet>
| testing
| </rich:panel>
| </m:body>
| </m:message>
| </ui:composition>
|
When I render the email I get:
anonymous wrote :
| Email sending failed: Resources framework is not initialised, check web.xml for Filter configuration
Richfaces works for the rest of my application so I dont see why the filter configuration should be wrong but here it is:
| <?xml version="1.0" ?>
| <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
| version="2.4">
|
| <!-- Ajax4jsf (must come first!) -->
| <context-param>
| <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
| <param-value>com.sun.facelets.FaceletViewHandler</param-value>
| </context-param>
|
| <context-param>
| <param-name>org.ajax4jsf.SKIN</param-name>
| <param-value>blueSky</param-value>
| </context-param>
|
| <!-- Seam -->
|
| <listener>
| <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
| </listener>
|
| <filter>
| <filter-name>Seam Filter</filter-name>
| <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
| </filter>
|
| <filter-mapping>
| <filter-name>Seam Filter</filter-name>
| <url-pattern>/*</url-pattern>
| </filter-mapping>
|
| <servlet>
| <servlet-name>Seam Resource Servlet</servlet-name>
| <servlet-class>org.jboss.seam.servlet.ResourceServlet</servlet-class>
| </servlet>
|
| <servlet-mapping>
| <servlet-name>Seam Resource Servlet</servlet-name>
| <url-pattern>/seam/resource/*</url-pattern>
| </servlet-mapping>
|
| <!-- Facelets development mode (disable in production) -->
|
| <context-param>
| <param-name>facelets.DEVELOPMENT</param-name>
| <param-value>true</param-value>
| </context-param>
|
| <!-- JSF -->
|
| <context-param>
| <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
| <param-value>.xhtml</param-value>
| </context-param>
|
| <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>*.seam</url-pattern>
| </servlet-mapping>
|
| <security-constraint>
| <display-name>Restrict raw XHTML Documents</display-name>
| <web-resource-collection>
| <web-resource-name>XHTML</web-resource-name>
| <url-pattern>*.xhtml</url-pattern>
| </web-resource-collection>
| <auth-constraint>
| <role-name>NONE</role-name>
| </auth-constraint>
| </security-constraint>
|
| </web-app>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082010#4082010
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082010
18 years, 7 months
[Beginners Corner] - Warning when use log4j
by changemylife
Hi all!
I begginer with Log4j, and I have a problem that I need help:
I use:
anonymous wrote : jboss-4.0.5.GA, EJB3.0
I have a bean (called RecordBean):
anonymous wrote : ...
| private static final Logger myLogger = Logger.getLogger(RecordBean.class);
|
| public void add(int num1, int num2) {
| myLogger.info("Perform the adding two numbers...");
| ...
| }
And inside anonymous wrote : \server\default\conf, I edit file log4j.xml (add my definition):
<appender name="XXX" class="org.apache.log4j.FileAppender">
| <param name="File" value="${jboss.server.log.dir}/mylog.log"/>
| <param name="Threshold" value="INFO"/>
| <layout class="org.apache.log4j.PatternLayout">
| <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
| </layout>
| </appender>
| .....
| <logger name="bean.log">
| <appender-ref ref="QT"/>
| </logger>
|
| <root>
| <appender-ref ref="CONSOLE"/>
| <appender-ref ref="FILE"/>
| </root>
But when I deploy RecordBean, and my client call add method, logging ok, but I receive some Warning:
anonymous wrote : log4j:WARN No appenders could be found for logger (org.jboss.security.SecurityAssociation).
| log4j:WARN Please initialize the log4j system properly.
I imported log4j.jar.
Please help me to solve this problem.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082008#4082008
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082008
18 years, 7 months