M M Islam Chisty

Greenhorn
+ Follow
since Aug 31, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by M M Islam Chisty

Hi,

The following error show up while I try to display a simple page. It might be a EL Resolver issue. I can't figure it out. Any suggestion would be highly apprciable:


[NRBSERVICE-APP] INFO [http-8081-1] UserManagerImpl.findUserByEmail(85) | Email from parameter = [email protected]
[NRBSERVICE-APP] INFO [http-8081-1] UserManagerImpl.findUserByEmail(86) | uservo value = pwd12345
[NRBSERVICE-APP] INFO [http-8081-1] UserManagerImpl.loadUserByUsername(110) | User is loading ..... [email protected]
[NRBSERVICE-APP] INFO [http-8081-1] UserManagerImpl.makeGrantedAuthorities(126) | Role name =GENERAL_MEMBER
Aug 9, 2008 10:49:50 AM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.UnsupportedOperationException
at javax.faces.application.Application.getELResolver(Application.java:60)
at org.apache.myfaces.context.servlet.FacesContextImpl.getELContext(FacesContextImpl.java:347)
at org.apache.myfaces.taglib.core.ViewTag.setProperties(ViewTag.java:143)
at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:1016)
at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:431)
at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:103)
at org.apache.jsp.pages.users.myHomePageView_jsp._jspx_meth_f_005fview_005f0(myHomePageView_jsp.java:92)
at org.apache.jsp.pages.users.myHomePageView_jsp._jspService(myHomePageView_jsp.java:66)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:338)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.buildView(JspViewHandlerImpl.java:481)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:334)
at de.mindmatters.faces.lifecycle.RenderResponsePhase.executePhase(RenderResponsePhase.java:45)
.....
....
....

[NRBSERVICE-APP] ERROR [http-8081-1] _ErrorPageWriter.handleException(350) | An exception occurred
javax.faces.FacesException: An exception occurred processing JSP page /pages/users/myHomePageView.jsp at line 4

1: <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
2: <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
3:
4: <f:view>
5: <html>
6: <body>
7: <h1>This is a test page</h1>


Stacktrace:
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:344)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.buildView(JspViewHandlerImpl.java:481)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:334)
at de.mindmatters.faces.lifecycle.RenderResponsePhase.executePhase(RenderResponsePhase.java:45)
at de.mindmatters.faces.lifecycle.AbstractPhase.execute(AbstractPhase.java:37)
at de.mindmatters.faces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:166)
at de.mindmatters.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:226)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:359)
at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:99)
at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:52)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
.....


at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.jasper.JasperException: An exception occurred processing JSP page /pages/users/myHomePageView.jsp at line 4

1: <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
2: <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
3:
4: <f:view>
5: <html>
6: <body>
7: <h1>This is a test page</h1>


Stacktrace:
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:524)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:417)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:338)
... 79 more
Caused by: javax.servlet.ServletException: javax.servlet.jsp.JspException: java.lang.UnsupportedOperationException
at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
at org.apache.jsp.pages.users.myHomePageView_jsp._jspService(myHomePageView_jsp.java:75)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
... 89 more
Caused by: java.lang.UnsupportedOperationException
at javax.faces.application.Application.getELResolver(Application.java:60)
at org.apache.myfaces.context.servlet.FacesContextImpl.getELContext(FacesContextImpl.java:347)
at org.apache.myfaces.taglib.core.ViewTag.setProperties(ViewTag.java:143)
at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:1016)
at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:431)
at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:103)
at org.apache.jsp.pages.users.myHomePageView_jsp._jspx_meth_f_005fview_005f0(myHomePageView_jsp.java:92)
at org.apache.jsp.pages.users.myHomePageView_jsp._jspService(myHomePageView_jsp.java:66)
... 92 more
..........


Now my environemnt is as follows:

JSP page: It is very simple as follows but it is not displayed, rather shows the above error:
---------
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>

<f:view>
<html>
<body>
<h1>This is a test page</h1>
<h:form>

<h:commandLink action="#{propertyMgtBeanAction.displayPropertyForm}" value="Add property"/>
</h:form>
</body>
</html>
</f:view>

The tomcat version is: apache-tomcat-6.0.14

Jars I'm using are: myfaces-impl-1.2.3.jar, myfaces-api-1.2.3.jar

My web.xml file:
-------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">

<display-name>NS_APP</display-name>


<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>


<context-param>
<param-name>
javax.servlet.jsp.jstl.fmt.localizationContext
</param-name>
<param-value>ApplicationResources</param-value>
</context-param>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:applicationContext-dao-common.xml
classpath:applicationContext-dao-ns.xml
classpath:applicationContext-jbpm.xml
classpath:spring-security.xml<!-- TODO: Commented for temporary purpose. Uncomment this as required. -->
</param-value>
</context-param>

