[JBoss/Spring Integration] - Re: Jboss 5 Beta 2 and Spring Deployer
by ragavgomatam
Thanks...Build the deployer from source & deployed...Jboss 5 Beta 3 does not deploy my ejb 3's. I know this has nothing to do with spring deployer & also the wrong forum but nevetheless posting it...Any ideas would be welcome. Surprising thing is that this whole thing works without one line code change in jboss 4.2.1 GA.
Struts Action with Spring DI
public class SpringEjb3Action extends DispatchAction {
|
| private SayHello sayhello;
|
| public ActionForward sayHello(ActionMapping m, @SuppressWarnings("unused")
| ActionForm f, HttpServletRequest request, @SuppressWarnings("unused")
| HttpServletResponse response) throws Exception {
| request.setAttribute("greeting", getSayhello().sayHelloWithEjb3DI());
| request.setAttribute("result", getSayhello().calulate());
| request.setAttribute("person", getSayhello().getPerson());
| return m.findForward("results");
|
| }
|
| public SayHello getSayhello() {
| return this.sayhello;
| }
|
| public void setSayhello(SayHello sayhello) {
| this.sayhello = sayhello;
| }
2 ejb 3's
@Local
| public interface SayHello {
| public String sayHelloWithEjb3DI() throws SQLException;
|
| public IPerson getPerson();
|
| public double calulate();
| }
|
| @Local
| public interface Calculator {
| public double calculate(int i, int j);
| }
|
| bean
|
| @Stateful
| @TransactionAttribute(REQUIRED)
| @ExcludeDefaultInterceptors
| public class SayHelloBean extends SimpleJdbcDaoSupport implements SayHello {
|
| @Resource(name = "jdbc/TestDs", type = DataSource.class, shareable = true, mappedName = "java:jdbc/OracleDS")
| private DataSource ds;
|
| @EJB(beanName = "CalculatorBean")
| private Calculator calculator;
|
| @Resource(name = "sqlForEjb")
| private String sql;
|
| @Spring(jndiName = "spring-inject", bean = "person")
| private IPerson p;
|
| public String sayHelloWithEjb3DI() {
| return "Testing ejb3 DI & your age is "
| + getSimpleJdbcTemplate().queryForInt(sql);
| }
|
| public double calulate() {
| return calculator.calculate(2, 3);
| }
|
| @PostConstruct
| public void init() {
| setDataSource(ds);
| }
|
| @PreDestroy
| public void callThis() {
| System.out.println("Invoking method: preDestroy()");
| }
|
| public IPerson getPerson() {
| return this.p;
| }
|
| @Stateless
| @TransactionAttribute(REQUIRED)
| @ExcludeDefaultInterceptors
| public class CalculatorBean implements Calculator {
|
| public double calculate(int i, int j) {
| return i + j;
| }
|
| }
spring-ejb3.xml
|
| <?xml version="1.0" encoding="UTF-8"?>
| <beans xmlns="http://www.springframework.org/schema/beans"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xmlns:jee="http://www.springframework.org/schema/jee"
| xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
| http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd">
|
| <bean name="/home" class="com.ejb3.action.SpringEjb3Action"
| autowire="byName">
| <property name="sayhello" ref="ejbLocalIntf"></property>
| </bean>
| <!-- Jboss 4.2 look up of ejb3 -->
| <jee:jndi-lookup id="ejbLocalIntf" jndi-name="Ejb3/SayHelloBean/local" />
| </beans>
Error in Jboss 5 deployment
org.jboss.deployers.spi.DeploymentException: Error deploying Ejb3.jar: Error creating ejb container CalculatorBean: java.lang.RuntimeException: Unable to load class for annotation org.jboss.annotation.ejb.PoolClass using class loader org.jboss.mx.loading.UnifiedClassLoader3@b8ec9b{ url=vfsfile:/C:/jboss-5.0.0.Beta3/server/default/deploy/Ejb3.ear ,addedOrder=21}
Surprising this is that this whole thing works like a charm in jboss 4.2.1, tried jboss 5 Beta 2, Beta 3 & still no success.......
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115250#4115250
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115250
18 years, 3 months
[EJB 3.0] - Ejb 3 in Jboss 5 Beta 3
by ragavgomatam
Hi,
I have ejb3 deployed & working in jboss 4.2.1. The same EAR when dropped into jboss 5 Beta 3\default\deploy has problems. Let me elaborate.
I have ejb's . (1) SayHelloBean & (2) Calculator Bean. BOTH WORK IN jboss 4.2.1 and BOTH ARE EJB 3's.
Code
package com.ejb3.interfaces;
|
| import java.sql.SQLException;
| import javax.ejb.Local;
| @Local
| public interface SayHello {
| public String sayHelloWithEjb3DI() throws SQLException;
|
}
Bean
package com.ejb3.beans;
|
| import static javax.ejb.TransactionAttributeType.REQUIRED;
| import javax.ejb.Stateful;
| import javax.ejb.TransactionAttribute;
| import javax.ejb.EJB;
| import javax.annotation.PostConstruct;
| import javax.annotation.Resource;
| import javax.interceptor.ExcludeDefaultInterceptors;
| import javax.sql.DataSource;
| import javax.annotation.PreDestroy;
|
| import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;
| import org.jboss.annotation.spring.Spring;
|
| import com.ejb3.domain.IPerson;
| import com.ejb3.interfaces.Calculator;
| import com.ejb3.interfaces.SayHello;
|
| @Stateful
| @TransactionAttribute(REQUIRED)
| @ExcludeDefaultInterceptors
| public class SayHelloBean extends SimpleJdbcDaoSupport implements SayHello {
|
| @Resource(name = "jdbc/TestDs", type = DataSource.class, shareable = true, mappedName = "java:jdbc/OracleDS")
| private DataSource ds;
|
| @EJB(beanName = "CalculatorBean")
| private Calculator calculator;
|
| @Resource(name = "sqlForEjb")
| private String sql;
|
| public String sayHelloWithEjb3DI() {
| return "Testing ejb3 DI & your age is "
| + getSimpleJdbcTemplate().queryForInt(sql);
| }
|
| public double calulate() {
| return calculator.calculate(2, 3);
| }
|
| @PostConstruct
| public void init() {
| setDataSource(ds);
| }
|
| @PreDestroy
| public void callThis() {
| System.out.println("Invoking method: preDestroy()");
| }
|
| }
|
BEAN 2
package com.ejb3.interfaces;
|
| import javax.ejb.Local;
|
| @Local
| public interface Calculator {
| public double calculate(int i, int j);
| }
package com.ejb3.beans;
|
| import static javax.ejb.TransactionAttributeType.REQUIRED;
| import javax.ejb.Stateless;
| import javax.ejb.TransactionAttribute;
| import javax.interceptor.ExcludeDefaultInterceptors;
| import com.ejb3.interfaces.Calculator;
|
| @Stateless
| @TransactionAttribute(REQUIRED)
| @ExcludeDefaultInterceptors
| public class CalculatorBean implements Calculator {
|
| public double calculate(int i, int j) {
| return i + j;
| }
|
| }
|
|
This was deployed in an EAR file with spring looking up the ejb as follows :-
<bean name="/home" class="com.ejb3.action.SpringEjb3Action"
| autowire="byName">
| <property name="sayhello" ref="ejbLocalIntf"></property>
| </bean>
| <!-- Jboss 4.2 look up of ejb3 -->
| <jee:jndi-lookup id="ejbLocalIntf" jndi-name="Ejb3/SayHelloBean/local" />
| </beans>
This works perfectly in jboss 4.2.1 but in jboss 5 beta 3 I get the following deployment error :-
org.jboss.deployers.spi.DeploymentException: Error deploying Ejb3.jar: Error creating ejb container CalculatorBean: java.lang.RuntimeException: Unable to load class for annotation org.jboss.annotation.ejb.PoolClass using class loader org.jboss.mx.loading.UnifiedClassLoader3@b8ec9b{ url=vfsfile:/C:/jboss-5.0.0.Beta3/server/default/deploy/Ejb3.ear ,addedOrder=21}
Also in the jmx-console under jndiView, I see the ejb's not bound.
java:comp namespace of the component jboss.j2ee:ear=Ejb3.ear,jar=Ejb3.jar,name=CalculatorBean,service=EJB3 :
|
| +- ORB[link -> java:/JBossCorbaORB] (class: javax.naming.LinkRef)
| +- EJBContext (class: javax.ejb.EJBContext)
| +- env (class: org.jnp.interfaces.NamingContext)
I don't see the ejb's bound under GLOBAL JNDI Namespace either.
Any suggestions/ideas ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115249#4115249
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115249
18 years, 3 months
[JBoss Seam] - Problem with selectManyCheckbox and EntityConverter
by valeriopp
Hello,
I have: my .xhtml like:
|
| <h:selectManyCheckbox value="#{AutorizzatiFoManager.selezionati}" layout="pageDirection" >
| <si:selectItems value="#{autorizzati}" var="fornitore" label="#{fornitore.nomeFornitore} - #{fornitore.messaggio}" />
| <ec:convertEntity entityClass="org.jboss.seam.example.registration.Fornitore" />
| </h:selectManyCheckbox>
|
|
and in the AutorizzatiFoManager class:
| @DataModel
| private List<Fornitore> autorizzati;
|
| @DataModelSelection
| @Out(required=false)
| private Fornitore tempautorizzato;
|
| @OneToMany
| @Out (required=false)
| private List<Fornitore> selezionati;
|
|
Note that the OneToMany List selezionati is a member in the bean class AutorizzatiFoManager (not in an Entity). Is that a problem?
my persistence.xml:
| <property name="jboss.entity.manager.factory.jndi.name" value="java:/selectItemsEntityManagerFactory"/>
| <property name="jboss.entity.manager.jndi.name" value="java:/selectItemsEntityManager"/>
|
my components.xml:
| <core:managed-persistence-context name="entityManager" persistence-unit-jndi-name="java:/selectItemsEntityManagerFactory"/>
|
Now it shows the list of Fornitore but when I try to check one or more Fornitore, the error is:
anonymous wrote :
| cause java.lang.NoClassDefFoundError: org/jboss/seam/core/Messages
| class class javax.servlet.ServletException
| localizedMessage Servlet execution threw an exception
| message Servlet execution threw an exception
|
| rootCause java.lang.NoClassDefFoundError: org/jboss/seam/core/Messages
|
|
| stackTrace [org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:313), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206), org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83), org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68), org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69), org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85), org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69), org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64), org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69), org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44), org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69), org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141), org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281), org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60), org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69), org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58), org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69), org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206), org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96), org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235), org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206), org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230), org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175), org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179), org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84), org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127), org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102), org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157), org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109), org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262), org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844), org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583), org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446), java.lang.Thread.run(Thread.java:595)]
|
Any suggestions?
thanks in advance.
Valerio
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115247#4115247
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115247
18 years, 3 months
[JBoss Seam] - persist entities problem
by alex_ro_bv
Hi all, I'm new to seam, and I like it so far. I tried to develop a small project but I hit this exception: org.hibernate.exception: could not get nex sequence value. I have a entity with following annotations
@Entity
| @Table(name="blv_user")
| @Name("user")
| public class User implements Serializable {
| private Long id;
| private Integer version;
| private String name;
| private String pass;
| @Id
| @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="gen_user")
| @SequenceGenerator(name="gen_user", sequenceName="id_user", allocationSize=1)
| public Long getId() {
| return id;
| }
|
| public void setId(Long id) {
| this.id = id;
| }
|
when I do a query, it works , but with em.persist(user), raises that exception.
I did not find anything usefull on the documentation for seam, neither on how to save my queries in a xml file like in old hibernate style or how to call an store procedure. Can anyone help me please?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115244#4115244
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115244
18 years, 3 months