The tag handler class was not found "org.apache.struts.taglib.tiles.InsertTag" on weblogic 12c, although it is working fine on my glassfish server - weblogic12c

I am using struts-tiles-1.3.10 which contains "InsertTag" class file but after deploying the war on weblogic, when I try to access the application , it gives The tag handler class was not found "org.apache.struts.taglib.tiles.InsertTag"

Related

deploying spring mvc web app to tomcat: classpath issue

I am developing a small web app using Spring MVC framework. Basically, the app provides web interface, where user can upload XML file and verify it against specific XSD file. I put my XSD file within "src/main/webapp/XSDfoler". I put this folder into my Tomcat's classpath. (I am using Tomcat embedded into my Eclipse). In my code, in order to access my XSD file I simply used
ClassPathResource("myXSD.xsd");
It works fine. Now, I created a .war file from my webapp and tried to deploy it to another standalone Tomcat. When trying to run it, it give NullPointer exception since it cannot locate "myXSD.xsd" file. So as I get it, I have to somehow include this file into classpath of this standalone Tomcat instance. I looked for some nice step by step tutorial or article explaining how to deploy webapp to a standalone Tomcat server after doing the development in IDE with embedded Tomcat. Could anyone please explain/help. Thanks!
Try
ServletContext context = httServletRequest.getSession().getServletContext();
InputStream is = context.getResourceAsStream("/XSDfoler/myXSD.xsd");
alternatively use getResource() instead of getResourceAsStream()

ClassNotFoundException oracle.jdbc.driver.OracleDriver only in servlet, using Eclipse and oracle

The code below fails on the line: Class.forName("oracle.jdbc.driver.OracleDriver");
with the error:
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
The two printlns print: Wed_Jun_22_11:18:51_PDT_2005 false This makes me think the class exists and can be found. Also this exact same class works in an a non-servlet application.
I have rebooted everything multiple times and regenerated the application/servlet multiple times. All values have been hard coded to make it simple and short.
I'm using: Eclipse JavaEE 1.4.2 Tomcat 7 jdk1.7 Oracle 11g R2 Windows 7 64bit
I have already added the jar files in web-inf. but it is still giving the following error: java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver.
Any suggestions would be great.
It is a bit hard to tell what exactly going wrong without looking into your application and tomcat server. But there are a couple of hints for your issue.
NoClassDefFoundError always makes me think that there is class collision rather than missing jar file. Be ware of the difference between ClassNotFound and NoClassDefFoundError
tomcat loads class in a different way as what normal java app does. Normally, the class loaders in a stand along java app will follow delegate pattern, which means the child class loader will always delegate the class loading job to its parent class loader. But tomcat does not exactly follow this. So it will load(find source file, read byte code and create a instace of class Class) by itself.
So check your tomcat lib as well as all the web apps under the tomcat and see if there are multiple version of ojdbcXXX.jar
Go through C:\apache-tomcat-7.0.47\lib path(this path may be differ ->based on where you pasted the Tomcat server ) then past ojdbc14.jar if its not contain.
Then restart the server in eclipse then run your app on server

Using Jetty in Eclipse Juno

As I understand, Eclipse Juno release has Jetty servlet container embedded. So I have assumed, that means I can use Jetty in Eclipse Java EE without installing any additional plugins or packages. I have tried this:
Created a simple dynamic Web project and run it on "J2EE Preview" Server. As a result I've got 404 error:
Error 404 - Not Found
No context on this server matched or handled this request. Contexts
known to this server are: ServletTest(/ServletTest)
Tried to create embedded Jetty instance:
public class Launcher {
public static void main(String[] args) throws Exception {
Server server = new Server(8080);
server.start();
server.join();
}
}
I am unable to find where can I import org.eclipse.jetty.server.Server class from.
What am I doing wrong?
Stick with your first approach. Looks like you're nearly there - you're just pinging the wrong URL. Try http://localhost:8080/ServletTest.
There are some bugs currently in the J2EE preview which uses jetty. It seems that at this moment the Run-Jetty plugin is simply better imprelemnted...
http://code.google.com/p/run-jetty-run/
If work perfectly for my web application, just using run as run-jetty

What SAAJ package is used by WebLogic

I have had many problems because there are different SAAJ packages with SOAP classes:
com/sun/xml/internal/messaging/saaj/soap/ in rt.jar
com/sun/xml/messaging/saaj/soap/ in saaj-impl.jar
When WebLogic uses classes from com/sun/xml/internal/messaging/saaj/soap/ and an application is created using classes from com/sun/xml/messaging/saaj/soap/, it throws exceptions like these when the app is deployed:
com.sun.xml.internal.messaging.saaj.soap.LocalStrings != com.sun.xml.messaging.saaj.soap.LocalStrings
or
java.lang.NoClassDefFoundError: com/sun/xml/internal/messaging/saaj/soap/SAAJMetaFactoryImpl
My solution was create a weblogic.xml descriptor with saaj reference and including saaj-impl.jar into the war.
Question is: Can I know what SAAJ package is used in WebLogic Server?
If you use weblogic 10.3.3(or i think even any other version) , the SAAJ implementation used by is of the JDK runtime installed since the web server initializes the CLASSPATH to the JDK jars first. So you need to override it with your jar file so it can find your desired implementation first.
The only solution with weblogic that worked for me was to set PRE_CLASSPATH in weblogic setDomainEnv.cmd file like this,
set PRE_CLASSPATH=%DOMAIN_HOME%\lib\endorsed\saaj-impl-1.3.18.jar
whereby DOMAIN_HOME represents Weblogic domain, but it can be any other absolute path as well to point the jar. A bit about the issue is also described Here

Accessing Stateful session bean from servlet/jsp throws ClassCast exception in jboss 4.2.2

Whenever I try to access EJB 3 Stateful session bean deployed on JBoss 4.2.2 application server using a web client(within JBoss server) such as servlet/jsp , I get following exception
java.lang.ClassCastException: $Proxy123
If I use application client , same code works without any exception.
Or if I change bean to #Stateless , even web client works fine.
If I deploy my .war on the tomcat container externally, again web client works fine for stateful bean also.
So in short : Stateful bean EJB 3 deployed on JBoss 4.2 and accessed via web client deployed on JBoss throws classcastexception
This is my code - client side, written in a servlet
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
properties.put(Context.PROVIDER_URL, "jnp://localhost:1099");
Context c = new InitialContext(properties);
InvokePOJORemote ref = (InvokePOJORemote) c.lookup("InvokePOJOBean/remote");
out.println("<h1>Servlet ejb ref " + ref + "</h1>");
boolean sts = ref.addEmployee("Mad", (short) 30, new java.math.BigDecimal(12000));
This throws ClasscastException at the lookup statement , at time of casting. Dont know what is wrong! Pls help.
This is a bit disgusting but you need to keep the stateful ejb interface outside the war file.That is neither in the classes folder(of WEB-INF) as .class file nor in the lib folder(of WEB-INF) as .jar file.
Instead wht u can do is create a jar file of the stateful ejb interface and for servlet compilation add the jar to ur project.. say using "add external jars" in Eclipse.
That should work..