[EJB 3.0] - Portable Resource mapping to JNDI Name
by ejb3workshop
I would like to use a symbolic name to link to the Connection factory so using the mapped name attribute in the code does not seem an option.
| //MappedName does not seem portable
| //@Resource(mappedName="ConnectionFactory")
| @Resource(name="jms/ConnectionFactory2")
| private QueueConnectionFactory factory;
|
Then I added the following to my deployment descriptors
ejb-jar.xml
| <message-driven>
| <ejb-name>BatchJobProcessor</ejb-name>
| <ejb-class>com.thunderhead.backend.BatchJobProcessor</ejb-class>
| <transaction-type>Bean</transaction-type>
| <resource-ref>
| <description/>
| <res-ref-name>jms/ConnectionFactory2</res-ref-name>
| <res-type>javax.jms.QueueConnectionFactory</res-type>
| <res-auth>Container</res-auth>
| <!--mapped-name>jnp://localhost:1100/ConnectionFactory</mapped-name-->
| </resource-ref>
| <resource-ref>
| <description/>
| <res-ref-name>queue/TransactionProcessors</res-ref-name>
| <res-type>javax.jms.Queue</res-type>
| <res-auth>Container</res-auth>
| <mapped-name>jnp://localhost:1100/queue/TransactionProcessors</mapped-name>
| </resource-ref>
| </message-driven>
|
Again specifying the "real" JNDI name in the ejb-jar.xml file works, but does not provide me with suitable abstraction and portability. I was hoping to place all the JBoss specific JNDI mapping in the jboss.xml file like this.
jboss.xml
| <message-driven>
| <ejb-name>BatchJobProcessor</ejb-name>
| <destination-jndi-name>queue/BatchJobProcessors</destination-jndi-name>
| <resource-ref>
| <res-ref-name>jms/ConnectionFactory2</res-ref-name>
| <jndi-name>jnp://localhost:1100/ConnectionFactory</jndi-name>
| </resource-ref>
| <resource-ref>
| <res-ref-name>queue/TransactionProcessors</res-ref-name>
| <jndi-name>jnp://localhost:1100/queue/TransactionProcessors</jndi-name>
| </resource-ref>
| </message-driven>
|
However during deployment the following error occurs:
anonymous wrote :
| 3:17:54,453 WARN [JmxKernelAbstraction] persistence.units:ear=ThunderheadEJB_1178.ear,jar=ThunderheadEJB.jar,unitName=ThunderheadPU is not registered
| 3:17:54,453 WARN [ServiceController] Problem starting service jboss.j2ee:service=EJB3,module=ThunderheadEJB.jar
| ava.lang.RuntimeException: mapped-name is required for jms/ConnectionFactory2 of deployment BatchJobProcessor
| at org.jboss.injection.ResourceHandler.loadXmlResourceRefs(ResourceHandler.java:94)
| at org.jboss.injection.ResourceHandler.loadXml(ResourceHandler.java:167)
| at org.jboss.ejb3.EJBContainer.processMetadata(EJBContainer.java:352)
| at org.jboss.ejb3.Ejb3Deployment.processEJBContainerMetadata(Ejb3Deployment.java:292)
| at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:356)
| at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:91)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
| at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| 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.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
| at $Proxy0.start(Unknown Source)
| at org.jboss.system.ServiceController.start(ServiceController.java:417)
| at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| 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 $Proxy33.start(Unknown Source)
| at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:512)
| 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:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
| at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
| at org.jboss.ws.integration.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:93)
| at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
| at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| 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 $Proxy34.start(Unknown Source)
| at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
| at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
| at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| 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 $Proxy67.deploy(Unknown Source)
| at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
| at org.jboss.ha.framework.server.FarmMemberService.deploy(FarmMemberService.java:412)
| at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4093451#4093451
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4093451
18Â years, 8Â months
[Installation, Configuration & DEPLOYMENT] - problem while start up in JBOSS server 4.0.5 GA--please igno
by prakash.dumbre
hi all
plese ignore the previous post.
here is my problem
I have JOBSS server 4.0.5 GA installed on the our server having the operating system as windows server 2003. Server gets startup correctly and works fine at the first time but when i shutdown the server and again tried to start it, it hangs up. Following is the stack trace from log file(jb.10102007.log)
Stack Trace
16:31:49,968 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=.../dep
loy/management/console-mgr.sar/web-console.war/
16:31:53,484 INFO [MailService] Mail Service bound to java:/Mail
16:31:54,390 INFO [RARDeployment] Required license terms exist, view META-INF/r
a.xml in .../deploy/jboss-ha-local-jdbc.rar
16:31:54,656 INFO [RARDeployment] Required license terms exist, view META-INF/r
a.xml in .../deploy/jboss-ha-xa-jdbc.rar
16:31:54,812 INFO [RARDeployment] Required license terms exist, view META-INF/r
a.xml in .../deploy/jboss-local-jdbc.rar
16:31:55,015 INFO [RARDeployment] Required license terms exist, view META-INF/r
a.xml in .../deploy/jboss-xa-jdbc.rar
16:31:55,093 INFO [RARDeployment] Required license terms exist, view META-INF/r
a.xml in .../deploy/jms/jms-ra.rar
16:31:55,390 INFO [RARDeployment] Required license terms exist, view META-INF/r
a.xml in .../deploy/mail-ra.rar
16:32:18,062 INFO [WrapperDataSourceService] Bound ConnectionManager 'jboss.jca
:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
16:37:20,359 WARN [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatI
d=257, GlobalId=TPSLVL00102/3, BranchQual=, localId=3] timed out. status=STATUS_
ACTIVE
This happening because server throws the following exception in the server.log file(c:/jboss4.0.5.GA/server/default/log)
Stack Trace
java.sql.SQLException: Table already exists: JMS_MESSAGES in statement [CREATE CACHED TABLE JMS_MESSAGES]
at org.hsqldb.jdbc.Util.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeUpdate(CachedPreparedStatement.java:95)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:251)
at org.jboss.mq.pm.jdbc2.PersistenceManager.createSchema(PersistenceManager.java:277)
2007-10-10 16:32:19,093 DEBUG [org.jboss.mq.pm.jdbc2.PersistenceManager] Could not create table with SQL: CREATE CACHED TABLE JMS_TRANSACTIONS ( TXID INTEGER, PRIMARY KEY (TXID) )
java.sql.SQLException: Table already exists: JMS_TRANSACTIONS in statement [CREATE CACHED TABLE JMS_TRANSACTIONS]
at org.hsqldb.jdbc.Util.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeUpdate(CachedPreparedStatement.java:95)
2007-10-10 16:32:19,093 DEBUG [org.jboss.mq.pm.jdbc2.PersistenceManager] Could not create table with SQL: CREATE CACHED TABLE JMS_TRANSACTIONS ( TXID INTEGER, PRIMARY KEY (TXID) )
java.sql.SQLException: Table already exists: JMS_TRANSACTIONS in statement [CREATE CACHED TABLE JMS_TRANSACTIONS]
at org.hsqldb.jdbc.Util.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeUpdate(CachedPreparedStatement.java:95)
I am suspecting server throws this exception due to it is not able to shutdown the instance of "hypersonicdatabase" which is the default database of the JBOSS.
please tell me what is the meaning of the above exception and how to resolve it.
regards
prakash
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4093450#4093450
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4093450
18Â years, 8Â months
[Installation, Configuration & DEPLOYMENT] - problem while start up in JBOSS server 4.0.5 GA
by prakash.dumbre
"prakash.dumbre" wrote : hi all
|
| I have JOBSS server 4.0.5 GA installed on the our server having the operating system as windows server 2003. Server gets startup correctly and works fine at the first time but when i shutdown the server and again tried to start it, it hangs up. Following is the stack trace from log file(jb.10102007.log)
|
|
| Stack Trace
| 16:31:49,968 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=.../dep
| loy/management/console-mgr.sar/web-console.war/
| 16:31:53,484 INFO [MailService] Mail Service bound to java:/Mail
| 16:31:54,390 INFO [RARDeployment] Required license terms exist, view META-INF/r
| a.xml in .../deploy/jboss-ha-local-jdbc.rar
| 16:31:54,656 INFO [RARDeployment] Required license terms exist, view META-INF/r
| a.xml in .../deploy/jboss-ha-xa-jdbc.rar
| 16:31:54,812 INFO [RARDeployment] Required license terms exist, view META-INF/r
| a.xml in .../deploy/jboss-local-jdbc.rar
| 16:31:55,015 INFO [RARDeployment] Required license terms exist, view META-INF/r
| a.xml in .../deploy/jboss-xa-jdbc.rar
| 16:31:55,093 INFO [RARDeployment] Required license terms exist, view META-INF/r
| a.xml in .../deploy/jms/jms-ra.rar
| 16:31:55,390 INFO [RARDeployment] Required license terms exist, view META-INF/r
| a.xml in .../deploy/mail-ra.rar
| 16:32:18,062 INFO [WrapperDataSourceService] Bound ConnectionManager 'jboss.jca
| :service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
| 16:37:20,359 WARN [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatI
| d=257, GlobalId=TPSLVL00102/3, BranchQual=, localId=3] timed out. status=STATUS_
| ACTIVE
|
| This happening because server throws the following exception in the server.log file(c:/jboss4.0.5.GA/server/default/log)
|
| Stack Trace
| java.sql.SQLException: Table already exists: JMS_MESSAGES in statement [CREATE CACHED TABLE JMS_MESSAGES]
| at org.hsqldb.jdbc.Util.throwError(Unknown Source)
| at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
| at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeUpdate(CachedPreparedStatement.java:95)
| at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:251)
| at org.jboss.mq.pm.jdbc2.PersistenceManager.createSchema(PersistenceManager.java:277)
| 2007-10-10 16:32:19,093 DEBUG [org.jboss.mq.pm.jdbc2.PersistenceManager] Could not create table with SQL: CREATE CACHED TABLE JMS_TRANSACTIONS ( TXID INTEGER, PRIMARY KEY (TXID) )
| java.sql.SQLException: Table already exists: JMS_TRANSACTIONS in statement [CREATE CACHED TABLE JMS_TRANSACTIONS]
| at org.hsqldb.jdbc.Util.throwError(Unknown Source)
| at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
| at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeUpdate(CachedPreparedStatement.java:95)
|
| 2007-10-10 16:32:19,093 DEBUG [org.jboss.mq.pm.jdbc2.PersistenceManager] Could not create table with SQL: CREATE CACHED TABLE JMS_TRANSACTIONS ( TXID INTEGER, PRIMARY KEY (TXID) )
| java.sql.SQLException: Table already exists: JMS_TRANSACTIONS in statement [CREATE CACHED TABLE JMS_TRANSACTIONS]
| at org.hsqldb.jdbc.Util.throwError(Unknown Source)
| at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
| at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeUpdate(CachedPreparedStatement.java:95)
|
| I am suspecting server throws this exception due to it is not able to shutdown the instance of "hypersonicdatabase" which is the default database of the JBOSS.
|
| please tell me what is the meaning of the above exception and how to resolve it.
| regards
| prakash
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4093447#4093447
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4093447
18Â years, 8Â months
[JBoss Portal] - Difference between windows and sub-pages
by roth
Hi
I am trying to understand what windows and sub-pages are for, and how to show different cms content based on the roles of the logged-in users.
Here is what I have so far, please tell me if this is correct:
- In 2.6, windows are parts of a page. They can show portlets, google widgets or CMS content.
- In 2.6, there is no more CMS Portlet, CMS content is directly displayed by windows.
- Windows cannot be secured, but portals, portlet instances, pages and cms files can be.
And now some questions:
- What are sub-pages needed for?
- If there is no more CMS portlet, and windows cannot be secured, how do I create a page that shows CMS content A to role A, and CMS content B to role B?
My approach for the last question was to create a page with both contents, and allow viewing only to the respective roles. By securing CMS files, this worked partly. I couldn't get rid of the 'access denied' error messages, and once I removed view access from a cms file for my admin role, it was gone for good from the managemet interface. I know this is kind of stupid, what what else would I do if role A I mentioned was my admin role?
Thanks,
Tobias
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4093444#4093444
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4093444
18Â years, 8Â months
[JBossCache] - Re: ClassCastException/instanceof fails when getting object
by jorgemoralespou_2
We have relied on default flat classloaders for JBoss AS, so all of our applications can have access to all others. You only have to take care of just bundling the jar file with model classes in one of your apps.
In our case we have:
core.ear --> With model classes, jboss caches, and core infraestructure.
app1.ear --> Which uses cache. No model classes bundled.
app2.ear --> Which uses cache. No model classes bundled.
app3.war --> Which uses cache. No model classes bundled.
Before we have had problems with this kind of layout, because we used model classes, used JBC persistance to DB, and as applications started, some model classes were not found. So we decided just to put in cache Maps of primitive wrappers, or classes bundled in core, which was the application deserializing from cache.
Hope this helps.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4093443#4093443
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4093443
18Â years, 8Â months