[EJB 3.0] - How to share objects between EJB?
by Naxo
Hi,
First of all, I am newbie in J2EE. I have a doubt about EJB. I don't know how to share objects (if possible) within EJB. I want to know if I can use any kind of ?shared memory? to store some objects to be shared and access from any EJB instance running on the same server.
I have some information stored in a database, and I want to avoid accessing the database every time an EJB need some information store on it (that information doesn?t change very often). I have some beans managing the database and some other beans that depend on some of the data stored in the database. I want the managing bean to store some data in a "shared memory", and leave it there without any modification until the data in the database will be changed (the managing beans are fully responsible for the database, so if there is any modification in the database they can modify the stored data in the "shared memory"). Then I want some other beans to have access to that "shared memory" so they don?t have to access the database directly...
I am using JBoss AS 4.0.5 (with EJB 3.0 specification), session beans, message-driven beans and entity beans for persistence (MySQL server 5). I have looked the specification and some books that I have, and I couldn?t find anything like the javax.servlet.ServletContext object that exist in the web tier. In this object I can bind an object to a given attribute name in this servlet context, and any other servlet from the same context can get access to it by using the attribute name. For example;
//Storing the object in the context
ServletConfig.getServletContext().setAttribute(name, object)
//Getting the stored object from the context
ServletConfig.getServletContext().getAttribute(name)
I hope that I have made myself clear, I am Spanish and it?s a little difficult for me to explain myself in English? as I told you I am a beginner in J2EE so I am a little confuse right now, and I might be quite wrong on anything that I have said in this post.
Thanks in advanced
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4003970#4003970
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4003970
19 years, 3 months
[Beginners Corner] - Setup JBoss Portal 2.4.1 on Ubuntu - /default/conf/jboss-ser
by kforsythe76
I'm a first time user of JBoss and Linux. I've downloaded the zip file and extracted. When I exceute sh run.sh, I get the following:
root@brookfield:~/Desktop/jboss-portal-ha-2.4.1/bin# sh run.sh
run.sh: Missing file: /lib/tools.jar
run.sh: Unexpected results may occur. Make sure JAVA_HOME points to a JDK and not a JRE.
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /home/keith/Desktop/jboss-portal-ha-2.4.1
JAVA: java
JAVA_OPTS: -server -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dprogram.name=run.sh
CLASSPATH: /home/keith/Desktop/jboss-portal-ha-2.4.1/bin/run.jar:/lib/tools.jar
=========================================================================
11:50:14,451 INFO [Server] Starting JBoss (MX MicroKernel)...
11:50:14,476 INFO [Server] Release ID: JBoss [Zion] 4.0.4.GA (build: CVSTag=JBoss_4_0_4_GA date=200605151000)
11:50:14,482 INFO [Server] Home Dir: /home/keith/Desktop/jboss-portal-ha-2.4.1
11:50:14,589 INFO [Server] Home URL: file:/home/keith/Desktop/jboss-portal-ha-2.4.1/
11:50:14,593 INFO [Server] Patch URL: null
11:50:14,594 INFO [Server] Server Name: default
11:50:14,594 INFO [Server] Server Home Dir: /home/keith/Desktop/jboss-portal-ha-2.4.1/server/default
11:50:14,595 INFO [Server] Server Home URL: file:/home/keith/Desktop/jboss-portal-ha-2.4.1/server/default/
11:50:14,596 INFO [Server] Server Log Dir: /home/keith/Desktop/jboss-portal-ha-2.4.1/server/default/log
11:50:14,597 INFO [Server] Server Temp Dir: /home/keith/Desktop/jboss-portal-ha-2.4.1/server/default/tmp
11:50:14,598 INFO [Server] Root Deployment Filename: jboss-service.xml
11:50:16,396 INFO [ServerInfo] Java version: 1.5.0_10,Sun Microsystems Inc.
11:50:16,397 INFO [ServerInfo] Java VM: Java HotSpot(TM) Server VM 1.5.0_10-b03,Sun Microsystems Inc.
11:50:16,398 INFO [ServerInfo] OS-System: Linux 2.6.17-10-generic,i386
11:50:18,728 INFO [Server] Core system initialized
Failed to boot JBoss:
org.jboss.deployment.DeploymentException: url file:/home/keith/Desktop/jboss-portal-ha-2.4.1/server/default/conf/jboss-service.xml could not be opened, does it exist?
at org.jboss.deployment.DeploymentInfo.(DeploymentInfo.java:211)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:770)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:755)
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.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy5.deploy(Unknown Source)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
at org.jboss.Main.boot(Main.java:200)
at org.jboss.Main$1.run(Main.java:464)
at java.lang.Thread.run(Thread.java:595)
11:50:19,047 INFO [Server] Runtime shutdown hook called, forceHalt: true
11:50:19,048 INFO [Server] JBoss SHUTDOWN: Undeploying all packages
11:50:19,111 INFO [Server] Shutdown complete
Shutdown complete
Halting VM
My server/default director does not have much in it. However server/all seems to have all the files the run script is looking for. Do I need to alter the run.sh to point to the all directory? Any ideas? Thanks!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4003967#4003967
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4003967
19 years, 3 months