[EJB 3.0] - Using EntityManager in a abstract super class
by mnrz
Hello
we have an interface say, DataAccessManipulator. since the method save(), delete() and update() are common for all the DAO classes we have created a GeneralDataAccessManipulator as an abstract class in which those methods have been implemented using EntityManager:
| public abstract class GeneralDataAccessManipulator implements DataAccessManipulator {
|
| @PersistenceContext
| private EntityManager entityManager;
|
| public void delete(Object entity) {
| if (!entityManager.contains(entity)) {
| entity = doMerge(entity);
| }
| try {
| doDelete(entity);
| } catch (Exception e) {
| e.printStackTrace();
| }
| //entityManager.flush();
| }
|
| //rest of the code...
| }
|
now this class and many others are located in a jar file namely common-j2ee.jar
because there are many project in the company that are developing at the same time we shared this recent jar file for all other projects.
the problem is in our application we have to specify the unitName for the PersistenceContext and in another application this name may be different
and because in the GeneralDataAccessManipulator we didn't specify unitName the app won't be deployed and of course if we set it, other apps will encounter the problem
my question is if we can set that unitName in a way according to the applciation persistence unit.
I've read something about @EJBS on class declaration but didn't understand it really. Can we make use of that?
I am thinking of giving a specific unitName to the @PersistenceContext defined in abstract class an then inject the EM inside my app and set it as the name specified above in the SB I am using. Is this possible?
thanks for your help
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4184675#4184675
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4184675
17 years, 6 months
[Installation, Configuration & DEPLOYMENT] - Re: Noob encounters deployment woes.
by jaikiran
anonymous wrote :
| org.jboss.deployers.spi.DeploymentException: Error during deploy: vfszip:/D:/jboss-5.0.0.CR2/server/all/deploy/simple.ear/jaxb-xjc.jar/1.0/
| ....
| vfszip:/D:/jboss-5.0.0.CR2/server/all/deploy/simple.ear -> java.lang.IllegalStateException: Expected either '.jar' or '.jar/' at the end of 1.0
|
Looks like the new VFS implementation in JBoss-5 does not like the contents of this jar :-)
I just downloaded the jaxb-xjc.jar and looked at its contents:
|
| META-INF/
| META-INF/MANIFEST.MF
| META-INF/maven/
| META-INF/maven/com.sun.codemodel/
| META-INF/maven/com.sun.codemodel/codemodel/
| com/
| com/sun/
| com/sun/codemodel/
| com/sun/codemodel/fmt/
| com/sun/codemodel/util/
| com/sun/codemodel/writer/
| com/sun/dtdparser/
| com/sun/istack/
| ...
| org/
| org/kohsuke/
| org/kohsuke/rngom/
| org/kohsuke/rngom/ast/
| org/kohsuke/rngom/ast/builder/
| org/kohsuke/rngom/ast/om/
| org/kohsuke/rngom/ast/util/
| org/kohsuke/rngom/binary/
| org/kohsuke/rngom/binary/visitor/
| org/kohsuke/rngom/digested/
| org/kohsuke/rngom/dt/
| org/kohsuke/rngom/dt/builtin/
| org/kohsuke/rngom/nc/
| org/kohsuke/rngom/parse/
| org/kohsuke/rngom/parse/compact/
| .......
| META-INF/LICENSE.txt
| META-INF/jing-copying.html
| META-INF/maven/com.sun.codemodel/codemodel/pom.properties
| META-INF/maven/com.sun.codemodel/codemodel/pom.xml
|
| ......
|
| 1.0/
| 1.0/META-INF/
| 1.0/META-INF/services/
| 1.0/com/
| 1.0/com/sun/
| 1.0/com/sun/codemodel/
| 1.0/com/sun/codemodel/fmt/
| 1.0/com/sun/codemodel/util/
| 1.0/com/sun/codemodel/writer/
| 1.0/com/sun/relaxng/
| 1.0/com/sun/relaxng/javadt/
| 1.0/com/sun/tools/
| 1.0/com/sun/tools/xjc/
| 1.0/com/sun/tools/xjc/addon/
| 1.0/com/sun/tools/xjc/addon/elementwrapper/
| 1.0/com/sun/tools/xjc/addon/locator/
| 1.0/com/sun/tools/xjc/addon/sync/
| 1.0/com/sun/tools/xjc/generator/
| 1.0/com/sun/tools/xjc/generator/cls/
| 1.0/com/sun/tools/xjc/generator/field/
| 1.0/com/sun/tools/xjc/generator/marshaller/
| 1.0/com/sun/tools/xjc/generator/unmarshaller/
| 1.0/com/sun/tools/xjc/generator/unmarshaller/automaton/
| ...
|
To put this output in a better form:
jaxb-xjc.jar
| |
| |--- META-INF <and some contents under this)
| |
| |
| |--- org [the usual package/classes under this]
| |
| |--- com [the usual package/classes under this]
| |
| |
| |--- 1.0 [see my note below about this folder]
| | |
| | |--- META-INF
| | | |
| | | |--- services [some stuff under this]
| | |
| | |--- com [usual package/classes inside this]
|
|
|
The (naming of) 1.0 folder inside the jaxb-xjc.jar looks strange since this folder has a META-INF as well as some classes under it. The VFS implementation considers this a jar file because of the META-INF folder and hence complains about its naming.
anonymous wrote : What is the remedy?
I remember Ales Justin was working on a similar (a bit different) issue with one of the JDBC driver jar files. I would recommend you open a new thread in the JBoss AS5 forum http://www.jboss.com/index.html?module=bb&op=viewforum&f=287 and point them to this thread. You are going to get a better response there since this issue is AS5 specific.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4184674#4184674
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4184674
17 years, 6 months
[JBossMQ] - Max number of object in queue execute at the same time
by nibeTrap
Hi everybody,
I have the following situation: 4 server with Jboss, 1 is the "chief" with a
proper project and 3 have a different project from n.1 but all 3 have the same project.
In few words people connect to server 1 click a button and this produce a
message to send to one of the other 3 servers.
Now the message will start a method on one of the 3 servers and it tooks, as
example, 10 min, during this time, the same server should be able to receive
other 4 message to start at the same time other 4 method, but just 4+1 method,
if other request arrive, it should be queue sice one will finish.
Is it possible to do that?
I'm trying with just two machine one which send the message to other, but I see
that since the receiving machine doesn't finish the method, it doesnt start
other which is already in queue.
But I would like it will start max of 5 method at the same time then the other
should be place in queue. Is there a propertied to set to do that?
Hope to be not too much neboulos!
Thanks for any advice, it will be very appreciated
Nibe
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4184672#4184672
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4184672
17 years, 6 months
[Installation, Configuration & DEPLOYMENT] - Noob encounters deployment woes.
by daniec
My first concern is the following:
GMS: address is 127.0.0.1:61962
-------------------------------------------------------
04:42:24,516 INFO [GroupMember] org.jboss.messaging.core.impl.postoffice.GroupM
ember$ControlMembershipListener@d0d485 got new view [127.0.0.1:61962|0] [127.0.0
.1:61962], old view is null
04:42:24,521 INFO [GroupMember] I am (127.0.0.1:61962)
04:42:24,523 INFO [GroupMember] New Members : 1 ([127.0.0.1:61962])
04:42:24,525 INFO [GroupMember] All Members : 1 ([127.0.0.1:61962])
04:42:24,690 WARN [TCP] failed to join /224.0.0.75:7500 on net2: java.net.Socke
tException: Unrecognized Windows Sockets error: 0: no Inet4Address associated wi
th interface
04:42:24,693 WARN [TCP] failed to join /224.0.0.75:7500 on net3: java.net.Socke
tException: Unrecognized Windows Sockets error: 0: no Inet4Address associated wi
th interface
04:42:24,695 WARN [TCP] failed to join /224.0.0.75:7500 on net5: java.net.Socke
tException: Unrecognized Windows Sockets error: 0: no Inet4Address associated wi
th interface
04:42:24,698 INFO [STDOUT]
Do the warnings indicate port issues with my firewall? Namely port 7500? Or should I be concerned at all?
Secondly I get a long stack trace when I attempt to deploy a .ear project. This project is using EJB3, Webservices and a web app w/ webservice client.
Here is a partial dump:
org.jboss.deployers.spi.DeploymentException: Error during deploy: vfszip:/D:/jbo
ss-5.0.0.CR2/server/all/deploy/simple.ear/jaxb-xjc.jar/1.0/
at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentExcept
ion(DeploymentException.java:49)
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(Deployer
Wrapper.java:175)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(Deployer
sImpl.java:1285)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFi
rst(DeployersImpl.java:1003)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFi
rst(DeployersImpl.java:1056)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFi
rst(DeployersImpl.java:1056)
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(Deployers
Impl.java:944)
at org.jboss.dependency.plugins.AbstractControllerContext.install(Abstra
ctControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractContr
oller.java:1598)
at org.jboss.dependency.plugins.AbstractController.incrementState(Abstra
ctController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(Abstr
actController.java:1062)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(Abstr
actController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractContro
ller.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractContro
ller.java:553)
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(Deployers
Impl.java:627)
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeploye
rImpl.java:541)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDSca
nner.java:290)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScan
ner.java:221)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:44
1)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java
:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
runPeriodic(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
run(ScheduledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IllegalStateException: Expected either '.jar' or '.jar/' at
the end of 1.0
at org.jboss.ejb3.deployers.Ejb3ClientDeployer.getDeploymentJndiName(Ejb
3ClientDeployer.java:211)
at org.jboss.ejb3.deployers.Ejb3ClientDeployer.deploy(Ejb3ClientDeployer
.java:101)
at org.jboss.ejb3.deployers.Ejb3ClientDeployer.deploy(Ejb3ClientDeployer
.java:60)
at org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer.de
ploy(AbstractSimpleVFSRealDeployer.java:56)
at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.i
nternalDeploy(AbstractSimpleRealDeployer.java:62)
at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(
AbstractRealDeployer.java:50)
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(Deployer
Wrapper.java:169)
... 25 more
04:46:10,011 WARN [HDScanner] Failed to process changes
org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incompl
ete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
*** CONTEXTS IN ERROR: Name -> Error
vfszip:/D:/jboss-5.0.0.CR2/server/all/deploy/simple.ear -> java.lang.IllegalStat
eException: Expected either '.jar' or '.jar/' at the end of 1.0
I suspect the "1.0" in the path is the problem, but this is an actual directory inside the .jar file (jaxb-xjc.jar). See the line reading, "Caused by: java.lang.IllegalStateException: Expected either '.jar' or '.jar/' at
the end of 1.0".
Am I correct in assuming this to be the cause? What is the remedy?
Thanks all!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4184670#4184670
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4184670
17 years, 6 months