<filter>
<filter-name>securityFilter</filter-name>
<filter-class>
org.springframework.security.util.FilterToBeanProxy
</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>
org.springframework.security.util.FilterChainProxy
</param-value>
</init-param>
</filter>

<filter-mapping>
<filter-name>securityFilter</filter-name>
<url-pattern>*.jsf</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>securityFilter</filter-name>
<url-pattern>/j_spring_security_check</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>securityFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>


<!-- Actually the following is not required I guess. It is reuired only if I choose to use Tomcahawk. So I commented it -->
<!-- filter>
<filter-name>MyFacesExtensionsFilter</filter-name>
<filter-class>
org.apache.myfaces.webapp.filter.ExtensionsFilter
</filter-class>
<init-param>
<param-name>uploadMaxFileSize</param-name>
<param-value>20m</param-value>
<description>
Set the size limit for uploaded files. Format: 10 - 10
bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
</description>
</init-param>
</filter>
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>/faces/*</url-pattern>
</filter-mapping -->



<filter>
<filter-name>sitemesh</filter-name>
<filter-class>
com.opensymphony.module.sitemesh.filter.PageFilter
</filter-class>
</filter>

<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>


<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
</filter-class>
</filter>

<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>



<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>

<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>

<listener>
<listener-class>
<!-- com.sun.faces.config.ConfigureListener -->
org.apache.myfaces.webapp.StartupServletContextListener
</listener-class>
</listener>

<session-config>
<session-timeout>5</session-timeout>
</session-config>

<welcome-file-list>
<welcome-file>index.jsf</welcome-file>
<welcome-file>main.jsf</welcome-file>
</welcome-file-list>

</web-app>

16 years ago
JSF
Hi,

I'm facing the following problem while trying to access a application deployed in WebSphere 5.1. I need to use RMI feature since the application (business logic, hibernate transaction beans etc) will be deployed in WAS 5.1 and will be accessed by RMI from outside client application. I'm using Spring and Hibernate for this application. I created the war, deployed in WAS 5.1. But when I tried to access it though rmi, I get the following error (java.net.SocketTimeoutException: Read timed out):

[Note: We can't upgrade to WAS 6.x versions at this time because this is our customer's side environment/requirements]

Here is the Error Details:
================

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mProductSearchServiceProxyClient' defined in file [C:\WorkSpaceJ4\TestRMI\src\resources\service-rmiproxy.xml]: Cannot resolve reference to bean 'mProductSearchServiceProxy' while setting bean property 'productSearchService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mProductSearchServiceProxy' defined in file [C:\WorkSpaceJ4\TestRMI\src\resources\service-rmiproxy.xml]: Invocation of init method failed; nested exception is org.springframework.remoting.RemoteLookupFailureException: Lookup of RMI stub failed; nested exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
java.net.SocketTimeoutException: Read timed out

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mProductSearchServiceProxy' defined in file [C:\WorkSpaceJ4\TestRMI\src\resources\service-rmiproxy.xml]: Invocation of init method failed; nested exception is org.springframework.remoting.RemoteLookupFailureException: Lookup of RMI stub failed; nested exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
java.net.SocketTimeoutException: Read timed out

Caused by: org.springframework.remoting.RemoteLookupFailureException: Lookup of RMI stub failed; nested exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
java.net.SocketTimeoutException: Read timed out

Caused by: java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
java.net.SocketTimeoutException: Read timed out
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:273)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:306)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:84)
at org.springframework.remoting.rmi.RmiClientInterceptor.lookupStub(RmiClientInterceptor.java:198)
at org.springframework.remoting.rmi.RmiClientInterceptor.prepare(RmiClientInterceptor.java:145)
at org.springframework.remoting.rmi.RmiClientInterceptor.afterPropertiesSet(RmiClientInterceptor.java:133)
at org.springframework.remoting.rmi.RmiProxyFactoryBean.afterPropertiesSet(RmiProxyFactoryBean.java:74)
...



Here is my server side config file (applicationContext-service.xml):
===========================================
... ..
..

<bean id="serviceExporter" class="org.springframework.remoting.rmi.RmiServiceExporter">
<property name="serviceName">
<value>mProductSearchServiceRMI</value>
</property>
<property name="service">
<ref local="mProductSearchService" />
</property>
<property name="serviceInterface">
<value>ims.dashboard.cmscpa.service.interfaces.ProductSearchService</value>
</property>
<property name="registryPort">
<value>2809</value>
</property>
<property name="servicePort">
<value>2222</value> <!-- 9001 -->
</property>
</bean>

..



Here is my client side config file (service-rmiproxy.xml):
====================================
.....

<bean id="mProductSearchServiceProxyClient"
class="ws.ims.dashboard.cmscpa.rmiproxy.ProductSearchServiceRmiProxyClient">
<property name="productSearchService">
<ref local="mProductSearchServiceProxy" />
</property>
</bean>

<bean id="mProductSearchServiceProxy"
class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
<property name="serviceUrl" value="rmi://bddh01-w0025:2809/mProductSearchServiceRMI"/>
<property name="serviceInterface" value="ims.dashboard.cmscpa.service.interfaces.ProductSearchService"/>
</bean>
..



And my client side code:
================

public class ProductSearchServiceRmiProxyClient {

private ProductSearchService mProductSearchService;

public static void main(String[] args) throws Exception {
ApplicationContext ctx = new FileSystemXmlApplicationContext(
"C:/WorkSpaceJ4/TestRMI/src/resources/service-rmiproxy.xml");
ProductSearchServiceRmiProxyClient proxyClient = (ProductSearchServiceRmiProxyClient) ctx.getBean("mProductSearchServiceProxyClient");
proxyClient.run();
}
/**
* @return the productSearchService
*/
public ProductSearchService getProductSearchService() {
return mProductSearchService;
}

