[Installation, Configuration & Deployment] - Client Application-NoclassDefFoundError
by ragghu001
HI
I am deploying EJB application in JBoss. When i am Compiling the Client application for EJB i am getting the below error
Got
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/logging/Log
ger
at org.jnp.interfaces.NamingContext.(NamingContext.java:158)
at org.jnp.interfaces.NamingContextFactory.getInitialContext(NamingConte
xtFactory.java:56)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
67)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247
)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.(InitialContext.java:197)
at BeanClient.main(BeanClient.java:16)
Code for the Application class is
| import javax.naming.*;
| import javax.rmi.PortableRemoteObject;
| import java.util.Properties;
| import com.brainysoftware.ejb.Adder;
| import com.brainysoftware.ejb.AdderHome;
| public class BeanClient {
| public static void main(String[] args) {
| // preparing properties for constructing an InitialContext object
| Properties properties = new Properties();
| properties.put(Context.INITIAL_CONTEXT_FACTORY,
| "org.jnp.interfaces.NamingContextFactory");
| properties.put(Context.PROVIDER_URL, "localhost:1099");
| System.out.println("Got");
| try {
| // Get an initial context
| InitialContext jndiContext = new InitialContext(properties);
| System.out.println("Got context");
| // Get a reference to the Bean
| Object ref = jndiContext.lookup("Adder");
| System.out.println("Got reference");
| // Get a reference from this to the Bean's Home interface
| AdderHome home = (AdderHome)
| PortableRemoteObject.narrow (ref, AdderHome.class);
| // Create an Adder object from the Home interface
| Adder adder = home.create();
| System.out.println ("2 + 5 = " + adder.add(2, 5));
| }
| catch(Exception e) {
| System.out.println(e.toString());
| }
| }
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976311#3976311
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976311
19 years, 7 months
[JBoss Seam] - Error in SimpleStatefulCache$SessionTimeoutTask
by Newlukai
Hi there,
when I start the JBoss AS with my application, I get this error after some minutes.
15:04:22,046 ERROR [STDERR] Exception in thread "SFSB Passivation Thread - jboss.j2ee:ear=ares.ear,jar=ares.jar,name=SelectOneMenuHelperAction,service=EJB3"
| 15:04:22,046 ERROR [STDERR] java.lang.NoClassDefFoundError: javax/portlet/PortletContext
| 15:04:22,046 ERROR [STDERR] at java.lang.Class.getDeclaredConstructors0(Native Method)
| 15:04:22,046 ERROR [STDERR] at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
| 15:04:22,046 ERROR [STDERR] at java.lang.Class.getConstructor0(Class.java:2671)
| 15:04:22,046 ERROR [STDERR] at java.lang.Class.getDeclaredConstructor(Class.java:1953)
| 15:04:22,046 ERROR [STDERR] at org.jboss.serial.classmetamodel.SunConstructorManager.getConstructor(SunConstructorManager.java:70)
| 15:04:22,046 ERROR [STDERR] at org.jboss.serial.classmetamodel.ClassMetaData.findConstructor(ClassMetaData.java:381)
| 15:04:22,046 ERROR [STDERR] at org.jboss.serial.classmetamodel.ClassMetaData.<init>(ClassMetaData.java:127)
| 15:04:22,046 ERROR [STDERR] at org.jboss.serial.classmetamodel.ClassMetamodelFactory.getClassMetaData(ClassMetamodelFactory.java:335)
| 15:04:22,046 ERROR [STDERR] at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:171)
| 15:04:22,046 ERROR [STDERR] at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:202)
| 15:04:22,046 ERROR [STDERR] at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
| 15:04:22,062 ERROR [STDERR] at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
| 15:04:22,062 ERROR [STDERR] at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
| 15:04:22,062 ERROR [STDERR] at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:275)
| 15:04:22,062 ERROR [STDERR] at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:202)
| 15:04:22,062 ERROR [STDERR] at org.jboss.serial.persister.ArrayPersister.saveObjectArray(ArrayPersister.java:110)
| 15:04:22,062 ERROR [STDERR] at org.jboss.serial.persister.ArrayPersister.writeData(ArrayPersister.java:101)
| 15:04:22,062 ERROR [STDERR] at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:275)
| 15:04:22,062 ERROR [STDERR] at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:202)
| 15:04:22,062 ERROR [STDERR] at org.jboss.serial.io.JBossObjectOutputStream.writeObjectOverride(JBossObjectOutputStream.java:181)
| 15:04:22,062 ERROR [STDERR] at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:298)
| 15:04:22,062 ERROR [STDERR] at org.jboss.serial.io.MarshalledObject.<init>(MarshalledObject.java:51)
| 15:04:22,062 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulBeanContext.writeExternal(StatefulBeanContext.java:401)
| 15:04:22,062 ERROR [STDERR] at org.jboss.serial.persister.ExternalizePersister.writeData(ExternalizePersister.java:58)
| 15:04:22,062 ERROR [STDERR] at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:275)
| 15:04:22,062 ERROR [STDERR] at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:202)
| 15:04:22,062 ERROR [STDERR] at org.jboss.serial.io.JBossObjectOutputStream.writeObjectOverride(JBossObjectOutputStream.java:181)
| 15:04:22,062 ERROR [STDERR] at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:298)
| 15:04:22,062 ERROR [STDERR] at org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManager.passivateSession(StatefulSessionFilePersistenceManager.java:347)
| 15:04:22,062 ERROR [STDERR] at org.jboss.ejb3.cache.simple.SimpleStatefulCache.passivate(SimpleStatefulCache.java:194)
| 15:04:22,062 ERROR [STDERR] at org.jboss.ejb3.cache.simple.SimpleStatefulCache$SessionTimeoutTask.run(SimpleStatefulCache.java:129)
I found "PortletContext" in the "portlet-api-lib.jar" and put it in my ear file, but this didn't solve the problem.
i don't know what's wrong. Can anybody help me?
Regards
Newlukai
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976305#3976305
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976305
19 years, 7 months
[EJB 3.0] - @EJB not working?
by nomike
/**
| * @author michael
| * @version 0.1.0.0 05.10.2006
| */
| package at.tac.ra.ng.ejb.bl.login;
|
| import at.tac.ra.ng.ejb.beans.user.User;
| import at.tac.ra.ng.ejb.entities.UserEntity;
| import at.tac.ra.ng.ejb.entities.LanguageEntity;
| import at.tac.ra.ng.common.HashGen;
| import at.tac.ra.ng.common.SysConfig;
|
| import javax.ejb.Stateless;
| import javax.ejb.Remote;
| import javax.ejb.EJB;
| import javax.persistence.PersistenceException;
| import javax.persistence.PersistenceContext;
| import javax.persistence.EntityManager;
| import java.util.Calendar;
| import java.security.NoSuchAlgorithmException;
|
| @Stateless(name = "LoginEJB")
| @Remote(Login.class)
| public class LoginBean implements Login {
| @PersistenceContext
| EntityManager em;
| @EJB
| User userBean;
| public loginStatus authenticateUser(String userLogin, char[] password) {
| if (userBean.findByUserLogin(userLogin).size() <= 0) {
| return loginStatus.USERLOGIN_DOES_NOT_EXIST;
| }
| UserEntity user;
| try {
| user = userBean.findByUserLoginEnabled(userLogin);
| } catch (PersistenceException e) {
| return loginStatus.NO_ENABLED_USER_FOUND_WITH_THIS_USERLOGIN;
| }
| Calendar c = Calendar.getInstance();
| if ((user.getReactivationTime() != null) && (c.getTime().getTime() < user.getReactivationTime().getTime())) {
| //Account temporary locked
| return loginStatus.ACCOUNT_TEMPORARY_LOCKED;
| } else {
| // Account not temporary locked
| try {
| if (user.getPassword().equals(HashGen.do_checksum(String.valueOf(password), "SHA-1"))) {
| // Password is correct
| user.setLoginTrials(0);
| user.setReactivationTime(null);
| em.flush();
| return loginStatus.SUCCESS;
| } else {
| // Password is wrong
| user.setLoginTrials(user.getLoginTrials() + 1);
| if (user.getLoginTrials() > SysConfig.getAllowedLoginTrials()) {
| Calendar c2 = Calendar.getInstance();
| c.add(Calendar.MINUTE, SysConfig.getLoginLockTime());
| user.setReactivationTime(c.getTime());
| }
| em.flush();
| return loginStatus.WRONG_PASSWORD;
| }
| } catch (NoSuchAlgorithmException e) {
| e.printStackTrace();
| return loginStatus.UNKNOWN_ERROR;
| }
| }
| }
|
|
| public UserEntity getUser(String userLogin) {
| return userBean.findByUserLoginEnabled(userLogin);
| }
|
| public LanguageEntity getLanguage(UserEntity user, Integer languageID) {
| if (languageID == null) {
| em.persist(user);
| return user.getLanguage();
| } else {
| return em.find(LanguageEntity.class, languageID);
| }
| }
| }
|
The above code produces a NullPointerException on "If (userBean.findByUserLogin(userLogin).size() <= 0)" because userBean is null.
Shouldn't a reference to UserEJB be injected there or am I missing something?
nomike aka Michael Postmann
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976304#3976304
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976304
19 years, 7 months
[Messaging, JMS & JBossMQ] - Re: How to make MDB listen on weblogic queue
by AJP10304
I'm running jboss-4.0.3SP1.
I have created a weblogic-jms-ds.xml as below:
<?xml version="1.0" encoding="UTF-8"?>
|
| <connection-factories>
|
| <!-- ==================================================================== -->
| <!-- JMS Weblogic Stuff -->
| <!-- ==================================================================== -->
|
| <!-- The JMS provider loader -->
| <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
| name=":service=JMSProviderLoader,name=WeblogicJMSProvider">
|
| <attribute name="ProviderName">WeblogicJMSProvider</attribute>
|
| <attribute name="ProviderAdapterClass">
| org.jboss.jms.jndi.JNDIProviderAdapter
| </attribute>
|
| <attribute name="QueueFactoryRef">QueueConnectionFactory</attribute>
|
| <attribute name="TopicFactoryRef">TopicConnectionFactory</attribute>
|
| <attribute name="Properties">
| java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
| java.naming.provider.url=t3://ifdwebapp1:7901
| </attribute>
|
| </mbean>
|
|
| <mbean code="org.jboss.naming.NamingAlias"
| name="DefaultDomain:service=NamingAlias,fromName=QueueConnectionFactory">
|
| <attribute name="ToName">t3://ifdwebapp1:7901/QueueConnectionFactory</attribute>
| <attribute name="FromName">QueueConnectionFactory</attribute>
|
| </mbean>
|
| </connection-factories>
jboss.xml is
<?xml version="1.0" encoding="UTF-8"?>
| <jboss>
| <enterprise-beans>
| <message-driven>
| <ejb-name>SwitchMDBBean</ejb-name>
| <destination-jndi-name>svf-request</destination-jndi-name>
| </message-driven>
| </enterprise-beans>
|
| <resource-ref>
| <res-ref-name>jms/svf-request</res-ref-name>
| <jndi-name>QueueConnectionFactory</jndi-name>
| </resource-ref>
|
| <resource-ref>
| <res-ref-name>jms/svf-response</res-ref-name>
| <jndi-name>QueueConnectionFactory</jndi-name>
| </resource-ref>
|
| </jboss>
|
ejb-jar.xml:
<?xml version="1.0" encoding="UTF-8"?>
| <ejb-jar version="2.1" 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/ejb-jar_2_1.xsd">
| <display-name>SwitchMDB-ejb</display-name>
| <enterprise-beans>
|
| <message-driven>
| <display-name>SwitchMDBMDB</display-name>
|
| <ejb-name>SwitchMDBBean</ejb-name>
| <ejb-class>uk.co.ifdsgroup.jms.SwitchMDBBean</ejb-class>
| <transaction-type>Container</transaction-type>
| <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
|
| <message-driven-destination>
| <destination-type>javax.jms.Queue</destination-type>
| <subscription-durability>NonDurable</subscription-durability>
| </message-driven-destination>
|
| <!--<message-destination-type>javax.jms.Queue</message-destination-type>
| <message-destination-link>svf-request</message-destination-link>
| <activation-config>
| <activation-config-property>
| <activation-config-property-name>acknowledgeMode</activation-config-property-name>
| <activation-config-property-value>Auto-acknowledge</activation-config-property-value>
| </activation-config-property>
| <activation-config-property>
| <activation-config-property-name>destinationType</activation-config-property-name>
| <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
| </activation-config-property>
| </activation-config>-->
|
| <env-entry>
| <env-entry-name>jndi-initial-context-factory</env-entry-name>
| <env-entry-type>java.lang.String</env-entry-type>
| <env-entry-value><![CDATA[weblogic.jndi.WLInitialContextFactory]]></env-entry-value>
| </env-entry>
| <env-entry>
| <env-entry-name>jndi-provider-url</env-entry-name>
| <env-entry-type>java.lang.String</env-entry-type>
| <env-entry-value><![CDATA[t3://ifdwebapp1:7901]]></env-entry-value>
| </env-entry>
|
| </message-driven>
|
| </enterprise-beans>
|
|
| <assembly-descriptor>
| <container-transaction>
| <method>
| <ejb-name>SwitchMDBBean</ejb-name>
| <method-name>*</method-name>
| </method>
| <trans-attribute>Required</trans-attribute>
| </container-transaction>
| <!-- <message-destination>
| <display-name>Destination for SwitchMDB</display-name>
| <message-destination-name>SwitchMDBDestination</message-destination-name>
| </message-destination>-->
| </assembly-descriptor>
| </ejb-jar>
standardjboss.xml snippet:
<invoker-proxy-binding>
| <name>singleton-message-driven-bean</name>
| <invoker-mbean>default</invoker-mbean>
| <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
| <proxy-factory-config>
| <!--<JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>-->
|
| <JMSProviderAdapterJNDI>WeblogicJMSProvider</JMSProviderAdapterJNDI>
|
| <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
| <CreateJBossMQDestination>true</CreateJBossMQDestination>
| <!-- WARN: Don't set this to zero until a bug in the pooled executor is fixed -->
| <MinimumSize>1</MinimumSize>
| <MaximumSize>1</MaximumSize>
| <KeepAliveMillis>30000</KeepAliveMillis>
| <MaxMessages>1</MaxMessages>
| <MDBConfig>
| <ReconnectIntervalSec>10</ReconnectIntervalSec>
| <DLQConfig>
| <DestinationQueue>t3://ifdwebapp1:7901/queue/DLQ</DestinationQueue>
| <MaxTimesRedelivered>10</MaxTimesRedelivered>
| <TimeToLive>0</TimeToLive>
| </DLQConfig>
| </MDBConfig>
| </proxy-factory-config>
| </invoker-proxy-binding>
jndi.properties:
# DO NOT EDIT THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING
| #
| java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
| java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces:weblogic.jndi.factories
|
Thanks for your help with this.
- Alan.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976302#3976302
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976302
19 years, 7 months