[EJB/JBoss] - Basic EJB3 with JBOSS
by ghosh007
I have jboss 4.2.1 GA with Eclipse 5.5 and trying to run the calculator example given on the jboss site. I have created the bin and here is my client:
public static void main(String[] args) {
try {
Context context=new InitialContext();
AdviceRemote bean = ( AdviceRemote) context.lookup("com.andy.ejb3.AdviceRemote/remote");
System.err.println(bean.getAdvice());
} catch (NamingException e) {
e.printStackTrace();
}
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
If I use something like,
properties.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
properties.put("java.naming.factory.url.pkgs","=org.jboss.naming:org.jnp.interfaces");
properties.put("java.naming.provider.url","localhost:1099");
Context context=new InitialContext(properties);
I get:
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException:
Please help!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077472#4077472
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077472
18Â years, 8Â months
[JBossCache] - Re: JBossCache 2.0 with JBoss AS 4.2.1 problems
by mohali
|
| [java] 13:19:35,691 INFO [ServiceConfigurator] Problem configuring service
| jboss.cache:service=TestTreeCache
| [java] org.jboss.deployment.DeploymentException: Exception setting attribut
| e javax.management.Attribute@1531aca on mbean jboss.cache:service=TestTreeCache;
| - nested throwable: (java.lang.VerifyError: (class: org/jboss/cache/config/Conf
| iguration, method: setCacheLoaderConfig signature: (Lorg/jboss/cache/config/Cach
| eLoaderConfig;)V) Incompatible argument to function)
| [java] at org.jboss.system.ServiceConfigurator.setAttribute(ServiceConf
| igurator.java:698)
| [java] at org.jboss.system.ServiceConfigurator.configure(ServiceConfigu
| rator.java:332)
| [java] at org.jboss.system.ServiceConfigurator.internalInstall(ServiceC
| onfigurator.java:460)
| [java] at org.jboss.system.ServiceConfigurator.install(ServiceConfigura
| tor.java:171)
| [java] at org.jboss.system.ServiceController.install(ServiceController.
| java:226)
| [java] at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)
| [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
| hodAccessorImpl.java:25)
| [java] at java.lang.reflect.Method.invoke(Method.java:585)
| [java] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(Reflected
| Dispatcher.java:155)
| [java] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| [java] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBean
| Invoker.java:264)
| [java] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.ja
| va:659)
| [java] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210
| )
| [java] at $Proxy4.install(Unknown Source)
| [java] at org.jboss.deployment.SARDeployer.create(SARDeployer.java:249)
|
| [java] at org.jboss.deployment.MainDeployer.create(MainDeployer.java:96
| 9)
| [java] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:81
| 8)
| [java] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:78
| 2)
| [java] at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
| [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
| hodAccessorImpl.java:25)
| [java] at java.lang.reflect.Method.invoke(Method.java:585)
| [java] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(Reflected
| Dispatcher.java:155)
| [java] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| [java] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractI
| nterceptor.java:133)
| [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| [java] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invok
| e(ModelMBeanOperationInterceptor.java:142)
| [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| [java] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBean
| Invoker.java:264)
| [java] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.ja
| va:659)
| [java] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210
| )
| [java] at $Proxy10.deploy(Unknown Source)
| [java] at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLD
| eploymentScanner.java:421)
| [java] at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDep
| loymentScanner.java:634)
| [java] at org.jboss.deployment.scanner.AbstractDeploymentScanner$Scanne
| rThread.doScan(AbstractDeploymentScanner.java:263)
| [java] at org.jboss.deployment.scanner.AbstractDeploymentScanner.startS
| ervice(AbstractDeploymentScanner.java:336)
| [java] at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(Servi
| ceMBeanSupport.java:289)
| [java] at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(S
| erviceMBeanSupport.java:245)
| [java] at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
| [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
| hodAccessorImpl.java:25)
| [java] at java.lang.reflect.Method.invoke(Method.java:585)
| [java] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(Reflected
| Dispatcher.java:155)
| [java] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| [java] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBean
| Invoker.java:264)
| [java] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.ja
| va:659)
| [java] at org.jboss.system.ServiceController$ServiceProxy.invoke(Servic
| eController.java:978)
| [java] at $Proxy0.start(Unknown Source)
| [java] at org.jboss.system.ServiceController.start(ServiceController.ja
| va:417)
| [java] at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
| [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
| hodAccessorImpl.java:25)
| [java] at java.lang.reflect.Method.invoke(Method.java:585)
| [java] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(Reflected
| Dispatcher.java:155)
| [java] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| [java] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBean
| Invoker.java:264)
| [java] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.ja
| va:659)
| [java] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210
| )
| [java] at $Proxy4.start(Unknown Source)
| [java] at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
| [java] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:102
| 5)
| [java] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:81
| 9)
| [java] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:78
| 2)
| [java] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:76
| 6)
| [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
| sorImpl.java:39)
| [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
| hodAccessorImpl.java:25)
| [java] at java.lang.reflect.Method.invoke(Method.java:585)
| [java] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(Reflected
| Dispatcher.java:155)
| [java] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| [java] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractI
| nterceptor.java:133)
| [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| [java] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invok
| e(ModelMBeanOperationInterceptor.java:142)
| [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| [java] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBean
| Invoker.java:264)
| [java] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.ja
| va:659)
| [java] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210
| )
| [java] at $Proxy5.deploy(Unknown Source)
| [java] at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:48
| 2)
| [java] at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
|
| [java] at org.jboss.Main.boot(Main.java:200)
| [java] at org.jboss.Main$1.run(Main.java:508)
| [java] at java.lang.Thread.run(Thread.java:595)
| [java] Caused by: java.lang.VerifyError: (class: org/jboss/cache/config/Con
| figuration, method: setCacheLoaderConfig signature: (Lorg/jboss/cache/config/Cac
| heLoaderConfig;)V) Incompatible argument to function
| [java] at org.jboss.cache.jmx.CacheJmxWrapper.getConfiguration(CacheJmx
| Wrapper.java:124)
| [java] at org.jboss.cache.jmx.CacheJmxWrapper.setTransactionManagerLook
| upClass(CacheJmxWrapper.java:545)
| [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
| sorImpl.java:39)
| [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
| hodAccessorImpl.java:25)
| [java] at java.lang.reflect.Method.invoke(Method.java:585)
| [java] at org.jboss.mx.interceptor.AttributeDispatcher.invoke(Attribute
| Dispatcher.java:136)
| [java] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| [java] at org.jboss.mx.interceptor.ModelMBeanAttributeInterceptor.invok
| e(ModelMBeanAttributeInterceptor.java:103)
| [java] at org.jboss.mx.interceptor.PersistenceInterceptor.invoke(Persis
| tenceInterceptor.java:76)
| [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| [java] at org.jboss.mx.server.AbstractMBeanInvoker.setAttribute(Abstrac
| tMBeanInvoker.java:461)
| [java] at org.jboss.mx.server.MBeanServerImpl.setAttribute(MBeanServerI
| mpl.java:608)
| [java] at org.jboss.system.ServiceConfigurator.setAttribute(ServiceConf
| igurator.java:694)
| [java] ... 82 more
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077469#4077469
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077469
18Â years, 8Â months
[JBoss Seam] - Re: EntityQuery (entity-query) General Performance Questions
by jfrankman
After more research I found most of the performance problems have to do with the generated DB2 SQL and the way DB2 handles the query. DB2 does not handle case insensitive searches by default. When a query is run like:
Select * from nametable where lower(lastname) like 'doe%'
A DB2 will use a tablescan even if there is an index on the lastname column. DB2 will not be able to use the index since the "lower" function can potentially contradict the order of the data contained in the index. Because of this I could find twp different ways to improve performance:
Option 1: Remove the "lower" from the HQL completely. This assumes that the column you are searching on is only one case, or you don't mind case-sensitive searches in your application.
Instead of this:
lower(fbclient.search) like concat(lower(#{fbclientList.fbclient.search}),'%')"
Use This:
fbclient.search like concat(#{fbclientList.fbclient.search},'%')"
Notice that I have removed the lower function from the right side of the predicate (like concat(lower(#{fbclientList.fbclient.search})). This is due to a bug in Hibernate with regards to DB2 where it generates invalid SQL. This is not to solve the performance problem. The left side of the predicate is what is important here.
Option 2: Where a case insensitive search is important and the data in the table is mixed case, I had to create a generated column in the table that would convert the mixed case column into a lower case column. This is a workaround in DB2 for case insensitive searches other databases would handle this differently. (see http://www.ibm.com/developerworks/db2/library/techarticle/0203adamache/02...)
So, first I had to create the column in DB2:
ALTER TABLE FBNEXUS.FBCLIENT ADD COLUMN
| SEARCH_LOWER VARCHAR (100) NOT NULL GENERATED ALWAYS AS (lower(search));
Then create an index over the generated column:
CREATE INDEX idx_xyz ON fbclient (search_lower)
Once this is finished, the SQL generated from the HQL will not cause any performance problems. DB2 will be able to use the idx_xyz to perform the search. Note that you do not have to map generated column "SEARCH_LOWER" to your entity class (or anywhere else in your code). DB2 will automatically use the index (idx_xyz) on the search_lower column when ever you specify a Lower(search) in the where clause. DB2 is at least smart enought to figure that out. Therefore, the generated SQL from this HQL:
lower(fbclient.search) like concat(#{fbclientList.fbclient.search},'%')"
will not result in a table scan (wich is the source of the poor performance) but instead will use the index idx_xyz.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077459#4077459
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077459
18Â years, 8Â months