/**
* @param productSearchService the productSearchService to set
*/
public void setProductSearchService(ProductSearchService productSearchService) {
mProductSearchService = productSearchService;
}


public void run() {

System.out.println("Getting rmi narp value: " + mProductSearchService.findNarpStatesByName("ZYPREXA101").get(0));
}
}




Can you suggest anything? The same application works fine if it is deployed in Tomcat 5.5. Why is it showing timeout in WAS 5.1? Is there anything I'm missing?

Thanks,
... Chisty
[ November 07, 2007: Message edited by: M M Islam Chisty ]
17 years ago
Hi,

I have a question about accessing JNDI resource outside container. Here is the scenario:

- our front-end has a Sun WS server. The application war file will be deployed here
- the middle tier has WebSphere application server 5.1. The connection pooling will be created here which will have access to the backend DB. Say e.g. the JNDI DataSource name for this pool is "jdbc/TestDS".

Now if the application deployed in the front end has to access this DataSource, how can I do that? More specially, if the war file was deployed on the same server (WAS 5.1) and connection pool was created from there, then we could easily configure this in our Spring applicationConetxt.xml file as follows:

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"><value>jdbc/TestDS</value></property>
</bean>

But this is not the case. Our war is deployed in Sun WS, but this application will use the JNDI DataSource created on WAS 5.1. How can I configure this in the applicationContext.xml file? Will the above configuration work?

Any suggestion from you would be highly appreciable.

Thanks,
... Chisty
[ November 02, 2007: Message edited by: M M Islam Chisty ]
Hello Friends,

We have a requirement to deploy a web application in IBM's WAS 5.1; this web app is developed using Struts 2.0.8, Hibernat3.2 and Spring 2.0.6. The JDK version is of course 5. Now we have to deploy this in WAS 5.1.

The problem is: WAS 5.1 does not support JDK 5. So the obvious choice is to convert it to JDK 4. We used backport to convert and make this war JDK 1.4 compatible.

