Rohit W. Tawde

Greenhorn
+ Follow
since Mar 12, 2013
Rohit likes ...
Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Rohit W. Tawde

Hi,

In the javadoc, it says the following,

For ArrayList,
Methods inherited from interface java.util.List
containsAll, equals, hashCode

and for LinkedList,
Methods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subList


Aint all the methods like add, clear etc inherited from List interface.

Why does it mention that it has inherited only these few methods from the interface?

Also containsAll method is inherited by both ArrayList and LinkedList?


As per my understanding, A concrete subclass has to implement all the methods of the Interface it implements.
So why does the javadoc state that it inherits only these few methods ???

Also the containsAll has no implementation in the ArrayList class.
And as Interfaces dont implement methods, so where is the implementation of that method ???

Please help. Im a bit confused.
7 years ago
Hi Tim,

Thank you so much for such a detailed explanation.

Really. Thank you so much.

Cheers,
Rohit
7 years ago
Hi,

I have written a simple java class which has a main method.

package org.rohit.useUtilities;

import com.rohit.utilities;

public class TestJars
{
public static void main(String[] args)
{

float d = Divide.divide(9/2);
float m = Multiply.multiply(2*24);
float a = Add.add(5+2);
float s = Subtract.subtract(9-2);


System.out.println(d+" "+m+" "+a+" "+s);
}
}

I have written 4 classes in com.rohit.utilities package namely Divide,Multiply,Add and Subtract.
Below is the code for the Add class

package com.rohit.utilities;

public class Add
{
public static float add(float a, float b){

float ans = a+b;

return ans;
}
}

I am able to run the TestJars class.

Then i made a jar file of the 4 classes(utilities.jar) and provided -cp option in the java and javac commands to run TestJars class. I was able to do it.

Now i want to make a jar file for the whole application.

So, i made a jar file as -> jar -cvf myJavaApplication.jar org com

But when i run the jar file as --> java -jar myJavaApplication.jar

I get the following error,

no main manifest attribute in myJavaApplication.jar


Any help would be gladly appreciated.
7 years ago
Hi,

I did not understand this mapping,

<servlet-name>uploadServlet</servlet-name>
<servlet-class>
com.sun.jersey.spi.container.servlet.ServletContainer
</servlet-class>

