[Beginners Corner] - First EBJ: Session Bean, Eclipse, JBOSS AS
by joeroyall
I am having trouble with a basic session bean. My understanding is that I don't need to initiate a session bean object because the EE framework will do it for me. Am I missing anything in my config?
Eclipse: Version: 3.3.1.1
WST 2.0.2
J2ee Standard Tools 2.0.2
JBOSS AS: 4.2
1. File --> New --> Project... --> EJB --> EJB Project
Target Runtime JBoss v4.2
Default Configuration for JBoss v4.2
Project Facet EBJ Module 3.0 Java 5.0
2. Create package
com.example.helloworld
3. Create interface -> HelloSessionLocal.java
package com.example.helloworld;
import javax.ejb.Local;
@Local
public interface HelloSessionLocal {
public void hello();
}
4. Create class HelloSession.java
package com.example.helloworld;
import javax.ejb.Stateless;
@Stateless
public class HelloSession implements HelloSessionLocal {
public HelloSession(){
}
public void hello(){
System.out.println("hello from ejb stateless bean");
}
}
5. New --> Project... --> Dynamic Web Project
HelloServlet
6. Properties --> J2EE Module Dependencies --> HelloWorld
7. New --> Other --> Web --> Servlet
HelloServlet.java
package com.example.helloservlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.example.helloworld.*;
import javax.ejb.EJB;
public class HelloServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
@EJB
public static HelloSession helloSession;
static final long serialVersionUID = 1L;
public HelloServlet() {
super();
}
public void init() throws ServletException {
System.out.println("hello servlet");
helloSession = new HelloSession();
helloSession.hello();
super.init();
}
}
8. Run as --> Jboss 4.2 Server --> Configured Projects HelloServlet, HelloWorld
9. Console Output
16:13:35,727 INFO [STDOUT] hello servlet
16:13:35,747 ERROR [[/HelloServlet]] StandardWrapper.Throwable
java.lang.NullPointerException
If I instiate HelloSession with helloSession = new HelloSession(); in main
then console output is as expected
116:15:21,516 INFO [STDOUT] hello servlet
16:15:21,522 INFO [STDOUT] hello from ejb stateless bean
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4142510#4142510
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4142510
18 years
[Performance Tuning] - Re: Low performance of jboss in windows server 2003
by PeterJ
If you bring up your virtual server, but do not bring up JBossAS, how much free physical memory do you have? That is the maximum you should set the Java heap.
On my Server 2003 system, which has 1024MB RAM, I have 550MB free, which suggest to me that you have very little free RAM. Also, is MySQL running on the same virtual system? If so, it also eats up quite a bit of RAM I imagine that you are thrashing your memory.
If you plan to run both MySQL and JBossAS on the same system I would not go below 2GB of RAM. If you run them on separate systems, 1GB for each system.
Your full GC to total GC ratio is very low, which is good, and makes me assume that your heap settings are good for your application. A detailed analysis of the gc data might offer some suggestions for improvement. See my presentation at http://www.cecmg.de/doc/tagung_2007/agenda07/24-mai/2b3-peter-johnson/ind...
The number of threads has more to do with the number of connections made. If you mean Java threads, then this represents the number of simultaneous HTTP connections. If you mean MySQL threads, then this depends on the number of database connections made, and the settings for the database connection pool.
We have gotten very good performance using JBossAS 4.0.2 and MySQL 4.1.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4142506#4142506
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4142506
18 years
[Performance Tuning] - Low performance of jboss in windows server 2003
by lquenta
We are using a web service developed in java hosted in a jboss 4.0.2, that is running on windows 2003 server and is using a MySql 1.1.20 as DBMS.
This application receives an xml string from the client, deserializes it and insert it on a table on the mySql DB, and finally sends it to another server that is outside our network.
The client application sends requests to this webservice and waits for an answer. This client application is a aspx web page, that is, multiple requests can occur at one time from multiple client machines.
Our problem: the more requests JBoss receives from client machines through the web service, the lower the performance gets. But even so, when only one client machine sends many requests (say 25+) the performance get reduce as well. We are seeing mainly three things:
1.Memory usage gets higher and full garbage collections become more usual, reaching a 4000 total CG and 10 Full GC. The process starts by inserting a record per second on MySQL, but ends up doing up to one record every 30-40 seconds.
2.Number of Threads goes up, from an initial 4-5 to pass 50. We assume this is linked to the first issue.
3.A lot of memory swap (all the time the process is running), which reduces disk space until eventually there is â0 bytesâ of free space in drive C:
What can we do to improve the performance of JBoss and make it restore the disk space when it finishes processing all the requests? We are running JBoss on a developing environment, thus our server is virtual and has 512MB of RAM. Could this too have an effect on the performance of JBoss? Are there any known issues in using MySQL with JBoss?
We are manually executing JBoss . The JVM heap configuration is as follows:
-Xms350m -Xmx350m -XX:NewSize=100m -XX:MaxNewSize=100m -XX:SurvivorRatio=30
This configuration has been the best weâve tried so far.
Any help will be cheerfully received. Thanks a lot.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4142502#4142502
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4142502
18 years
[Tomcat, HTTPD, Servlets & JSP] - Parse failed in JSP page with JavaHelp
by juleroy
I have a web application running in JBoss with a jsp page that has a link to a JavaHelp.
When I open the page I get the message:
[ServletException in:/config/Janela.jsp] Could not parse Got an IOException (Malformed UTF-8 char) Parsing failed for http://localhost:8080/AdminSADSXP/help/SadsXPHelp.hs'
In my jsp page I have:
| <jsp:useBean id="helpBroker" class="javax.help.ServletHelpBroker" scope="session" />
| <%@ taglib uri="/WEB-INF/jhlib.tld" prefix="jh" %>
|
| <jh:validate helpBroker="<%= helpBroker %>" helpSetName="AdminSADSXP/help/SadsXPHelp.hs"/>
| <a class="headerTabela_claro" href="javascript: openNewWindow('../help/help.jsp?id=Administrador.Configuracao.janela', 'helpWindow', 'WIDTH=700,HEIGHT=500,resizable=yes');">
| <img src="/AdminSADSXP/images/help.JPG" border="0"></a>
|
And my hs file is:
| <?xml version="1.0" encoding="ISO-8859-1" ?>
| <!--generated by JHelpDev Version: 0.62, 10 November 2006, see jhelpdev.sourceforge.net--><!DOCTYPE helpset PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 2.0//EN" "http://java.sun.com/products/javahelp/helpset_2_0.dtd">
|
| <helpset version="1.0">
| <title>Ajuda SadsXP </title>
| <maps>
| <homeID>top</homeID>
| <mapref location="Map.jhm"/>
| </maps>
| <view>
| <name>TOC</name>
| <label>TOC</label>
| <type>javax.help.TOCView</type>
| <data>SadsXPHelpTOC.xml</data>
| </view>
| <view>
| <name>Search</name>
| <label>Search </label>
| <type>javax.help.SearchView</type>
| <data engine="com.sun.java.help.search.DefaultSearchEngine">JavaHelpSearch</data>
| </view>
| <view>
| <name>Index</name>
| <label>Index </label>
| <type>javax.help.IndexView</type>
| <data>SadsXPHelpIndex.xml</data>
| </view>
| </helpset>
|
Can anyone help me?
Thanks,
Juliana Leroy.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4142494#4142494
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4142494
18 years