[Source:
http://cwiki.apache.org/S2WIKI/sample-applications-with-java-14x.html, http://people.apache.org/builds/struts/nightlies/2.0.x/java-1.4/backport/]

The converted war works fine with Sun WS 6.1 but this does not work with WAS 5.1; I tried with the struts2-blank.war that comes with the bundled struts2 but this does not work either. I tried with the followings:
-Extracted struts2-blank war
-Updated the web.xml in the struts-blank.war (e.g. DOCTYPE inclusion, webapp attributes modify etc)
-Converted the library jars into jdk 4 compatible (using backport)
-Recreated the war (with jar command)
-Converted the war into jdk 4 compatible (using backport)
-Deployed the war into WAS 5.1
-But a error message shows up �Error 404: File not found: example/HelloWorld.action�

So for now, I just simply want to know: how can we deploy a simple struts 2 based war in WAS 5.1? [Please keep in mind that Struts 2 does not support JDK1.4).

Can you please provide me some suggestion? I need this solution very urgently.

With Thanks,
... M Chisty
17 years ago
Hi,

I hope you can provide me some guidelines. My objective is to handle(display) large volume of data using Hibernate and Stored Procedure. To do this, I like to apply pagination. i.e. rather than loading the whole bunch of rows (from a select query) into memory, I would like to pass some paramers to hibernate Query (e.g. page number, #rows per page .. etc), and show results page by page. I'm using hibernate with Oracle SP, spring and extrememcomponents.

Here are my codes:
[in the action class]

Context context = new HttpServletRequestContext(getRequest());
LimitFactory limitFactory = new TableLimitFactory(context);
Limit limit = new TableLimit(limitFactory);
metadataList = metadataManager.getMetadatas(metadataWo, limit.getPage()); // The obejctive is to view this metadatalist into JSP page


[in the service layer]

public List getMetadatas(final MetadataWo metadataWo, int pageNo) {
final int defaultRows = 50;
int startRow = (pageNo - 1) * defaultRows ;
return dao.getMetadatas(metadataWo, startRow, defaultRows);
}


[in the dao layer]

Query q = null;

q = session.getNamedQuery("getMetadatasSP");

q.setString(0, metadataWo.getPsId()).
setString(1,metadataWo.getMetadataId()).
setString(2,metadataWo.getDocumentName()).
setString(3,metadataWo.getLocationCode()).
setString(4,metaDataObjectType).
setString(5,metadataWo.getUpdatedBy()).
setString(6,metadataWo.getBuCode()).
setString(7,metadataWo.getGxpRelevance()).
setString(8,metadataWo.getDetailsGxpAssessment()).
setString(9,metadataWo.getBuRelevance()).
setString(10,metadataWo.getBuCriticalityAssessment()).
setString(11, metadataWo.getFailureConsequence()).
setString(12, metadataWo.getDetailsFailureConsequence()).
setString(13, metadataWo.getTestingRequirement()).
setString(14,metadataWo.getDetailsTestingRequirement()).
setString(15,metadataWo.getTestPerformedApproved()).
setString(16, metadataWo.getSystemType()).
setString(17, metadataWo.getRelatedCoreItem()).
setString(18, metadataWo.getStatusName()).
setString(19, metadataWo.getCrId()).
setString(20,metadataWo.getIsSearchForExport()).
setString(21, metadataWo.getFromDay()).
setString(22, metadataWo.getFromMonth()).
setString(23, metadataWo.getFromYear()).
setString(24,metadataWo.getToDay()).
setString(25,metadataWo.getToMonth()).
setString(26,metadataWo.getToYear());

q.setFirstResult(startRow); // line test#1
q.setMaxResults(endRow); // line test#2

result = q.list(); // AT THIS STAGE, THE APPLICATION GETS THE ERROR. CAUGHT BY A TRY-CATCH BLOCK

______________________________________________________________


Now, if I try to view the results in JSP page, error shows up. At the tomcat console, the following error message is generated:

java.lang.NullPointerException
at oracle.jdbc.ttc7.TTCAdapter.newTTCType(TTCAdapter.java:300)
at oracle.jdbc.ttc7.TTCAdapter.createNonPlsqlTTCColumnArray(TTCAdapter.java:270)
at oracle.jdbc.ttc7.TTCAdapter.createNonPlsqlTTCDataSet(TTCAdapter.java:231)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1937)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:880)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2516)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2850)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:609)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:685)
at org.hibernate.dialect.Oracle9Dialect.getResultSet(Oracle9Dialect.java:278)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:146)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1666)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:111)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1655)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:164)
at com.mh.pep.dao.MetadataDaoHibernate$2.doInHibernate(MetadataDaoHibernate.java:1216)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:362)
at org.springframework.orm.hibernate3.HibernateTemplate.executeFind(HibernateTemplate.java:332)
at com.mh.pep.dao.MetadataDaoHibernate.getMetadatas(MetadataDaoHibernate.java:1136)
at com.mh.pep.service.MetadataManagerImpl.getMetadatas(MetadataManagerImpl.java:1003)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:280)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
at $Proxy5.getMetadatas(Unknown Source)
at com.mh.pep.webapp.action.MetadataAction.searchList(MetadataAction.java:748)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:360)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:228)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:202)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:177)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:115)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.intercept(ParametersInterceptor.java:147)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:204)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.intercept(PrepareInterceptor.java:115)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:156)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)


.....

