[JBoss Seam] - Re: Integration Testing with TestNG and embeddedEjb
by b.reeve
I tried to see if the Spring Bean is resolved.
|
| package test.testNG;
|
| import org.jboss.seam.mock.SeamTest;
| import org.testng.annotations.Test;
|
| public class InjectionTestNG extends SeamTest{
|
| @Test
| public void testInjection() throws Exception {
| new FacesRequest(){
|
| @Override
| protected void updateModelValues(){
| setValue("#{departmentSpring.departmentName}","Department");
| }
| }.run();
| }
| }
|
|
And it throws exception
| FAILED: testInjection
| javax.el.PropertyNotFoundException: ELResolver cannot handle a null base Object with identifier 'departmentSpring'
| at com.sun.el.lang.ELSupport.throwUnhandled(ELSupport.java:52)
| at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:75)
| at com.sun.el.parser.AstValue.getTarget(AstValue.java:67)
| at com.sun.el.parser.AstValue.setValue(AstValue.java:147)
| at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:258)
| at org.jboss.seam.util.UnifiedELValueBinding.setValue(UnifiedELValueBinding.java:44)
| at org.jboss.seam.mock.SeamTest$Request.setValue(SeamTest.java:374)
| at test.testNG.InjectionTestNG$1.updateModelValues(InjectionTestNG.java:19)
| at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:476)
| at test.testNG.InjectionTestNG.testInjection(InjectionTestNG.java:21)
| ... Removed 22 stack frames
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095835#4095835
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095835
18Â years, 9Â months
[JBoss Seam] - Could not instantiate Seam component caused by: javax.naming
by birwin
Where am I supposed to define the Spike7 datasource. I keep getting this error:
javax.naming.NameNotFoundException: Spike7 not bound
where I have defined in my @Stateful bean an Entity Manager like so:
@javax.persistence.PersistenceContext (unitName="Spike7")
| private EntityManager em;
and my persistence.xml file located in the WEB-INF/classes/META-INF directory has this entry:
<persistence>
| <persistence-unit name="Spike7">
| <jta-data-source>java:Spike7Datasource</jta-data-source>
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <properties>
| <property name="hibernate-dialect" value="org.hibernate.dialect.SQLServerDialect" />
| <property name="hibernate.hbm2ddl.auto" value="${hibernate.hbm2ddl.auto}"/>
| <property name="hibernate.show_sql" value="true"/>
| <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory"/>
| <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
| </properties>
| </persistence-unit>
| </persistence>
and I have a Spike7DataSource-ds.xml deployed on my JBoss server... The jmx-console has these MBeans deployed indicating the DataSource has been successfully deployed:
name=Spike7Datasource,service=DataSourceBinding
| name=Spike7Datasource,service=ManagedConnectionFactory
| name=Spike7Datasource,service=ManagedConnectionPool
| name=Spike7Datasource,service=XATxCM
Any ideas what I am doing wrong? Can I use the Stateful bean in a WAR application.
Sorry if these are uneducated questions, but I am new to the seam world.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095832#4095832
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095832
18Â years, 9Â months
[JBoss Seam] - Re: Integration Testing with TestNG and embeddedEjb
by b.reeve
These are the classes that I have
Employee.java
| package test.injection;
|
| import org.jboss.seam.ScopeType;
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Scope;
|
| @Name("employeeBean")
| @Scope(ScopeType.SESSION)
| public class Employee {
|
| private String name;
|
| @In("#{departmentSpring}")
| private Department department;
|
| public String getName() {
| return name;
| }
|
| public void setName(String name) {
| this.name = name;
| }
|
| public String addEmployee(){
| return "/success.xhtml";
| }
|
| }
Department.java
| package test.injection;
|
|
| public class Department {
|
| private String departmentName;
|
| public String getDepartmentName() {
| return departmentName;
| }
|
| public void setDepartmentName(String departmentName) {
| this.departmentName = departmentName;
| }
|
| }
|
|
InjectionTestNG.java
| package test.testNG;
|
| import org.jboss.seam.mock.SeamTest;
| import org.testng.annotations.Test;
|
| public class InjectionTestNG extends SeamTest{
|
| @Test
| public void testInjection() throws Exception {
| new FacesRequest(){
|
| @Override
| protected void updateModelValues(){
| setValue("#{employeeBean.name}","MyName");
| }
|
| @Override
| protected void invokeApplication(){
| invokeMethod("#{employeeBean.addEmployee}");
| }
|
| @Override
| protected void renderResponse(){
| assert (getValue("#{employeeBean.name}").equals("MyName"));
| }
| }.run();
| }
|
|
| }
|
|
applicationContext.xml
| <?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
|
| <beans>
| <bean id="departmentSpring" class="test.injection.Department" />
| </beans>
|
And this is the exception stack trace
| FAILED: testInjection
| javax.el.ELException: Error writing 'name' on type test.injection.Employee_$$_javassist_0
| at javax.el.BeanELResolver.setValue(BeanELResolver.java:112)
| at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68)
| at com.sun.el.parser.AstValue.setValue(AstValue.java:154)
| at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:258)
| at org.jboss.seam.util.UnifiedELValueBinding.setValue(UnifiedELValueBinding.java:44)
| at org.jboss.seam.mock.SeamTest$Request.setValue(SeamTest.java:374)
| at test.testNG.InjectionTestNG$1.updateModelValues(InjectionTestNG.java:23)
| at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:476)
| at test.testNG.InjectionTestNG.testInjection(InjectionTestNG.java:35)
| Caused by: javax.el.PropertyNotFoundException: ELResolver cannot handle a null base Object with identifier 'departmentSpring'
| at com.sun.el.lang.ELSupport.throwUnhandled(ELSupport.java:52)
| at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:75)
| at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:195)
| at org.jboss.seam.util.UnifiedELValueBinding.getValue(UnifiedELValueBinding.java:34)
| at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:69)
| at org.jboss.seam.Component.getValueToInject(Component.java:1877)
| at org.jboss.seam.Component.injectAttributes(Component.java:1368)
| at org.jboss.seam.Component.inject(Component.java:1195)
| at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| at org.jboss.seam.interceptors.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
| at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
| at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
| at test.injection.Employee_$$_javassist_0.setName(Employee_$$_javassist_0.java)
| at javax.el.BeanELResolver.setValue(BeanELResolver.java:108)
| ... 30 more
| ... Removed 26 stack frames
|
Thanks !!!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095830#4095830
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095830
18Â years, 9Â months
[JBoss Portal] - Re: removing the default portal
by PeterJ
I am sorry, I interpreted the word "it" to mean the application server, not the text "-b 0.0.0.0".
Unfortunately, I do not know the contents of your startup script (/etc/init.d/jboss), so I will tell you how to modify the bin/jboss_init_redhat.sh script to include the -b option. You should be able to apply this to your script.
In the script, the variable JBOSSSH contains the text used to run the app server:
#define the script to use to start jboss
| JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh -c $JBOSS_CONF $JBOSS_BIND_ADDR"}
Notice that it in turn refers to a JBOSS_BIND_ADDR variable:
#if JBOSS_HOST specified, use -b to bind jboss services to that address
| JBOSS_BIND_ADDR=${JBOSS_HOST:+"-b $JBOSS_HOST"}
You could replace this as follows:
#if JBOSS_HOST specified, use -b to bind jboss services to that address
| JBOSS_BIND_ADDR="-b 0.0.0.0"
or your could earlier define JBOSS_HOST:
JBOSS_HOST=0.0.0.0
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095828#4095828
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095828
18Â years, 9Â months