[JBoss Portal] - Performance with large CMS repository / cache preloading
by frontline
I noticed that the portal takes quite long to start up and eats a lot of memory when you have large amounts of data stored in the CMS.
I tracked this down to the class "JBossCachePersistenceManager", which apparently preloads stuff on startup into its caches.
A couple of questions:
- does this class actually read all the data from the database and cache it in memory?
- is it safe to disable this preloading? An if it's safe what is the correct way to do it (now I just commented out the preloading in the code and the portal seems to be working fine).
- why is this preloading needed in the first place and can the amount of stuff cached be adjusted somehow, this solution really doesn't scale that well...
Here are some performance numbers from the preloading, the strings are the hql:s run. The number is the time in milliseconds and the rows are the rows read from the database.
21:48:16,812 INFO [STDOUT] Time for: from org.jboss.portal.cms.hibernate.state.WSPRefs - 172, rows: 0
| 21:48:24,062 INFO [STDOUT] Time for: from org.jboss.portal.cms.hibernate.state.VersionRefs - 7422, rows: 4695
| 21:48:24,515 INFO [STDOUT] Time for: from org.jboss.portal.cms.hibernate.state.WSPNode - 7890, rows: 6076
| 21:48:33,828 INFO [STDOUT] Time for: from org.jboss.portal.cms.hibernate.state.VersionNode - 17219, rows: 36274
| 21:48:47,296 INFO [STDOUT] Time for: from org.jboss.portal.cms.hibernate.state.WSPProp - 30734, rows: 110958
| 21:49:32,828 INFO [STDOUT] Time for: from org.jboss.portal.cms.hibernate.state.VersionProp - 76266, rows: 319954
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4139941#4139941
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4139941
16 years, 9 months
[Beginners Corner] - Cannot instantiate class: org.jnp.interfaces.NamingContextF
by JuliaF
Hello
I tried to deploy and run a simple EJB tester app on JBoss 5 beta using a SessionBean and I am getting the following exception
-----------------------
Exception in thread "main" javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory
[Root exception is java.lang.ClassNotFoundException:org.jnp.interfaces.NamingContextFactory]
-----------------------
I have tried different approaches but with no luck.
The structure of my simple_session.ear file deployed in %JBOSS_HOME%/server/default/deploy is this:
simple_session/META-INF/Applicaiton.xml
simple_session/META-INF/MANIFEST.MF
simple_session/beans.jar
simple_session/client.jar
beans.jar consists of
lemonpress\beans\SimpleSession.class
lemonpress\beans\SimpleSessionBean.class
META-INF\ejb-jar.xml
META-INF\MANIFEST.MF
client.jar consists of
lemonpress\client\SimpleSessionClient.class
META-INF\applicaiton-client.xml
META-INF\MANIFEST.MF
jndi.properties
The source of lemonpress\client\SimpleSessionClient.class in client.jar
package lemonpress.client;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import lemonpress.beans.SimpleSession;
public class SimpleSessionClient {
public static void main(String args[]) throws NamingException{
System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
System.setProperty("java.naming.provider.url", "localhost:1099");
System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
properties.put(Context.PROVIDER_URL, "localhost:8080");
properties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
InitialContext ctx = new InitialContext();
SimpleSession ss = (SimpleSession) ctx.lookup(SimpleSession.class.getName());
System.out.println("lookup returned " + ss.toString());
String result = ss.getEchoString("It has worked");
System.out.println(result);
}
}
As a measure of desperation I also included the file
jndi.properties in client.jar
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=jnp://localhost:1099
and referenced it in client\META-INF\MANIFEST.MF
Manifest-Version: 1.0
Class-Path: beans.jar jndi.properties
Main-Class: lemonpress.client.SimpleSessionClient
initially I ran the project as
simple_session> java -jar client.jar
Then after reading about in forums (sadly, mostly relating to Jboss 4.x and not much on 5.x)
I came to adding more and more code to the SimpleSessionClient.java and modifying way to run the client.jar
to resolve this issue of binding the interface to the the JNDI Factory class that should return the missing Application Context.
Apart from blown up code in the SimpleSessionClient
other things that I tried include running the client.jar as
A)
simple_session> java -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces -Djava.naming.provider.url=localhost:1099 -jar client.jar
B)
simple_session> set CLASSPATH=.;C:\jboss\client\jbossall-client.jar;C:\jboss\lib\concurrent.jar;C:\jboss\lib\jboss-common-core.jar;C:\jboss\lib\jboss-aop-jdk50.jar;C:\jboss\client\concurrent.jar;C:\jboss\client\jboss-common-client.jar;C:\jboss\client\jboss-javaee.jar;C:\jboss\client\jboss-transaction-client.jar;C:\jboss\client\jbosssx-client.jar;C:\jboss\client\jnp-client.jar;C:\jboss\server\default\lib\commons-httpclient.jar;C:\jboss\server\default\lib\jboss.jar;C:\jboss\server\default\lib\jboss-remoting.jar;C:\jboss\server\default\lib\jnpserver.jar;C:\jboss\server\default\deployers\ejb3.deployer\jboss-ejb3.jar;C:\jboss\server\default\deployers\jboss-aop-jboss5.deployer\jboss-aspect-library-jdk50.jar;
simple_session> java -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces -Djava.naming.provider.url=localhost:1099 -jar client.jar
As you can see I tried a few different ways of including reference to JNDI to my client but with no avail.
I start JBoss with default configuration and it does recognize and register my SimpleSessionBean in JNDI
In startup output it gives only one WARN message
17:02:27,265 WARN [QuartzTimerServiceFactory] sql failed: CREATE TABLE qrtz_job_details(JOB_NAME VARCHAR(80) NO
T NULL, JOB_GROUP VARCHAR(80) NOT NULL, DESCRIPTION VARCHAR(120) NULL, JOB_CLASS_NAME VARCHAR(128) NOT NULL, IS_
DURABLE VARCHAR(1) NOT NULL, IS_VOLATILE VARCHAR(1) NOT NULL, IS_STATEFUL VARCHAR(1) NOT NULL, REQUESTS_RECOVERY
VARCHAR(1) NOT NULL, JOB_DATA BINARY NULL, PRIMARY KEY (JOB_NAME,JOB_GROUP))
However, later it says
17:02:29,437 INFO [StdSchedulerFactory] Quartz scheduler 'JBossEJB3QuartzScheduler' initialized from an externally provided properties instance.
17:02:29,437 INFO [StdSchedulerFactory] Quartz scheduler version: 1.5.2
....
17:03:01,484 INFO [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
It binds JNDI
17:02:25,328 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
And registers my SimpleSessionBean
17:03:03,343 INFO [MCKernelAbstraction] installing bean: jboss.j2ee:ear=simple_session.ear,jar=client.jar,name=client,service=EJB3 with dependencies:
17:03:03,343 INFO [MCKernelAbstraction] and supplies:
17:03:03,640 INFO [ClientENCInjectionContainer] STARTED CLIENT ENC CONTAINER: client
17:03:08,062 INFO [MCKernelAbstraction] installing bean: jboss.j2ee:ear=simple_session.ear,jar=beans.jar,name=SimpleSessionBean,service=EJB3 with dependencies:
17:03:08,062 INFO [MCKernelAbstraction] and supplies:
17:03:08,078 INFO [MCKernelAbstraction] Class:lemonpress.beans.SimpleSession
17:03:10,812 INFO [EJBContainer] STARTED EJB: lemonpress.beans.SimpleSessionBean ejbName: SimpleSessionBean
Could anyone help me to resolve this seemingly dead-end situation?
Many thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4139939#4139939
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4139939
16 years, 9 months
[Clustering/JBoss] - Re: How do servlets communicate with session beans across cl
by bstansberry@jboss.com
Inside your servlet, you need to do a JNDI lookup to the other cluster. Probably best thing is to use HA-JNDI with autodiscovery enabled so you aren't forced to statically list the JNDI hostnames/ports of the ejb cluster members:
| Properties p = new Properties();
| p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
| // Ensure we only find servers on the "EJBPartition"
| p.put("jnp.partitionName", "EJBPartition");
| Context ctx = new InitialContext(p);
| MyEJB ejb = (MyEJB) ctx.lookup("myEjbName");
|
See also http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossHAJNDIUseCluster . Note that the examples on that page describe using "localhost:1100" which is based on the idea you want to find the HA-JNDI for the same cluster the client is in. If you were to use the jboss-web.xml resource-ref mapping described on that page, for the jndi-name element you would have to replace localhost:1100 with the hostname:port of *one* of the "EJBPartition" servers. Problem with doing that is if that server isn't running for some reason, you won't be able to find any of the other servers and can't do the lookup, even though other servers in the EJBPartition are running. To avoid that problem, don't try and use resource-ref mapping; just do the lookup programatically as shown above.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4139930#4139930
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4139930
16 years, 9 months
[JBossWS] - Ejb3.0 Stateless session bean as webservice in jboss4.2.2
by HTCPrasad
I had created three files like
SimpleWS.java
package com.htc.htcws;
import javax.jws.WebService;
import javax.jws.WebMethod;
import java.rmi.Remote;
import java.rmi.RemoteException;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
@WebService
@SOAPBinding(style=Style.RPC)
public interface SimpleWS extends Remote
{
@WebMethod
public String greet(String person)
throws RemoteException;
}
SimpleWSBean.java
package com.htc.htcws;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
@Stateless
@Remote(SimpleWS.class)
@WebService(endpointInterface="com.htc.htcws.SimpleWS")
@SOAPBinding(style=SOAPBinding.Style.RPC)
public class SimpleWSBean implements SimpleWS
{
@WebMethod
public String greet(String person)
{
return "Hi "+person+" all Good Wishes for Tamil New Year's Day";
}
}
SimpleWSClient.java
package com.htc.htcws;
import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.Service;
import javax.xml.namespace.QName;
import java.net.URL;
import org.apache.log4j.Logger;
import org.apache.log4j.FileAppender;
import org.apache.log4j.HTMLLayout;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service.Mode;
import javax.xml.ws.Response;
import java.io.StringReader;
public class SimpleWSClient
{
static Logger logger;
public static void main(String[] args)
{
final String _NAMESPACE = "http://htcws.htc.com/";
final String _SERVICE = "SimpleWSBeanService";
try
{
logger = Logger.getRootLogger();
logger.addAppender(new FileAppender(new HTMLLayout(),
"mylog1.log",true));
URL url =
new URL("http://127.0.0.1:10080/simpws/SimpleWSBean?wsdl");
QName qName = new QName(_NAMESPACE,_SERVICE);
if(args.length!=1)
{
System.out.print("Give the person-name as args[0]");
System.exit(1);
}
ServiceFactory sFactory = ServiceFactory.newInstance();
Service service = sFactory.createService(url,qName);
System.out.println(".."+service);
SimpleWS invoker =
(SimpleWS)service.getPort(SimpleWS.class);
System.out.println("##"+invoker);
String res = invoker.greet(args[0]);
System.out.println("Response is::"+res);
}
catch(Exception ex)
{
System.err.println("Caught the exception as"+ex);
}
}
}
the bean getting deployed.but whie running client the error is
java:
[java] ..org.jboss.ws.core.jaxrpc.client.ServiceImpl@b8c8e6
[java] ##org.jboss.ws.core.jaxrpc.client.CallImpl@1542a75
[java] Caught the exception asjava.rmi.RemoteException: Call invocation failed; nested exception is:
[java] java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
My os is windows vistas ,browser is firefox beta4.0
can you please suggest where the error is or how to use Dispatch,Response objects here
mail is dtrprasad(a)gmail.com
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4139926#4139926
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4139926
16 years, 9 months