Interestingly, if I omit the lines (marked as line test#1 and line test#2) specified in the DAO layer, the result shows fine. But this does not solve my problem. Because without setting the firstResult and maxResult, it will work fine upro 10,000 or, 20,000 rows. But if the returned rows are more than that, there will be memory leak.


Can you suggest something? How can I apply pagination with Hibernate and SP?


Thanks,
... Chisty
Hi,

I hope you can provide me some guidelines. My objective is to handle(display) large volume of data using Hibernate and Stored Procedure. To do this, I like to apply pagination. i.e. rather than loading the whole bunch of rows (from a select query) into memory, I would like to pass some paramers to hibernate Query (e.g. page number, #rows per page .. etc), and show results page by page. I'm using hibernate with Oracle SP, spring and extrememcomponents.

Here are my codes:
[in the action class]

Context context = new HttpServletRequestContext(getRequest());
LimitFactory limitFactory = new TableLimitFactory(context);
Limit limit = new TableLimit(limitFactory);
metadataList = metadataManager.getMetadatas(metadataWo, limit.getPage()); // The obejctive is to view this metadatalist into JSP page


[in the service layer]

public List getMetadatas(final MetadataWo metadataWo, int pageNo) {
final int defaultRows = 50;
int startRow = (pageNo - 1) * defaultRows ;
return dao.getMetadatas(metadataWo, startRow, defaultRows);
}


[in the dao layer]

Query q = null;

q = session.getNamedQuery("getMetadatasSP");

q.setString(0, metadataWo.getPsId()).
setString(1,metadataWo.getMetadataId()).
setString(2,metadataWo.getDocumentName()).
setString(3,metadataWo.getLocationCode()).
setString(4,metaDataObjectType).
setString(5,metadataWo.getUpdatedBy()).
setString(6,metadataWo.getBuCode()).
setString(7,metadataWo.getGxpRelevance()).
setString(8,metadataWo.getDetailsGxpAssessment()).
setString(9,metadataWo.getBuRelevance()).
setString(10,metadataWo.getBuCriticalityAssessment()).
setString(11, metadataWo.getFailureConsequence()).
setString(12, metadataWo.getDetailsFailureConsequence()).
setString(13, metadataWo.getTestingRequirement()).
setString(14,metadataWo.getDetailsTestingRequirement()).
setString(15,metadataWo.getTestPerformedApproved()).
setString(16, metadataWo.getSystemType()).
setString(17, metadataWo.getRelatedCoreItem()).
setString(18, metadataWo.getStatusName()).
setString(19, metadataWo.getCrId()).
setString(20,metadataWo.getIsSearchForExport()).
setString(21, metadataWo.getFromDay()).
setString(22, metadataWo.getFromMonth()).
setString(23, metadataWo.getFromYear()).
setString(24,metadataWo.getToDay()).
setString(25,metadataWo.getToMonth()).
setString(26,metadataWo.getToYear());

q.setFirstResult(startRow); // line test#1
q.setMaxResults(endRow); // line test#2

result = q.list(); // AT THIS STAGE, THE APPLICATION GETS THE ERROR. CAUGHT BY A TRY-CATCH BLOCK

______________________________________________________________


Now, if I try to view the results in JSP page, error shows up. At the tomcat console, the following error message is generated:

java.lang.NullPointerException
at oracle.jdbc.ttc7.TTCAdapter.newTTCType(TTCAdapter.java:300)
at oracle.jdbc.ttc7.TTCAdapter.createNonPlsqlTTCColumnArray(TTCAdapter.java:270)
at oracle.jdbc.ttc7.TTCAdapter.createNonPlsqlTTCDataSet(TTCAdapter.java:231)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1937)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:880)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2516)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2850)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:609)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:685)
at org.hibernate.dialect.Oracle9Dialect.getResultSet(Oracle9Dialect.java:278)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:146)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1666)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:111)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1655)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:164)
at com.mh.pep.dao.MetadataDaoHibernate$2.doInHibernate(MetadataDaoHibernate.java:1216)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:362)
at org.springframework.orm.hibernate3.HibernateTemplate.executeFind(HibernateTemplate.java:332)
at com.mh.pep.dao.MetadataDaoHibernate.getMetadatas(MetadataDaoHibernate.java:1136)
at com.mh.pep.service.MetadataManagerImpl.getMetadatas(MetadataManagerImpl.java:1003)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:280)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
at $Proxy5.getMetadatas(Unknown Source)
at com.mh.pep.webapp.action.MetadataAction.searchList(MetadataAction.java:748)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:360)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:228)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:202)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:177)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:115)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:123)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.intercept(ParametersInterceptor.java:147)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:204)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.intercept(PrepareInterceptor.java:115)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:156)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:200)


.....

