[EJB 3.0] - Re: Problem deploying EJB3 to jboss 4.2.0GA
by ctomc
Hi,
I doubt there is a problem in JDK because if it would be it wouldn't work in jboss 4.0.5GA or at least I think so. I have also tried with java 1.5.0_02 and 1.6.0 and result is the same.
I don't actually know which method is bothering him... I have about 30 methods in that class and error doesn't say where it dies.
the code goes like this(as far as it goes for annotations):
| ...
| @Stateful(name = "ShellSession")
| @RemoteHome(RemoteShellHome.class)
| @Remote(RemoteShell.class)
| @TransactionManagement(TransactionManagementType.BEAN)
| public class RemoteShellImpl implements RemoteShell {
| @Resource(name = "SystemShellJNDI")
| private String systemShellJNDI;
|
| ....
| ....
| ....
| @Init("create")
| public void ejbCreate() throws ShellException {
| ....
| }
| //there are 5 ejbCreate() methods with @Init("create") annotation
| @Remove
| public void ejbRemove() {
| ...
| ...
| }
|
| @Resource
| public void setSessionContext(SessionContext ctx) {
| ...
| }
| @PostActivate
| public void ejbActivate() {
| ...
| }
| ...
| ...
|
this is roughly the structure of class and of methods that have annotations on them.
tomaz
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4047624#4047624
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4047624
18 years, 11 months
[JBoss Seam] - Seam and maven2 running tests
by Lightguard
I get the following failure when I try to run the tests for the booking example (which I'm trying to get to work with maven2):
-------------------------------------------------------------------------------
| Test set: org.jboss.seam.example.booking.test.LoginTest
| -------------------------------------------------------------------------------
| Tests run: 2, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 1.109 sec <<< FAILURE!
| init(org.jboss.seam.example.booking.test.LoginTest) Time elapsed: 0 sec <<< FAILURE!
| java.lang.RuntimeException: Could not create Component: authenticator
| at org.jboss.seam.init.Initialization.addComponent(Initialization.java:865)
| at org.jboss.seam.init.Initialization.installComponents(Initialization.java:796)
| at org.jboss.seam.init.Initialization.init(Initialization.java:503)
| at org.jboss.seam.mock.SeamTest.init(SeamTest.java:701)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:645)
| at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:385)
| at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:141)
| at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:79)
| at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:158)
| at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:103)
| at org.testng.TestRunner.runWorkers(TestRunner.java:673)
| at org.testng.TestRunner.privateRun(TestRunner.java:620)
| at org.testng.TestRunner.run(TestRunner.java:480)
| at org.testng.SuiteRunner.runTest(SuiteRunner.java:278)
| at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:273)
| at org.testng.SuiteRunner.privateRun(SuiteRunner.java:253)
| at org.testng.SuiteRunner.run(SuiteRunner.java:168)
| at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:987)
| at org.testng.TestNG.runSuitesLocally(TestNG.java:951)
| at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeTestNG(TestNGDirectoryTestSuite.java:286)
| at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:224)
| at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:275)
| at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:832)
| Caused by: java.lang.IllegalArgumentException: You must specify org.jboss.seam.core.init.jndiPattern or use @JndiName: authenticator
| at org.jboss.seam.Component.getJndiName(Component.java:372)
| at org.jboss.seam.Component.<init>(Component.java:219)
| at org.jboss.seam.Component.<init>(Component.java:203)
| at org.jboss.seam.init.Initialization.addComponent(Initialization.java:851)
| ... 31 more
Any ideas on how to fix this? Is there a jar I need to include in my pom?
Here are my dependencies:
| <dependencies>
| <dependency>
| <groupId>jboss</groupId>
| <artifactId>jboss-seam</artifactId>
| <version>1.2.1.GA</version>
| <scope>provided</scope>
| </dependency>
| <dependency>
| <groupId>javax.ejb</groupId>
| <artifactId>ejb-api</artifactId>
| <version>3.0</version>
| <scope>provided</scope>
| </dependency>
| <dependency>
| <groupId>jboss</groupId>
| <artifactId>javassist</artifactId>
| <version>3.4.ga</version>
| <scope>provided</scope>
| </dependency>
| <dependency>
| <groupId>org.apache.myfaces.core</groupId>
| <artifactId>myfaces-api</artifactId>
| <version>1.1.4</version>
| <scope>provided</scope>
| </dependency>
| <dependency>
| <groupId>org.apache.myfaces.core</groupId>
| <artifactId>myfaces-impl</artifactId>
| <version>1.1.4</version>
| <scope>provided</scope>
| </dependency>
| <dependency>
| <groupId>javax.servlet</groupId>
| <artifactId>servlet-api</artifactId>
| <version>2.5</version>
| <scope>provided</scope>
| </dependency>
| <dependency>
| <groupId>org.hibernate</groupId>
| <artifactId>hibernate-annotations</artifactId>
| <version>3.2.0.ga</version>
| <scope>provided</scope>
| </dependency>
| </dependencies>
|
Also if someone has an idea on how to clean these up (what's really needed, etc.) I would be very grateful. Thanks!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4047620#4047620
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4047620
18 years, 11 months
[JBoss Portal] - DatabaseServerLoginModule
by ekszer
I wanted to use a Database for authentication in Jboss Portal. I modified
the login-config.xml file in the jboss-portal.sar/conf directory in the
following way:
<policy>
| <!-- For the JCR CMS -->
| <application-policy name="cms">
| <authentication>
| <login-module code="org.apache.jackrabbit.core.security.SimpleLoginModule" flag="required"/>
| </authentication>
| </application-policy>
|
| <application-policy name="portal">
| <authentication>
| <!--
| <login-module code="org.jboss.portal.identity.auth.IdentityLoginModule" flag="required">
| <module-option name="unauthenticatedIdentity">guest</module-option>
| <module-option name="userModuleJNDIName">java:/portal/UserModule</module-option>
| <module-option name="roleModuleJNDIName">java:/portal/RoleModule</module-option>
| <module-option name="additionalRole">Authenticated</module-option>
| <module-option name="password-stacking">useFirstPass</module-option>
| </login-module>
| -->
| <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
| <module-option name="dsJndiName">java:/PortalDS</module-option>
| <module-option name="principalsQuery">SELECT passwd FROM users WHERE username=?</module-option>
| <module-option name="rolesQuery">SELECT role, 'Roles' FROM roles WHERE username=?</module-option>
| <module-option name="additionalRole">Authenticated</module-option>
| <!--
| <module-option name="hashAlgorithm">MD5</module-option>
| <module-option name="hashEncoding">HEX</module-option>
| -->
| </login-module>
| </authentication>
|
| </application-policy>
| </policy>
Additionally I created two tables in the default database (PortalDS):
| users roles
| ------------------------ ------------------------
| username | passwd | | username | role |
| ------------------------ ------------------------
| admin | admin | | admin | Admin |
| ------------------------ -------------------------
| user | user | | user | User |
| ------------------------ -------------------------
| student1 | tomcat | |student1 | student |
| ----------------------- ------------------------
The problem: Nobody of the users can login. Help me please!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4047619#4047619
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4047619
18 years, 11 months
[JBoss Seam] - Seam - Embedded Ejb - Logger
by philippe.mercier
Hi everybody,
I use embedded-ejb with testng (tests are launch via maven2 - surefire).
All work fine !
Now i would like to use @Logger in my session bean as this :
| @Stateless
| public class DossierManagerImpl implements DossierManagerLocal {
|
| @Logger
| private Log logger;
|
| @PersistenceContext
| private EntityManager em;
|
| /**
| * Constructeur vide
| */
| public DossierManagerImpl() {
| }
|
| /**
| * Constructeur pour les tests
| * @param em
| */
| public DossierManagerImpl(EntityManager em) {
| this.em = em;
| }
|
| /*
| * (non-Javadoc)
| * @see be.ucm.ss.comptaclient.c397.session.DossierManagerLocal#insert(be.ucm.ss.comptaclient.c397.entity.Dossier)
| */
| public void insert(Dossier ccDossier) {
| logger.debug("insert dossier : nune = " + ccDossier.getNune());
| em.persist(ccDossier);
| }
|
| /*
| * (non-Javadoc)
| * @see be.ucm.ss.comptaclient.c397.session.DossierManagerLocal#update(be.ucm.ss.comptaclient.c397.entity.Dossier)
| */
| public void update(Dossier ccDossier) {
| em.merge(ccDossier);
| }
|
| /*
| * (non-Javadoc)
| * @see be.ucm.ss.comptaclient.c397.session.DossierManagerLocal#findAll()
| */
| @SuppressWarnings("unchecked")
| public List<Dossier> findAll() {
| Query q = (Query) em.createQuery("from Dossier");
| return q.getResultList();
| }
|
| /*
| * (non-Javadoc)
| * @see be.ucm.ss.comptaclient.c397.session.DossierManagerLocal#findFromNune(java.lang.String)
| */
| public Dossier findFromNune(String nune) {
| System.out.println(nune);
| Dossier dossier = em.find(Dossier.class, nune);
| return dossier;
| }
|
| }
|
but when my test class call the "insert" method of the session bean, i have an NullPointerException at the line that reference the logger.
here is my Test class :
| package be.ucm.ss.comptaclient.c397.session;
|
| import java.util.List;
|
| import javax.persistence.EntityManager;
|
| import org.testng.annotations.Test;
|
| import be.ucm.ss.comptaclient.c397.entity.Dossier;
| import be.ucm.util.EmbeddedEjbHandler;
|
| @Test
| public class DossierManagerImplTest {
| public void testInsert() {
| EntityManager em = EmbeddedEjbHandler.getInstance().getEntityManager();
| em.getTransaction().begin();
|
| Dossier d = new Dossier();
| d.setNune("1234567890");
| d.setNumonss("123456789");
| d.setDossiermaitre("12345");
| d.setNumsuccu("123");
| d.setGestionnairecompta("PHILOU");
| d.setAdresseonss1("adr1");
| d.setAdresseonss2("adr2");
| d.setAdresseonss3("adr3");
| d.setAdresseonss4("adr4");
| d.setAdresseonss4("adr5");
| d.setAdresseonss4("adr6");
| d.setAdresseonss4("adr7");
| d.setAdresseonss4("adr8");
|
| DossierManagerImpl dmi = new DossierManagerImpl(em);
| dmi.insert(d);
| em.getTransaction().commit();
|
| Dossier dossier = dmi.findFromNune(d.getNune());
| assert dossier.getNune().equals(d.getNune()) : "test failed";
|
| em.close();
| }
|
| public void testFindAll() throws Exception {
| EntityManager em = EmbeddedEjbHandler.getInstance().getEntityManager();
| em.getTransaction().begin();
|
| System.out.println("testFindAll()");
| DossierManagerImpl dmi = new DossierManagerImpl(em);
| List<Dossier> list = dmi.findAll();
| assert list != null && !list.isEmpty();
|
| em.getTransaction().commit();
| em.close();
| }
|
| public void testUpdate() {
| EntityManager em = EmbeddedEjbHandler.getInstance().getEntityManager();
| em.getTransaction().begin();
|
| System.out.println("testUpdate()");
| DossierManagerImpl dmi = new DossierManagerImpl(em);
| Dossier dossier = dmi.findFromNune("1234567890");
|
| // update
| dossier.setAdresseonss1("mon adresse");
| em.merge(dossier);
| em.getTransaction().commit();
|
| // reload & check
| dossier = dmi.findFromNune("1234567890");
| assert dossier.getAdresseonss1().equals("mon adresse");
|
| em.close();
| }
| }
|
Than, my questions are :
1) how can i inject a reference to a logger in the session bean.
what is the best practice
2) in my session bean, i must add a constuctor for giving the entity manager and that only for test. Is there an alternative to do that ?
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4047617#4047617
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4047617
18 years, 11 months
[JBoss Seam] - @Startup not working
by maniappan
I am trying to start a scheduler when my application starts up.
| @Entity
| @Name("mySchedule")
| @Table(name="my_schedule")
| @Scope(ScopeType.SESSION)
| @Startup
| public class MySchedule
| implements Serializable,
| {
|
| public void MySchedule()
| {
| MyScheduleHome msh = (MyScheduleHome) Component.getInstance("myScheduleHome");
| msh.Schedule();
| log.debug("Timer activated");
| }
| //Rest of the getters/setters for table.
| ...
| }
|
I invoked the Schedule from one of my other application object and it worked. I want to call Schedule during application startup and don't see it being invoked.
I don't see any error or information in the log[in Debug mode] related to the @Startup.
What could be the issue here?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4047610#4047610
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4047610
18 years, 11 months