Win a copy of Securing DevOps this week in the Security forum!

Saptarshi Chakraborty

Greenhorn
+ Follow
since Jul 26, 2007
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 Saptarshi Chakraborty

I am having exactly the same problem on this similar code .
6 years ago
Can I use ContextLoaderServlet instead of DispatcherServlet ?
I think ContextLoaderListener or ContextLoaderServlet should be used if I want the objects to be visible application wide.The code above will initialize objects for that specific servlet.
Am I right ?
7 years ago
Thanks Raj.
But anything to write inside web.xml as <servlet-class> (like org.springframework.web.servlet.DispatcherServlet when we use spring MVC) .
7 years ago
Thanks Raj.
but what to write inside web.xml as <servlet-class> ?
There should be a spring servlet (like org.springframework.web.servlet.DispatcherServlet when I am using spring MVC) which will initialize the other objects through IOC.
7 years ago
Hi All,

I am new in Spring framework. I want to initialize a process using spring framework.
Typically this can be done by overriding init() method in servlet and making the <load-on-startup>1</load-on-startup> in web.xml .I want to use spring as it provides DI features through which I can initialize the dependent objects in time of initialization.
Please guide me how this can be done by using spring. What should be the servlet class in web.xml.


7 years ago
Hi all,
I am a java programmer and I am familiar with Windows only. I want to migrate to Linux.I don't have much knowledge about linux and I am a complete beginner .Which Linux you people suggest for me . Does choosing any linux will help me.Suppose I am starting with Ubuntu will it help me to develop application in Fedora Core also.
8 years ago
Hi all ,
I am new to ejb 2 entity bean. I am creating a simple application with entity bean and JBoss 4.0.2.As i want want my application to grow further i am maintaining few design patterns like service locator and delegate. I have made two .jar files and one .war file .In one .jar i have all the ejb classes(D_SEjb.jar) and in another(L_simple.jar) service locator and delegate classes. I am putting first .jar along with the .war in deploy folder and the later in lib folder of JBoss.My ejb gets deployed easily and creates the necessary table but when the create method is called from the client to save the data in the database it gives a Class cast exception in the service locator in the PortableRemoteObject.narrow(objref, className) part.
My sevice locator method looks like this:


and in delegate it casted to the Home interface l like this :


My entity bean is:

After running XDoclet my home interface and ejb-jar.xml looks like this

home interface :



part of my ejb-jar.xml looks like this:


and the stack trace is

java.lang.ClassCastException
2009-10-04 11:48:24,119 INFO [STDOUT] at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
2009-10-04 11:48:24,119 INFO [STDOUT] at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
2009-10-04 11:48:24,159 INFO [STDOUT] at com.ejbSimple.serviceLocator.AppServiceLocator.getHome(AppServiceLocator.java:86)
2009-10-04 11:48:24,159 INFO [STDOUT] at com.ejbSimple.delegate.Simpledelegate.<init>(Simpledelegate.java:20)
2009-10-04 11:48:24,159 INFO [STDOUT] at com.ejbSimple.action.simpleAction.execute(simpleAction.java:26)
2009-10-04 11:48:24,159 INFO [STDOUT] at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
2009-10-04 11:48:24,159 INFO [STDOUT] at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
2009-10-04 11:48:24,159 INFO [STDOUT] at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1158)
2009-10-04 11:48:24,209 INFO [STDOUT] at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
2009-10-04 11:48:24,219 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
2009-10-04 11:48:24,219 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
2009-10-04 11:48:24,229 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
2009-10-04 11:48:24,229 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
2009-10-04 11:48:24,229 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
2009-10-04 11:48:24,229 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
2009-10-04 11:48:24,229 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
2009-10-04 11:48:24,229 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
2009-10-04 11:48:24,289 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
2009-10-04 11:48:24,299 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
2009-10-04 11:48:24,299 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
2009-10-04 11:48:24,299 INFO [STDOUT] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
2009-10-04 11:48:24,299 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
2009-10-04 11:48:24,299 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
2009-10-04 11:48:24,319 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
2009-10-04 11:48:24,319 INFO [STDOUT] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
2009-10-04 11:48:24,319 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
2009-10-04 11:48:24,319 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
2009-10-04 11:48:24,319 INFO [STDOUT] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
2009-10-04 11:48:24,329 INFO [STDOUT] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
2009-10-04 11:48:24,329 INFO [STDOUT] at java.lang.Thread.run(Thread.java:619)
2009-10-04 11:48:24,329 INFO [STDOUT] Caused by: java.lang.ClassCastException: $Proxy53 cannot be cast to org.omg.CORBA.Object
2009-10-04 11:48:24,329 INFO [STDOUT] at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:212)
2009-10-04 11:48:24,329 INFO [STDOUT] ... 29 more