Interestingly, if I omit the lines (marked as line test#1 and line test#2) specified in the DAO layer, the result shows fine. But this does not solve my problem. Because without setting the firstResult and maxResult, it will work fine upro 10,000 or, 20,000 rows. But if the returned rows are more than that, there will be memory leak.


Can you suggest something? How can I apply pagination with Hibernate and SP?


Thanks,
... Chisty
Hello,

I would like to develop a simple scenario using sitemesh as follows:

A layout with a left-side menu and a content page. The left side menu should contain a link named "Login". When user clicks on this link, two things will happen:

1. The login form will be displayed in the content page
2. After a successfull login, the link on the left-side menu will be changed from "Login" to "Logout"

The first part is easy. But, I can't manage to do the 2nd part i.e. the "Login" message cannot be changed into "Logout".

Could you please suggest a sample about how to define this layout?

[ December 28, 2005: Message edited by: M M Islam Chisty ]
[ December 28, 2005: Message edited by: M M Islam Chisty ]
Hi,

I would like to develop a simple scenario using sitemesh:

A layout with a left-side menu and a content page. The left side menu should contain a link named "Login". When user clicks on this link, two things will happen:

1. The login form will be displayed in the content page
2. After a successfull login, the link on the left-side menu will be changed from "Login" to "Logout"

The first part is easy. But, I can't manage to do the 2nd part i.e. the "Login" message cannot be changed into "Logout".

Can you suggest something how should be the decorators.xml file? Could you please suggest a sample about how to define this layout?

Thanks,
Hi,

Thanks for your suggestion. Yes, I tried all the possible ways you suggested but it was not working anyhow.

Then suddenly, during the changes I was making, it worked. I found out that it was just a silly mistake of mine. It worked if I used href="css/screen.css" rather than href="../css/screen.css" with the folder structure you suggested. So, here is a brief if it might be useful for others:

Folder Structure:
-----------------

web
|_ css (screen.css, otherstyles.css .. etc)
|_ jsp (page1.jsp, page2.jsp .. etc)


Code in JSP:
-----------

And the jsp pages should include the link tag as follows:
<link rel="stylesheet" type="text/css" href="css/screen.css">

Then, it will work fine.


But here is another query which might sound interesting! Why should this actually work?

If the directory structure is maintaned as above, then it should only work the way you sugggested i.e. as follows:
<link rel="stylesheet" type="text/css" href="../css/screen.css">

Any idea?


And, thank you again for your suggestion. You had been a great help.

Warmest Regards,
.. Chisty
[ June 06, 2005: Message edited by: M M Islam Chisty ]
Ok. Thanks. I'll try your suggested way and let you know.



Originally posted by Ernest Friedman-Hill:


All I see here is code that reads commands from an SMTP client, and sends back "OK" regardless of what it receives. (The server actually doesn't read any message text associated with the DATA command, by the way; it just ignores those in the same way it would ignore invalid commands. These aren't actually valid SMTP responses: there's supposed to be a success or failure response code, and you're not displaying those. For example, here's what a correct MAIL FROM looks like, and a valid server response:

MAIL FROM: [email protected]
250 2.1.0 [email protected]... Sender ok

In any case, this server doesn't do anything except respond "OK" to the client. It just ignores and discards everything it reads. Are you saying you actually believe it should be delivering messages somehow, as is? This has nothing to do with DNS, nor indeed, at this level, with mbox format or any other format. This server just doesn't do anything!

If you want the server to deliver the messages it receives, then it will need to read all the data from the DATA command, save this data and the "from" and "to" information, and then do something with all this information. I suggested saving it to mbox or some other format; another option is to forward it to another SMTP server (i.e., turn around and become a client to the appropriate remote server.) Finding the appropriate remote server is a project in itself.

Hi,

Here are the replies:

Originally posted by Ernest Friedman-Hill:
Please don't post the same question to multiple forums. I deleted the other copy of the message in "Advanced Java".



Ans. Sorry about that. There are two reasons for this:

1. First of all, I was not sure about which forum to post this issue. I was not certain about whether it sould be categorized as a 'Socket related forum' or, a 'Advanced Java' related forum.

2. I did not get the replies by posting it in 'Advanced Java' forum. That's why I re-posted it in the Sockets forum but forgot to reove it from the 'Advanced Java' forum.


Glancing at the program, I see where it receives messages, and then it just ignores what it received. So you want to store them, somehow. "How" depends on what you mean by "the user's mailbox." Would the user get their mail in an mbox formt file (as on many UNIX systems)? Or via POP or IMAP? There's no single standard.


If it's the first, then you just need to Google for "mbox format", learn the file format, and save the messages in the appropriate directory on your system (often /var/spool/mail) under the user's email ID. If it's another UNIX format, then you just have to learn about that other format.

If it's POP or IMAP, then you need to other find or write a server for the appropriate protocol, and have your SMTP server save the data in whatever format that server wants. There are many different possibilities, including simply using a database or other internal format peculiar to your pair of homemade servers.



Ans. The sample server example (I know it is peculiar as you said... but I don't mind) I provided is just an example. When it runs, it receives requests from a client (say, Outlook or, Eudura) and sends responses to the mail client. But it actually does not deliver the mail to the user menioned in the "TO" field. It is not the mbox format issue... maybe, some DNS related issue needs to be considered.


Any suggestion?

With Thanks,
... Chisty
[ June 05, 2005: Message edited by: M M Islam Chisty ]
Hello Friends,

I just developed a very simple SMTP server (just a silly attempt of mine.. ha ha) which listens for connections at port 25 but it does not seem to deliver the email to the targeted remote user's mailbox. Consider the following situation:


Client
|
|
|
\|/

SMTP Server(1)
[Accepts mail from Clients and delivers to the actual mail server]
|
|
|
\|/

SMTP Server(2)
[Actual mail server where mails are received, stored, fetched. The DNS server might be?]


Considering the above diagram, it seems to me that my developed programm is treating much like SMTP Server (2). But I want it to behave like SMTP Server (1). (Just check the code). After listening requests from email clients, I just want it to deliver the recived mails to the targeted user's mailbox.

Here is my code (very simple indeed). You can just compile/test it. Can you suggest anything?


The Source Code:
----------------


package com.test.email;

import java.io.*;
import java.net.*;
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import javax.activation.*;

public class SmtpServer
extends Thread {


private static final String MAIL_FROM = "MAIL FROM:";
private static final String RCPT_TO = "RCPT TO:";
private static final String DATA = "DATA";
private static final String OK = "250 OK";
private static final String BANNER = "220 Hello from smtpserver in a class";
private static final String HELO = "HELO";
private static final String QUIT = "QUIT";

private static final String SUBJECT = "Subject";
private static final String END_OF_MESSAGE = ".";
private static final String SEND_TERMINAL_AND_MAILBOX = "SEND";

public static void main(String[] args) throws Exception {
new SmtpServer().start();
}

private ServerSocket serverSocket;

public SmtpServer() {
try {
serverSocket = new ServerSocket(25);
System.out.println("Server started on port 25");
}
catch (IOException e) {
e.printStackTrace();
}
try {
jbInit();
}
catch (Exception ex) {
ex.printStackTrace();
}
}

public void run() {
while (true) {
try {
Socket socket = serverSocket.accept();
System.out.println(" #### host name is: " +
socket.getInetAddress().getHostName());
HandlerThread ht = new HandlerThread(socket);
ht.start();
}
catch (IOException e) {
System.err.println(e.toString());
}
}
}

private void jbInit() throws Exception {
}

class HandlerThread
extends Thread {

private Socket socket;

HandlerThread(Socket socket) {
this.socket = socket;
}

public void run() {
try {
InputStream inputStream = socket.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new
InputStreamReader(inputStream));
PrintWriter printWriter = new PrintWriter(socket.getOutputStream(), true);


printWriter.println(BANNER);
boolean sessionCompleted = false;
InternetAddress from = null;
InternetAddress to = null;

String subject = "";
String body = "";
MimeMessage mimeMessage = null;

while (!sessionCompleted) {
String line = bufferedReader.readLine();

if (line.startsWith(MAIL_FROM)) {
String fromString = line.substring(MAIL_FROM.length(), line.length());
from = new InternetAddress(fromString);
printWriter.println(OK);
printWriter.flush();
}

else if (line.startsWith(RCPT_TO)) {
String toString = line.substring(RCPT_TO.length(), line.length());
to = new InternetAddress(toString);
printWriter.println(OK);
printWriter.flush();
}

else if (line.startsWith(SUBJECT)) {
subject = line.substring(SUBJECT.length(), line.length());
System.out.println(" subject line: " + line);
printWriter.println(OK);
printWriter.flush();
}

else if (line.startsWith(DATA)) {
printWriter.println("Code 354 is a reply to the DATA command. \n" +
"After getting this, start sending the body of the mail message, ending with a '\r\n.\r\n.' \n" +
"\n354 Send data now. Terminate with a . on a line alone");
System.out.println("Got a message!");
String temp = "";

printWriter.println(OK);
printWriter.flush();
}

else if (line.startsWith(QUIT)) {
System.out.println(" quit line: " + line);
sessionCompleted = true;
printWriter.println(OK);
printWriter.flush();
}

else {
System.out.println("\t" + line);
printWriter.println(OK);
printWriter.flush();
}
}
}
catch (IOException e) {
e.printStackTrace();
}
catch (AddressException e) {
e.printStackTrace();
}
catch (MessagingException e) {
e.printStackTrace();
}
catch (RuntimeException e) {
e.printStackTrace();
}
}
}

}


With Thanks,
.. Chisty
Hi,

I just developed a very simple SMTP server (just a silly attempt of mine.. ha ha) which listens for connections at port 25 but it does not seem to deliver the email to the targeted remote user's mailbox. Consider the following situation:


Client
|
|
|
\|/

SMTP Server(1)
[Accepts mail from Clients and delivers to the actual mail server]
|
|
|
\|/

SMTP Server(2)
[Actual mail server where mails are received, stored, fetched. The DNS server might be?]


Considering the above diagram, my developed programm is treating like SMTP Server (2). But I want it to behave like SMTP Server (1). After listening requests from email clients, I just want it to deliver the recived mails to the targeted user's mailbox.

Here is my code (very simple indeed). You can just compile/test it. Can you suggest anything?


The Source Code:
----------------


package com.test.email;

import java.io.*;
import java.net.*;
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import javax.activation.*;

public class SmtpServer
extends Thread {


private static final String MAIL_FROM = "MAIL FROM:";
private static final String RCPT_TO = "RCPT TO:";
private static final String DATA = "DATA";
private static final String OK = "250 OK";
private static final String BANNER = "220 Hello from smtpserver in a class";
private static final String HELO = "HELO";
private static final String QUIT = "QUIT";

private static final String SUBJECT = "Subject";
private static final String END_OF_MESSAGE = ".";
private static final String SEND_TERMINAL_AND_MAILBOX = "SEND";

public static void main(String[] args) throws Exception {
new SmtpServer().start();
}

private ServerSocket serverSocket;

public SmtpServer() {
try {
serverSocket = new ServerSocket(25);
System.out.println("Server started on port 25");
}
catch (IOException e) {
e.printStackTrace();
}
try {
jbInit();
}
catch (Exception ex) {
ex.printStackTrace();
}
}

public void run() {
while (true) {
try {
Socket socket = serverSocket.accept();
System.out.println(" #### host name is: " +
socket.getInetAddress().getHostName());
HandlerThread ht = new HandlerThread(socket);
ht.start();
}
catch (IOException e) {
System.err.println(e.toString());
}
}
}

private void jbInit() throws Exception {
}

class HandlerThread
extends Thread {

private Socket socket;

HandlerThread(Socket socket) {
this.socket = socket;
}

public void run() {
try {
InputStream inputStream = socket.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new
InputStreamReader(inputStream));
PrintWriter printWriter = new PrintWriter(socket.getOutputStream(), true);


printWriter.println(BANNER);
boolean sessionCompleted = false;
InternetAddress from = null;
InternetAddress to = null;

String subject = "";
String body = "";
MimeMessage mimeMessage = null;

while (!sessionCompleted) {
String line = bufferedReader.readLine();

if (line.startsWith(MAIL_FROM)) {
String fromString = line.substring(MAIL_FROM.length(), line.length());
from = new InternetAddress(fromString);
printWriter.println(OK);
printWriter.flush();
}

else if (line.startsWith(RCPT_TO)) {
String toString = line.substring(RCPT_TO.length(), line.length());
to = new InternetAddress(toString);
printWriter.println(OK);
printWriter.flush();
}

else if (line.startsWith(SUBJECT)) {
subject = line.substring(SUBJECT.length(), line.length());
System.out.println(" subject line: " + line);
printWriter.println(OK);
printWriter.flush();
}

else if (line.startsWith(DATA)) {
printWriter.println("Code 354 is a reply to the DATA command. \n" +
"After getting this, start sending the body of the mail message, ending with a '\r\n.\r\n.' \n" +
"\n354 Send data now. Terminate with a . on a line alone");
System.out.println("Got a message!");
String temp = "";

printWriter.println(OK);
printWriter.flush();
}

else if (line.startsWith(QUIT)) {
System.out.println(" quit line: " + line);
sessionCompleted = true;
printWriter.println(OK);
printWriter.flush();
}

else {
System.out.println("\t" + line);
printWriter.println(OK);
printWriter.flush();
}
}
}
catch (IOException e) {
e.printStackTrace();
}
catch (AddressException e) {
e.printStackTrace();
}
catch (MessagingException e) {
e.printStackTrace();
}
catch (RuntimeException e) {
e.printStackTrace();
}
}
}

}


With Thanks,
.. Chisty
19 years ago
Hi,

While I was trying to display a list of users in my jsp page using the <display> tag provided by sourceforge (http://sourceforge.net/project/showfiles.php?group_id=73068), it does not seem to work. Rather than displaying the page in a styled/formatted way, it displays the user list in very simple tabular format (the same output would be shown if I just used the html table tag).

It does not seem to use the class defined in the StyleSheet. What might be the reason? Any suggestion?



The code for my jsp page (userlist.jsp):
----------------------------------------

<%@ include file="/jsp/taglibs.jsp" %>
<html>

<head>
<title>The user list</title>
<link rel="stylesheet" href="../css/screen.css" type="text/css"/>

</head>


<h3>Showing UserList</h3>


<body>

<display:table id="a" name="users" class="simplex">
<display:column property="userid" title="User Id"/>
<display:column property="firstname" title="First Name" />
<display:column property="lastname" title="Last Name" />
<display:column property="email" title="Email" />
<display:column property="address" title="Address" />
<display:column property="groupname" title="Group Name" />
</display:table>

<html:link href="jsp/index.jsp"> Back to Main Page </html:link>
</body>
</html>


Portion of the code in my screen.css file:
------------------------------------------

table {
border: 1px solid #808000 ;
color: #800000;
padding: 0;
background-color: #FFFFBF
}


tr {
border: 1px solid #808000
}

td {
border: 1px solid #C0C0C0;
background-color: #FFFFBF
}


table.simplex thead tr {
background-color: #ffe0cc;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #555555;
}

table.simplex tr.odd {
background-color: #ffefe5;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
}

table.simplex tr.even {
background-color: #ffe0cc;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
}

table.simplex {
border-collapse: collapse;
border: 1px solid #FFB27F;

}


And the taglibs.jsp:
--------------------
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
<%@ taglib uri="/WEB-INF/displaytag-12.tld" prefix="display" %>
<%@ taglib uri="/WEB-INF/displaytag-el-12.tld" prefix="display-el" %>


Any suggestion/advice from you would be higly appreciated.

With Thanks,
... Chisty
Dear Friends,

I was wondering whether object oriented rules are violated in EJB.

EJB divides beahaviours & properties of an object into two which are known as session & entity beans. But this division of properties & behaviours are violation of Encapsulation. As a matter of fact, EJB forces us to place 'logic' into the session beans and 'data' into entity beans which goes against good OOP design.

What's your opinion on this?

Thanks,
... Chisty