Win a copy of Head First Android this week in the Android forum!

Walker Rustin

Ranch Hand
+ Follow
since Mar 08, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Walker Rustin

None of the use cases talk about the frequent flyer mileage sytem(FFMS). In a real world case after the payment is successfully paid, the system should automatically update the FFMS but the use cases given in the assignement don't talk about it.

I'm assuming that that I don't have to show any interaction with FFMS in the squence diagrams.

thanks.
You didn't mentiond the version of jboss you are running.
The latest version of jboss comes with hypersonic db embedded and the default JNDI settings are point to hyspersonic. It's quite possible that in service.xml you are not starting the hypersonic database. Post your service.xml if you have any difficulty.
- Walker
17 years ago
You didn't clearly mentiond if you are using the default tomcat that comes with jboss or you installed tomcat seperately. If you are just starting the best policy would be to just let jboss manage it.
It also seems that the files are not deployed properly. I would advice you to finish the jboss tutorial first.
application.xml file contains the context name. YOu need to fill that out.

- Walk
17 years ago
Try deploying the app not in the .ear format but in the directory fashion. In this way without any extra trouble you should be able to see if the missing classes are at the right place or not. You can unzip .ear file too but it's rather tedious process.
- Walk
17 years ago
I sometimes get this message when I start jboss without any deployment. More often than not the root cause is some kind of network error. Undeploy the application and restart jboss. Make sure that jobss starts properly.
Good luck!
- Walk
17 years ago
IT WORKS!
Here is the complete code:
ejb-jar.xml
<entity>
<display-name>EmployeeEJB</display-name>
<ejb-name>EmployeeEJB</ejb-name>
<local-home>employee.ejb.com.sbm.cts.EmployeeHome</local-home>
<local>employee.ejb.com.sbm.cts.Employee</local>
<ejb-class>employee.ejb.com.sbm.cts.EmployeeBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>EmployeeSchema</abstract-schema-name>
<cmp-field><field-name>firstname</field-name></cmp-field>
<cmp-field><field-name>lastname</field-name></cmp-field>
<cmp-field><field-name>telephone</field-name></cmp-field>
<cmp-field><field-name>employeeid</field-name></cmp-field>

<primkey-field>employeeid</primkey-field>
<resource-ref>
<res-ref-name>jdbc/ctsDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</entity>

jbosscmp-jdbc.xml
<entity>
<ejb-name>EmployeeEJB</ejb-name>
<table-name>employee</table-name>

<cmp-field>
<field-name>firstname</field-name>
<column-name>firstname</column-name>
</cmp-field>
<cmp-field>
<field-name>lastname</field-name>
<column-name>lastname</column-name>
</cmp-field>
<cmp-field>
<field-name>telephone</field-name>
<column-name>telephone</column-name>
</cmp-field>
<cmp-field>
<field-name>employeeid</field-name>
<column-name>employeeid</column-name>
<auto-increment/>
<not-null/>
</cmp-field>
<entity-command name="mysql-get-generated-keys"
class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCMySQLCreateCommand"/>
</entity>

code:
// HOME methods
public Integer ejbCreate(EmployeeDetails employeeDetails) throws CreateException {
logger.debug("ejbCreate");
try {
BeanUtils.copyProperties(this, employeeDetails);
} catch (java.lang.reflect.InvocationTargetException e) {
//nothing to log. It's expected because the primary key can't be
// changed.
logger.error("error in invocation" + e.getMessage());
} catch (Exception e) {
logger.error(e.getMessage());
}
return null;
}
public void ejbPostCreate(EmployeeDetails employeeDetails) {
logger.debug("ejbPostCreate");
}
// CMP field accessors
public abstract String getFirstname();
public abstract void setFirstname(String firstname);
public abstract String getLastname();
public abstract void setLastname(String lastname);
public abstract String getTelephone();
public abstract void setTelephone(String telephone);

public abstract Integer getEmployeeid();
public abstract void setEmployeeid(Integer employeeid);
sql code:
CREATE TABLE employee
(
firstname VARCHAR(30),
lastname VARCHAR(30),
telephone VARCHAR(30),
employeeid int(4) auto_increment,
CONSTRAINT pk_user PRIMARY KEY (employeeid)
);
Thanks everyone.
- walker
17 years ago
What's the idea of using 'entity-command'. I suppose it is used so that the database doesn't have to generate the primary key for a record. By using this feature, the developer is asking jboss to generate a primary key and pass that key to the database. It means the primary key on the database should NOT be marked at auto-increment.
Is that assumption correct? Or Do I need to mark both at the jboss level and at the database level as auto-increment. Do they work in conjunction?
thanks.
- Walker
17 years ago
xdoclete web site says that the current version supports only jboss 3.1. I am using jboss 3.2. Should I use xdoclet in my application? Is there a work around?
- Walk Rustin
17 years ago
Here is my log4j.xml
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="Target" value="System.out"/>
<!-- I changed the value below from INFO to DEBUG -->
<param name="Threshold" value="DEBUG"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
</layout>
</appender>
The only change I made (as the comment suggests) is to change the level from INFO to DEBUG. Because of the change in the console I am getting all the debug messages which is great. I am also getting DEBUG level messages for struts 1.1 which is a lot of messages. Is there a way to have my code level to be DEBUG and all the struts code to have level INFO.
thanks.
- walk rustin
17 years ago
Does anyone know of a good tool to format HTML/JSP code?
thanks.
- Walk Rustin
17 years ago
layout1.jsp is
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html>
<head>
<html:base />
</head>
<body>
<tiles:insert attribute="header" />
</body>
</html:html>
search1.jsp is
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<tiles:insert page="layout1.jsp" flush="true">
<tiles ut name="header" value="test.jsp" />
</tiles:insert>
test.jsp is
this is a test page
I am getting the following error:
org.apache.jasper.JasperException: Unable to compile class for JSP
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:478)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
at java.lang.Thread.run(Thread.java:534)
root cause
java.lang.NullPointerException
at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:119)
at org.jboss.mx.loading.UnifiedClassLoader3.loadClassImpl(UnifiedClassLoader3.java:169)
at org.jboss.mx.loading.UnifiedClassLoader3.loadClass(UnifiedClassLoader3.java:123)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at org.apache.tools.ant.Project.init(Project.java:274)
at org.apache.jasper.compiler.Compiler.getProject(Compiler.java:172)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:273)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
at java.lang.Thread.run(Thread.java:534)
Apache Tomcat/4.1.29
17 years ago
Thanks for the quick response. Appreciate it.
- walk rustin
SCBCD
In stateful session beans we are not allowed to use collections which are not serializable. I tested that by using HashTable and it indeed fails. My question is: what should I use in case I need to have a collection class.
thanks.
- walk rustin
Here is the code:
try{
userController.createUser(userDetails);
}catch(CreateException ex){
s.setAttribute("user.failure.create","something");
return mapping.findForward("failure");
}
I am trying to insert an entity and userController is a session bean to which a value object( a standard java bean) is being passed. The createUser method of session bean throws just one CreateException.
My question is: Should I handle just CreateException in the servlet. Obviously the container could throw EJBEXception (or any of the run time exceptions too). Or should all clietn handle catch(Exception e) {}.
thanks.
- walk rustin
It seems to me the error has more to do with web-app and not with ejb. Try deploying just the web components independent of ejb and see if that works.
- walk rustin
17 years ago