I tried by putting L_simple.jar in the deploy but that didn't solve the problem.
Can any body help to figure out where the problem is and what mistake I made.
Hi all,
I'm a new learner in EJB 2. I am creating a demo application in EJB 2 CMP with JBoss 4.0.2. In my bean within the tag I've written

After running the XDoclet the jbosscmp-jdbc.xml comes like this

While deploying my log file gives the following exception
org.jboss.deployment.DeploymentException: Error in jbosscmp-jdbc.xml : datasource-mapping postgreSQL not found
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData.<init>(JDBCEntityMetaData.java:501)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.<init>(JDBCApplicationMetaData.java:312)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXmlFileLoader.java:67)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaData(JDBCStoreManager.java:721)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBCStoreManager.java:409)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:353)
at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:157)


Do I need to change anything in the standardjbosscmp-jdbc.xml in conf folder because <datasource-mapping> is tagged as optional from version 4.0.Though I changed the <datasource-mapping> but it still the same error.
nad my postgre-ds.xml is written like this

Hi folks,
I am going to write a hand over document of a project which was written in j2ee.I have not been able to find any template .Can any one provide me a good template for a hand over document in a java project?If not the template at least guide me to write it.
8 years ago
hi folks,

How can i know the size of an ArrayList through any of the struts logic tag and EL or JSTL?
I am sending an arraylist consisting of several objects from action and before iterating it in jsp I want to check whether the arraylist is not null or its size is greater than zero. To solve it I don't want to use scriptlet .Please try to provide the solution with struts logic tag,EL or jstl.
8 years ago
hi folks,
I'm new to hibernate.In my code there is a pojo object like


and the corresponding mapping file is



isactive column takes integer datatype in the table department .So is in my hbm file.That means it takes value 0 or 1 to represent boolean output.In my pojo I am putting the isActive property as boolean.
Now I am having problem while writing criteria query.



It gives the exception like
org.hibernate.PropertyAccessException: IllegalArgumentException occurred

If I convert 'isActive' to boolean it is showing class cast exception.
In a nutshell what should I do if the datatype of any property in the pojo class is different from the datatype of the same property in the hbm file (but the property in the hbm file has same datatype with column in the database table).
Is there any solution if I want to solve this problem keeping my pojo class and the database table intact?
I was wrong in my approach.Date objects don't have a format.A date is the number of milliseconds since Jan 1st, 1970 UTC. It is a number. It has no format. SimpleDateFormat can parse it to a String with our desired format.
8 years ago
yes I want to convert a Date into a Date with a specific format.
8 years ago
hi folks ,
I am having a problem in SimpleDateFormat class. I have a method like this



running the code throws an exception like


Unparseable date: "Tue May 05 13:38:42 IST 2009"
at java.text.DateFormat.parse(Unknown Source)


Can any one figure out what is the problem here in this code?
and how can I convert the date to my desired format.
8 years ago
I am using Eclipse JBoss IDE . I tried that approach by copying the file to the classes directory and it worked fine,but is this a right approach ??In development time we put all the configuration files inside the WEB-INF directory just like struts-config.xml,web.xml.
Yes you are right right I put all the pojos,along with the *.hbm.xml files inside a different jar file .This is because I tried to follow the enterprise development structure and the design patterns (front-controller,business delegate, etc) and I am quite familiar with DAO pattern also .That is why I am trying the same approach simply by using hibernate instead of normal sqls .