<servlet-mapping>
<servlet-name>uploadServlet</servlet-name>
<url-pattern>/uploadServ/*</url-pattern>
</servlet-mapping>

Your servlet name is uploadServlet and its in the package servlets.

Also if you use @WebServlet annotation, then its not necessary to map the servlet in the web.xml file.

web.xml contains a metadata-complete attribute in the web-app element.
If set to true all of these will be ignored and web.xml is the only metadata considered.

eg.
<web-app metadata-complete="true" ........version="3.0">
7 years ago
Hi guys,

There are 3 xml files - server.xml, context.xml and web.xml in the conf directory of Tomcat.
What is the difference between them.

Also we write a web.xml for each web application and it resides in the WEB-INF directory.

Just today, i wanted to use Connection Pooling in Eclipse, and i read on the internet that we could add context.xml file in the META-INF directory of the WebContent folder in an application in Eclipse.
In this context.xml file we could specify the DataSource details in the Resource element.


Could anybody please explain the difference between all the xml files.

And also if i have to implement the connection pooling, then in which xml file should i enter the details.
7 years ago
Tried hitting this url - http://localhost:8080/jmx-console.

But i get the following error,

HTTP Status 404 - /jmx-console

type Status report

message /jmx-console

description The requested resource (/jmx-console) is not available.

JBoss Web/7.0.13.Final


jBoss is running and my applications are working.

Please help.
I have checked the application structure, it is fine.

JBoss is running but still i cant open the jmx console.

Hi,

I have tried both ways, but it still gives the same error.
19:04:00,590 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) javax.naming.NameNotFoundException: TestEJB/TestSession/local -- service jboss.naming.context.java.TestEJB.TestSession.local


Also i tries this, http://localhost:8080/jmx-console

But it gives me HTTP Status 404 - /jmx-console

Please help
Its easy to implement it in NetBeans.(using insert code and calling enterprise bean).
I am trying it to do it in Eclipse.(Was able to do it using Dependency Injection. @EJB annotation and placing the jar file of the bean in the WEB-INF/lib folder of the Web Content.)

But i am not able to do it using the JNDI way as mentioned in the previous post.

Here are my code snippets,
local bean interface
<CODE>
package com.rohit.ejbs;

import javax.ejb.Local;

@Local
public interface TestSessionBeanLocal {

String beanMethod();

}
</CODE>

Stateless session bean
<CODE>
package com.rohit.ejbs;

import javax.ejb.Local;
import javax.ejb.Stateless;

@Stateless(name="TestSession")
@Local(TestSessionBeanLocal.class)
public class TestSessionBean implements TestSessionBeanLocal{

@Override
public String beanMethod() {

return "Testing my first EJB in Eclipse using JBoss AS 7.1";
}

}
</CODE>

And the GET method code snippet of the servlet,
<CODE>
Context initialContext = new InitialContext();

TestSessionBeanLocal testSessionBeanLocal= (TestSessionBeanLocal) initialContext.lookup("TestEJB/TestSessionBean/local");

out.println(testSessionBeanLocal.beanMethod());
</CODE>

Actually was just following this - http://www.half-wit4u.blogspot.in/2012/02/ejb3-simplified-approach.html
I have created a local interface and a stateless session bean which implements that interface (Eclipse 3.8.2 and JBoss AS 7.1, EJB 3.1)
I call the bean through a servlet using JNDI,
Below is the code snippet,

Context initialContext = new InitialContext();
TestSessionBeanLocal testSessionBeanLocal= (TestSessionBeanLocal) initialContext.lookup("TestEJB/TestSessionBean/local");
out.println(testSessionBeanLocal.beanMethod());


I am getting the following error,
javax.naming.NameNotFoundException: TestEJB/TestSessionBean/local -- service jboss.naming.context.java.TestEJB.TestSessionBean.local


Kindly help.
Hi Carles,

I followed your instructions.

It gives me the following errors,

Cannot complete the install because of a conflicting dependency.
Software being installed: JBoss Maven Seam Integration 1.4.0.Final-v20130326-2027-B145 (org.jboss.tools.maven.seam.feature.feature.group 1.4.0.Final-v20130326-2027-B145)
Software currently installed: CXF Web Services 1.0.100.v201105171845-7H77DRFAKlZgjHCaHg65uE6I6I (org.eclipse.jst.ws.cxf.feature.feature.group 1.0.100.v201105171845-7H77DRFAKlZgjHCaHg65uE6I6I)
Only one of the following can be installed at once:
Server Core 1.1.403.v20111209_0750 (org.eclipse.wst.server.core 1.1.403.v20111209_0750)
Server Core 1.4.100.v20130117_1140 (org.eclipse.wst.server.core 1.4.100.v20130117_1140)
Cannot satisfy dependency:
From: CXF Web Services Creation Core 1.0.100.v201104022153 (org.eclipse.jst.ws.cxf.creation.core 1.0.100.v201104022153)
To: bundle org.eclipse.wst.server.core [1.1.0,1.2.0)
Cannot satisfy dependency:
From: CXF Web Services 1.0.100.v201105171845-7H77DRFAKlZgjHCaHg65uE6I6I (org.eclipse.jst.ws.cxf.feature.feature.group 1.0.100.v201105171845-7H77DRFAKlZgjHCaHg65uE6I6I)
To: org.eclipse.jst.ws.cxf.creation.core [1.0.100.v201104022153]
Cannot satisfy dependency:
From: JBoss AS Core Plug-in 2.4.1.Final-v20130327-0617-B80 (org.jboss.ide.eclipse.as.core 2.4.1.Final-v20130327-0617-B80)
To: bundle org.jboss.tools.runtime.ui 2.0.0
Cannot satisfy dependency:
From: JBoss Maven Seam Configurator 1.4.0.Final-v20130326-2027-B145 (org.jboss.tools.maven.seam 1.4.0.Final-v20130326-2027-B145)
To: bundle org.jboss.tools.seam.core 0.0.0
Cannot satisfy dependency:
From: JBoss Maven Seam Integration 1.4.0.Final-v20130326-2027-B145 (org.jboss.tools.maven.seam.feature.feature.group 1.4.0.Final-v20130326-2027-B145)
To: org.jboss.tools.maven.seam [1.4.0.Final-v20130326-2027-B145]
Cannot satisfy dependency:
From: JBoss Runtime Detection UI 2.0.0.Final-v20130327-0606-B69 (org.jboss.tools.runtime.ui 2.0.0.Final-v20130327-0606-B69)
To: bundle org.eclipse.wst.server.core 1.4.0
Cannot satisfy dependency:
From: Seam Tools 3.4.0.Final-v20130327-1556-B159 (org.jboss.tools.seam.core 3.4.0.Final-v20130327-1556-B159)
To: bundle org.jboss.ide.eclipse.as.core 0.0.0
I have downloaded jboss, it is saved in this dir, C:\jboss-as-7.1.1.Final
I use Eclipse 3.8.0

How can i configure the jboss with eclipse.
Ive searched the internet, but unable to do so.

When i try to add the server using new server in eclipse, it does not show the option of jboss-as-7, its shows Jboss5.0

Also when i select the dir, C:\jboss-as-7.1.1.Final, its displays the following error,
Missing classpath entry C:\jboss-as-7.1.1.Final\bin\run.jar

Please help
Hi Carles,

The oracle Release 10.2.0.3.0

Yes, i have tested the database connection with ojdbc14.jar, but its giving the same error.