[JBoss Seam] - TestNG + embeddable EJB3 Container
by Udo.Krass
Hi,
i just try to test my webapp with TestNG.
I have problems with the embedded EJB3 Container.
When i start my test, i get following exception:
| [testng] 12:09:37,439 INFO [HbmBinder] Mapping collection: org.jbpm.taskmgmt.def.TaskMgmtDefinition.tasks -> JBPM_TASK
| [testng] 12:09:37,739 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
| [testng] 12:09:37,979 ERROR [NamingHelper] Could not obtain initial context
| [testng] javax.naming.NamingException: Local server is not initialized
| [testng] at org.jnp.interfaces.LocalOnlyContextFactory.getInitialContext(LocalOnlyContextFactory.java:45)
|
I think this is a classpath issue.
So can somebody tell me, what my Container wants in his classpath???
TIA!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4029012#4029012
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029012
19Â years, 1Â month
[Messaging, JMS & JBossMQ] - MDB @PostConstruct error
by sandrocchio_0.1
Hi there,
I'm trying to run a sample MDB which should send emails.
Jboss 4.0.5 GA - EJB3
anonymous wrote : I can correctly deploy the EJB Module,
| 10:28:17,683 INFO [Ejb3Deployment] EJB3 deployment time took: 26
| 10:28:17,692 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=Mail-EJBModule.jar,name=MailMDB,service=EJB3 with dependencies:
| 10:28:17,722 INFO [EJBContainer] STARTED EJB: eu.virtualLab.mail.MailMDB ejbName: MailMDB
| 10:28:17,725 WARN [MessagingContainer] Could not find the queue destination-jndi-name=queue/outGoingEmail
| 10:28:17,727 WARN [MessagingContainer] destination not found: queue/outGoingEmail reason: javax.naming.NameNotFoundException: outGoingEmail not bound
| 10:28:17,729 WARN [MessagingContainer] creating a new temporary destination: queue/outGoingEmail
| 10:28:17,762 INFO [outGoingEmail] Bound to JNDI name: queue/outGoingEmail
| 10:28:17,854 INFO [EJB3Deployer] Deployed: file:/etc/jboss-4.0.5.GA/server/default/deploy/Mail-EJBModule.jar
| 11:27:17,659 INFO [Ejb3Deployment] EJB3 deployment time took: 66
| 11:27:17,670 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=Mail-EJBModule.jar,name=MailMDB,service=EJB3 with dependencies:
| 11:27:17,712 INFO [EJBContainer] STARTED EJB: eu.virtualLab.mail.MailMDB ejbName: MailMDB
| 11:27:17,760 INFO [EJB3Deployer] Deployed: file:/etc/jboss-4.0.5.GA/server/default/deploy/Mail-EJBModule.jar
but I can't run it from a Client, belowe the stack trace from JBoss
anonymous wrote : 11:38:55,699 INFO [ClientDeployer] Removing client ENC from: Mail-EJBModuleClient
| 11:38:55,737 INFO [ClientDeployer] Client ENC bound under: Mail-EJBModuleClient
| 11:38:56,686 ERROR [JmsServerSession] Unexpected error delivering message org.jboss.mq.SpyObjectMessage {
| Header {
| jmsDestination : QUEUE.outGoingEmail
| jmsDeliveryMode : 2
| jmsExpiration : 0
| jmsPriority : 4
| jmsMessageID : ID:9-11741279366781
| jmsTimeStamp : 1174127936678
| jmsCorrelationID: null
| jmsReplyTo : null
| jmsType : null
| jmsRedelivered : false
| jmsProperties : {sent=1174127936673}
| jmsPropReadWrite: false
| msgReadOnly : true
| producerClientId: ID:9
| }
| }
| java.lang.RuntimeException: java.lang.NullPointerException
| at org.jboss.ejb3.interceptor.LifecycleInterceptorHandler.postConstruct(LifecycleInterceptorHandler.java:113)
| at org.jboss.ejb3.EJBContainer.invokePostConstruct(EJBContainer.java:505)
| at org.jboss.ejb3.AbstractPool.create(AbstractPool.java:112)
| at org.jboss.ejb3.StrictMaxPool.get(StrictMaxPool.java:122)
| at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:54)
The client code is
QueueConnection cnn = null;
| QueueSender sender = null;
| QueueSession sess = null;
| Queue queue = null;
|
| try {
| InitialContext ctx = new InitialContext();
| queue = (Queue) ctx.lookup("queue/outGoingEmail");
| QueueConnectionFactory factory =
| (QueueConnectionFactory) ctx.lookup("ConnectionFactory");
| cnn = factory.createQueueConnection();
| sess = cnn.createQueueSession(false,
| QueueSession.AUTO_ACKNOWLEDGE);
|
| EmailBody email = new EmailBody(new String[]{"sandro(a)my-domain.net"},
| "test MailMDB module", "test MailMDB module");
| ObjectMessage msg = sess.createObjectMessage();
| msg.setObject(email);
|
|
| // The sent timestamp acts as the message's ID
| long sent = System.currentTimeMillis();
| msg.setLongProperty("sent", sent);
|
| sender = sess.createSender(queue);
| sender.send(msg);
|
| // sess.commit ();
| sess.close();
|
| } catch (JMSException ex) {
| ex.printStackTrace();
|
| } catch (Exception e) {
| e.printStackTrace();
| }
|
|
and the MDB
@MessageDriven(mappedName = "jms/MailMDB", activationConfig = {
| @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
| @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
| @ActivationConfigProperty(propertyName="destination", propertyValue="queue/outGoingEmail")
| })
| public class MailMDB implements MessageListener {
|
| private SessionContext context;
| private javax.mail.Message msg = null;
| Properties htmlTags = new Properties();
| private final Logger logger = Logger.getLogger(getClass().getName());
|
| @PostConstruct
| public void initialize() {
| logger.info("[initialize] PostConstruct. ok!");
| Session session =(Session)context.lookup("java:comp/env/mail/Mail");
| logger.info("[initialize] Mail Factory session from app. server. ok!");
from the logger the code seems to break off in the line where it try to get a Mail session.
What's my mistake here?
Thank you in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4029011#4029011
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029011
19Â years, 1Â month
[EJB 3.0] - Help! ClassCastException: $Proxy?? Issue
by ebross
I have spent a whole week trying to solve a problem without success. Frankly, I don't know what else to do except to turn for help here.
For development:
JDeveloper
JbossAS
Window 2003 Server
Components:
Entity bean(AddressEntity.java)
Session bean(AddressFacade.java)
Session bean interfaces(AddressFacadeRemote,java, AddressFacadeLocal.java )
JSF page(create.jsp)
JSF backing bean (Create.java)
Deployment:
foopojo.jar contain POJO and persitence.xml
fooejb.jar contains Session bean classes and jboss.xml
odmweb.war contains: jsp files, backing beans, jboss.web, faces-config.xml, web.xml etc.
odmapp.ear contains: foopojo.jar, fooejb.jar, fooweb.war, application,xml and jboss-app.xml
application.xml contains
<module>
| <web>
| <web-uri>fooweb.war</web-uri>
| <context-root>fooweb</context-root>
| </web>
| </module>
| <module> <ejb>fooejb.jar</ejb> </module>
| <module><ejb>foopojo.jar</ejb> </module>
| </application>
|
The application is deployed as EAR (fooapp.ear) to jboss-4.2.0.CR1
I have in my backing bean (Create.java):
public String addButton_action() {
| try {
|
| //NOTE: addressEntity is property in this class
| addressEntity.setCreatedBy(user.getUserName());
| java.util.Date timestamp = new java.util.Date(System.currentTimeMillis());
| addressEntity.setDateCreated(timestamp);
| addressEntity.setDateLastModified(timestamp);
| addressEntity.setVersion(1);
| addressEntity.setHits(0);
| getAddressFacadeRemote().createEntity(addressEntity);
| info("Address was successfully created.");
| } catch (Exception ex) {
| ex.printStackTrace();
| error(ex.getLocalizedMessage());
| }
| return "address_create";
| }
|
| public AddressFacadeRemote getAddressFacadeRemote() {
| if(this.addressFacadeRemote == null){
| try {
| Context ctx = new InitialContext();
| //NOTE: RemoteJNDIName is "fooapp/AddressFacade/remote" in the session bean AddressFacade;
| //NOTE: Next is Line# 236 as reported in the exception thrown
| this.addressFacadeRemote = (AddressFacadeRemote) ctx.lookup(AddressFacade.RemoteJNDIName);
| }
| catch (NamingException e){
| throw new RuntimeException(e);
| }
| }
| return addressFacadeRemote;
| }
|
Create.jsp is an input form
1. I start the page
2. Fill the form
3. Click a button to process the data
4. The system check for error but there is no error to display
5. The system throws the following error:
08:49:33,578 ERROR [STDERR] java.lang.ClassCastException: $Proxy117
| 08:49:33,593 ERROR [STDERR] at com.xxx.vmo.foo.pojo.address.Create.getAddressFacadeRemote(Create.java:236)
| 08:49:33,593 ERROR [STDERR] at com.xxx.vmo.foo.pojo.address.Create.addButton_action(Create.java:846)
| 08:49:33,593 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
I can't go past this error no matter what I try. I would appreciate, very much, is anyone would help.
Thanks in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4029009#4029009
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029009
19Â years, 1Â month