Unable to Compile EJB Sample
Environment: Windows NT4, sp5, WLS 5.1/sp 2, Sun JDK1.2.2
As illustrated in 'Introduction to BEA Weblogic Server', pp 101-102, I'm
compiling the Emp EJB sample. I successfully compiled the java programs,
moved the XML files, and created the initial JAR file. Next the sample says
to run ejbc on the JAR file. When I do I get the following error:
G:\weblogic\examples\intro\ejbtemp>java -Dweblogic.home=%WL_HOME%
weblogic.ejbc Emp.jar -d %WL_HOME%\myserver\Emp.jar
java.lang.ClassCastException
at
weblogic.xml.dom.DOMUtils.getOptionalElementsByTagName(DOMUtils.java,
Compiled Code)
at
weblogic.xml.dom.DOMUtils.getOptionalElementByTagName(DOMUtils.java:170)
at
weblogic.xml.dom.DOMUtils.getOptionalValueByTagName(DOMUtils.java:97)
at
weblogic.ejb.deployment.dd.EJBReadDOM.getDescriptionValue(EJBReadDOM.java:40
4)
at
weblogic.ejb.deployment.dd.DescriptorLoader.createDeploymentUnit(DescriptorL
oader.java:200)
at weblogic.ejbc.runBody(ejbc.java, Compiled Code)
at weblogic.utils.compiler.Tool.run(Tool.java:80)
at weblogic.ejbc.main(ejbc.java:353)
ERROR: java.lang.ClassCastException
Any idea what may be causing this?
try to use the build script in the examples directory..
It is available for all examples.
so after running setenv
go the example u want and run the build.cmd
it should work
Steve Vago wrote:
Environment: Windows NT4, sp5, WLS 5.1/sp 2, Sun JDK1.2.2
As illustrated in 'Introduction to BEA Weblogic Server', pp 101-102, I'm
compiling the Emp EJB sample. I successfully compiled the java programs,
moved the XML files, and created the initial JAR file. Next the sample says
to run ejbc on the JAR file. When I do I get the following error:
G:\weblogic\examples\intro\ejbtemp>java -Dweblogic.home=%WL_HOME%
weblogic.ejbc Emp.jar -d %WL_HOME%\myserver\Emp.jar
java.lang.ClassCastException
at
weblogic.xml.dom.DOMUtils.getOptionalElementsByTagName(DOMUtils.java,
Compiled Code)
at
weblogic.xml.dom.DOMUtils.getOptionalElementByTagName(DOMUtils.java:170)
at
weblogic.xml.dom.DOMUtils.getOptionalValueByTagName(DOMUtils.java:97)
at
weblogic.ejb.deployment.dd.EJBReadDOM.getDescriptionValue(EJBReadDOM.java:40
4)
at
weblogic.ejb.deployment.dd.DescriptorLoader.createDeploymentUnit(DescriptorL
oader.java:200)
at weblogic.ejbc.runBody(ejbc.java, Compiled Code)
at weblogic.utils.compiler.Tool.run(Tool.java:80)
at weblogic.ejbc.main(ejbc.java:353)
ERROR: java.lang.ClassCastException
Any idea what may be causing this?
Similar Messages
-
Unable to compile EJB client program
Hi, I developed a simple client program to an entity bean and I am not able to compile. Following are the few lines picked up from the code: (all my ejb,home and remote classes are under "test" package)
import test.*;
import java.util.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
public class TestClient {
public static void main(String[] args) {
try {
Context initial = new InitialContext();
Object objRef = initial.lookup("MyTestBean");
TestHome home = (TestHome) PortableRemoteObject.narrow(objRef, TestHome.class);
... etc.
I am getting the following compilation error
TestClient.java:13: inconvertible types found : java.lang.Object required: TestHome
TestHome home = (TestHome) PortableRemoteObject.narrow(objRef, TestHome.cl
ass);
The classpath is set to j2ee.jar and the local working directory in which the package "test" resides.
Any help in this matter is greatly appreciated.
Thanks.Greetings,
Hi there,
Did pengjuc's answer help you to solve this problem?
I'd be really interested to know if it did.Unlikely, since the error reported is not with the object reference but with the specified class type. Additionally, this approach is not recommended since it assumes the underlying protocol is always (RMI-)IIOP and not vendor specific - portability is lost.
Thanks
Amanda
Developer Technical Support
Sun Microsystems
http://www.sun.com/developers
Regards,
Tony "Vee Schade" Cook -
Error in starting an EAR containing EJBs : Unable to prepare EJB
I am using ANT build script to create and deploy EAR on WAS server.
This EAR file packages EJB jar file inside it.
I am using WAS 5.1.1 Test Environment from IBM RAD 6.0.
When deployment is done, the application is not in Started status.
If I try to start it from web-based admin console, I get error given below.
I examined the missing classes.
Error CNTR0075E could not find: EJSStatelessSurveyManagerHomeBean_a1e88e5e
Error WSVR0209E could not find: EJSStatelessSurveyManagerHomeBean_00693296
When I checked the deployed EAR file, I could locate EJSStatelessSurveyManagerHomeBean_a1e88e5e in the EJB jar file inside the EAR file. I carefully checked the full qualified name. It is there.
But the other one (classname ending with 00693296) is not there.
What are these numbers? Are these any ref ids in some xml file (web.xml, ejb-jar.xml, etc)?
When I searched web based forums for these error codes, I tried varius solutions [e.g. Generate Deploy Code and RMIC, etc] but nothing seems to work :-(
Is there any solution to it?
Thanking in advance.
Error details:
[8/14/06 14:23:54:017 IST] 6d8b5f3e BeanMetaData E CNTR0075E: The user-provided class "com.queplix.jd.survey.ejb.EJSStatelessSurveyManagerHomeBean_a1e88e5e" needed by the EnterpriseBean could not be found or loaded.
[8/14/06 14:23:54:017 IST] 6d8b5f3e EJBContainerI E WSVR0209E: Unable to prepare EJB jar DTAC-ejb.jar [class com.ibm.ws.runtime.component.DeployedModuleImpl], enterprise bean com.ibm.etools.ejb.impl.SessionImpl(SurveyManager) (transactionType: Container, sessionType: Stateless)
java.lang.ClassNotFoundException: com.queplix.jd.survey.ejb.EJSStatelessSurveyManagerHomeBean_00693296
at com.ibm.ws.classloader.CompoundClassLoader.findClass(CompoundClassLoader.java(Compiled Code))
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java(Compiled Code))
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at com.ibm.ejs.container.BeanMetaData.loadExistedClass(BeanMetaData.java:2644)
at com.ibm.ejs.container.BeanMetaData.<init>(BeanMetaData.java:887)
at com.ibm.ws.runtime.component.EJBContainerImpl.createBeanMetaData(EJBContainerImpl.java:1038)
at com.ibm.ws.runtime.component.EJBContainerImpl.createModuleMetaData(EJBContainerImpl.java:830)
at com.ibm.ws.runtime.component.EJBContainerImpl.createMetaData(EJBContainerImpl.java:1575)
at com.ibm.ws.runtime.component.MetaDataMgrImpl.createFactoryMetaData(MetaDataMgrImpl.java:115)
at com.ibm.ws.runtime.component.MetaDataMgrImpl.createMetaData(MetaDataMgrImpl.java:159)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:350)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:578)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:311)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:588)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
at com.tivoli.jmx.modelmbean.MMBInvoker.invoke(MMBInvoker.java:46)
at com.tivoli.jmx.modelmbean.MMBInvoker.invokeOperation(MMBInvoker.java:115)
at com.tivoli.jmx.modelmbean.DynamicModelMBeanSupport.invoke(DynamicModelMBeanSupport.java:409)
at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:323)
at com.tivoli.jmx.GenericMBeanSupport.invoke(GenericMBeanSupport.java:178)
at com.tivoli.jmx.MBeanAccess.invoke(MBeanAccess.java:113)
at com.tivoli.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:290)
at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:659)
at com.ibm.ws.console.core.mbean.MBeanHelper.invoke(MBeanHelper.java:141)
at com.ibm.ws.console.appdeployment.ApplicationDeploymentCollectionAction.perform(ApplicationDeploymentCollectionAction.java:336)
at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1791)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1171)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:676)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:203)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:300)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:246)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:652)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:458)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:936)Hi,
It seems one of your ejb jar is missing from the current file location.
D:\dev\workspaces\.metadata\.plugins\org.eclipse.core.resources\.projects\itr-ear\beadep\citron_domain\itr-ear\split_src
you can make it manually copied to this location and build the project again so that it can able to deploy propertly.
Now one more thing you can do open a ticket with oracle support for better assistance.
Regards,
Kal -
Org.apache.jasper.JasperException: Unable to compile class for JSP
Hi All,
I have been using NetBeans IDE 3.5.1. AndI am trying to execute one JSP file, but it is giving error and i am not able to execute the servlet files also in NetBeans IDE. Can anybody help me out regarding this...
type - Exception report
message - Internal Server Error
description - The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception -
org.apache.jasper.JasperException: Unable to compile class for JSP
C:\Documents and Settings\kiran\.netbeans\3.5\tomcat406_base\work\Tomcat-Internal\localhost\C_3A_5CDocuments+and+Settings_5Ckiran_5CNetBeans+IDE+3.5.1_5Ctomcat406_5Cwebapps_5Cctm\jsp1\AdminClient$jsp.java:5: Package login not found in import.
import login.*;
^
C:\Documents and Settings\kiran\.netbeans\3.5\tomcat406_base\work\Tomcat-Internal\localhost\C_3A_5CDocuments+and+Settings_5Ckiran_5CNetBeans+IDE+3.5.1_5Ctomcat406_5Cwebapps_5Cctm\jsp1\AdminClient$jsp.java:7: Package javax.ejb not found in import.
import javax.ejb.*;
^
2 errors
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:285)
at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.loadJSP(IDEJspServlet.java:442)
at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWrapper.loadIfNecessary(IDEJspServlet.java:148)
at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWrapper.service(IDEJspServlet.java:160)
at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspFile(IDEJspServlet.java:246)
at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJspServlet.java:339)
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.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:226)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:484)The page is located at web/test/test.jsp and the java as below
Is there anything still need to add to test.jsp?
DB.java (web/classes/DB/db.class)
package DB;
import java.sql.*;
public class db
String db_url="jdbc:mysql://localhost:3306/DB";
String db_user="root";
String db_password="123456";
private ResultSet r=null;
static private ResultSet res=null;
int staff_Id=0;
/** Creates a new instance of db */
public int getRetrieveId()
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
catch (Exception E)
E.printStackTrace();
try{
Connection C = DriverManager.getConnection(db_url,db_user,db_password);
Statement S = C.createStatement();
r = S.executeQuery("select max(staff_Id) from staff");
while(r.next()){
staff_Id=r.getInt(1);
S.close();
C.close();
catch(Exception e)
e.printStackTrace();
return staff_Id;
public static boolean getSearch(String s)
String search_db_url="jdbc:mysql://localhost:3306/DB";
String search_db_user="root";
String search_db_password="123456";
String str=null;
boolean result=false;
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
catch (Exception E)
E.printStackTrace();
try{
Connection C = DriverManager.getConnection(search_db_url,search_db_user,search_db_password);
Statement S = C.createStatement();
res = S.executeQuery(s);
while(res.next()){
str=res.getString(1);
if(!str.equals(null))
result=true;
S.close();
C.close();
catch(Exception e)
e.printStackTrace();
return result;
public void setUpdate(String str)
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
catch (Exception E)
E.printStackTrace();
try{
Connection C = DriverManager.getConnection(db_url,db_user,db_password);
Statement S = C.createStatement();
int r = S.executeUpdate(str);
S.close();
C.close();
catch(Exception e)
e.printStackTrace();
} -
Unable to deploy EJB application
Hi iam getting the following exception while deploying an EJB application in WebLogic 8.1
Exception:weblogic.management.ApplicationException: prepare failed for Addition
Module: Addition Error: Exception preparing module: EJBModule(Addition,status=NEW)
Unable to deploy EJB: Addition.jar from Addition.jar:
Compiler failed executable.exec
at weblogic.ejb20.ejbc.EJBCompiler.doCompile(EJBCompiler.java:274)
at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:468)
at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:401)
at weblogic.ejb20.deployer.EJBDeployer.runEJBC(EJBDeployer.java:493)
at weblogic.ejb20.deployer.EJBDeployer.compileJar(EJBDeployer.java:763)
what might be the reason for this exception ????This problem is caused by the way WebLogic calls javac to compile the generated classes for the EJBs deployment. This became a big problem for our project with 50 Entity EJBs 2.0 with CMP/CMR, about 15 EJB-QL statements, 3 MDB and 8 Session EJB. I think that these numbers are limits, so exceeding any of these numbers cause javac to exhaust the memory it allocates by default. Even the WebLogic 8.1.Server's administarion console allows you to supply additional parameters for RMI and EJB compilers, it does not allow to supply the -J-Xmx256M (or more) option needed to increase the memory javac allocates.
Thus:
1. In the active $JAVA_HOME/bin of the Server create the file:
Windows:
javac1.cmd Containing:
javac -J-Xmx256M %*
Linux:
javac1.sh Containing:
#!/bin/bash
javac -J-Xmx256M $*
make it "executable"
NOTE: startWeblogic script sets it own JAVA_HOME, so check it first.
2. In the administraitve console of WebLogic 8.1 Server select the server in the left frame under the
<Domain> / Servers branch. In the right frame select the General tab.
3. In the Java Compiler box change javac to javac1.cmd or javac1.sh respectively. No restart is needed.
This solved our problem.
I could not find any solution published, hopefully this will help other colleagues.
Rusi Popov -
Generated servlet error - unable to compile class for JSP - using NB5.5/SS9
I am using NB5.5 beta2 and Sun server 9.0 with JSF 1.1 - all is OK when I am creating firts JSF application - welcomeJSF.jsp page is rendered normally - but when I am adding one more jsp with JSP view and so on - then - I am getting errors in both JSF pages - both - in original welcomeJSF and the new invoice.jsp page
here is code for typical error
org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
[javac] E:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\ERPSolution\org\apache\jsp\welcomeJSF_jsp.java:99: cannot find symbol
[javac] symbol : method setJspId(java.lang.String)
[javac] location: class com.sun.faces.taglib.jsf_core.ViewTag
[javac] jspxth_f_view_0.setJspId("id7");
[javac] ^
Generated servlet error:
[javac] E:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\ERPSolution\org\apache\jsp\welcomeJSF_jsp.java:144: cannot find symbol
[javac] symbol : method setJspId(java.lang.String)
[javac] location: class com.sun.faces.taglib.html_basic.OutputTextTag
[javac] jspxth_h_outputText_0.setJspId("id17");
[javac] ^
Generated servlet error:
[javac] E:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\ERPSolution\org\apache\jsp\welcomeJSF_jsp.java:145: setValue(java.lang.String) in com.sun.faces.taglib.html_basic.OutputTextTag cannot be applied to (javax.el.ValueExpression)
[javac] jspxth_h_outputText_0.setValue(org.apache.jasper.runtime.PageContextImpl.getValueExpression("Java Server Faces", (PageContext)_jspx_page_context, java.lang.Object.class, null));
[javac] ^
[javac] 3 errors
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:94)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:384)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:461)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:528)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:507)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:495)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:530)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:409)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:317)
javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:414)
com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:455)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:139)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:159)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
note The full stack trace of the root cause is available in the Sun Java System Application Server Platform Edition 9.0 logs.
and there is output for another error:
Generated servlet error:
[javac] E:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\ERPSolution\org\apache\jsp\welcomeJSF_jsp.java:144: cannot find symbol
[javac] symbol : method setJspId(java.lang.String)
[javac] location: class com.sun.faces.taglib.html_basic.OutputTextTag
[javac] jspxth_h_outputText_0.setJspId("id17");
[javac] ^
Generated servlet error:
[javac] E:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\ERPSolution\org\apache\jsp\welcomeJSF_jsp.java:145: setValue(java.lang.String) in com.sun.faces.taglib.html_basic.OutputTextTag cannot be applied to (javax.el.ValueExpression)
[javac] jspxth_h_outputText_0.setValue(org.apache.jasper.runtime.PageContextImpl.getValueExpression("Java Server Faces", (PageContext)_jspx_page_context, java.lang.Object.class, null));
[javac] ^
[javac] 3 errors
and here is code of my new invoice.jsp page:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%--
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library... action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%>
<%--
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
--%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<f:view>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1><h:outputText value="Java Server Faces" /></h1>
<h:inputText value="#{managerBean.currentInvoice.id}"/>
<h:inputText value="#{managerBean.currentInvoice.description}"/>
<h:inputText value="#{managerBean.currentInvoice.total}"/>
<h:commandButton value="new_invoice"
type="submit"
actionListener="#{managerBean.createNewInvoice}"/>
</body>
</f:view>and faces-config.xml file:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<!-- =========== FULL CONFIGURATION FILE ================================== -->
<faces-config>
<managed-bean>
<managed-bean-name>managerBean</managed-bean-name>
<managed-bean-class>com.brl.ERPSolution.ui.ManagerBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>managerBean was intended to be backing beans which will call the facaed beans of EJB 3.0 entity beans - but at presnet - almost empty methods are declared there:
package com.brl.ERPSolution.ui;
import javax.faces.event.ActionEvent;
import com.brl.solutions.EJB3.*;
* @author Administrator
public class ManagerBean {
protected int currentInvoiceId;
protected Invoices currentInvoice;
protected InvoicesFacade invoicesFacade;
/** Creates a new instance of ManagerBean */
public ManagerBean() {
/* business methods */
public void createNewInvoice(ActionEvent actionEvent)
invoicesFacade.create(this.currentInvoice);
public Invoices getCurrentInvoice()
return this.currentInvoice;
public void setCurrentInvoice(Invoices currentInvoice)
this.currentInvoice=currentInvoice;
}I read in one blog (actually - the only page which was returned by yahoo - so - this should be very rare error!!!) to try to use Sun server's verifier.bat - and - it reported 0 errors and 0 warning. Build was succesfull as well and also - deployment was without errors - but - above mentioned error appeared during the automatic compilation of jsp pages/servlet when newly deployed jsps are first accessed from remote browser.
So - is it possible, please, to receive some advice - what to do further? I feel that my invoice.jsp page can be with errors, - however - the original welcomeJSF.jsp should be working without errors even the erronwous JFS jsp page is added to web application.
Thans for any adice or hint in advance!!!OK - I have made 'clean and build main project' from NB menu and the deployed the resulting *.war and the error messages have disappeared... So - it seems to be bug...
-
Hi all
We are using code compiled on wl8 sp3 on wl6 envt
Few days it worked fine then suddenly we are getting the below exception while restart of the server .The same code is working fine in other wl6 instance .
We cleared the cache and tried to restart the server but still getting the same exception.Just was wondering how come the same code works in one envt and gives this exception in other even though both have same environmental settings and DB.This code runs well in wl8 envt.I would appreciate any help in this regard
Thread: '1' for queue: '__weblogic_admin_html_queue'> <system> <> <160001> <Error deploying application apollo_ejb:
Unable to deploy EJB: CxAccount from apollo_adapter.jar:
There is a mismatch between the bean code and generated code.CxAccount . Please rerun ejbc on the bean code.The error was java.lang.NoSuchFieldException
at java.lang.Class.getField0(Native Method)
at java.lang.Class.getDeclaredField(Class.java:1113)
at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.setMDField(ClientDrivenBeanInfoImpl.java:651)
at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.setMethodDescriptors(ClientDrivenBeanInfoImpl.java:723)
at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.deploy(ClientDrivenBeanInfoImpl.java:813)
at weblogic.ejb20.deployer.Deployer.deployDescriptor(Deployer.java:1234)
at weblogic.ejb20.deployer.Deployer.deploy(Deployer.java:947)
at weblogic.j2ee.EJBComponent.deploy(EJBComponent.java:30)
at weblogic.j2ee.Application.addComponent(Application.java:163)
at weblogic.j2ee.J2EEService.addDeployment(J2EEService.java:117)
at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:329)
at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:144)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:636)
at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621)
at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:359)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1555)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at weblogic.management.internal.ConfigurationMBeanImpl.updateConfigMBeans(ConfigurationMBeanImpl.java:491)
at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:361)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1555)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
at $Proxy22.addDeployment(Unknown Source)
at weblogic.management.internal.DynamicMBeanImpl.updateDeployments(DynamicMBeanImpl.java:1516)
at weblogic.management.internal.DynamicMBeanImpl.setAttribute(DynamicMBeanImpl.java:895)
at weblogic.management.internal.DynamicMBeanImpl.setAttribute(DynamicMBeanImpl.java:847)
at weblogic.management.internal.ConfigurationMBeanImpl.setAttribute(ConfigurationMBeanImpl.java:295)
at com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.java:1356)
at com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.java:1331)
at weblogic.management.internal.MBeanProxy.setAttribute(MBeanProxy.java:322)
at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:204)
at $Proxy19.setTargets(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.management.console.info.FilteredMBeanAttribute.doSet(FilteredMBeanAttribute.java:92)
at weblogic.management.console.actions.mbean.DoEditMBeanAction.perform(DoEditMBeanAction.java:135)
at weblogic.management.console.actions.internal.ActionServlet.doAction(ActionServlet.java:171)
at weblogic.management.console.actions.internal.ActionServlet.doPost(ActionServlet.java:85)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2495)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
Regards
NirajHi all
We are using code compiled on wl8 sp3 on wl6 envt
Few days it worked fine then suddenly we are getting the below exception while restart of the server .The same code is working fine in other wl6 instance .
We cleared the cache and tried to restart the server but still getting the same exception.Just was wondering how come the same code works in one envt and gives this exception in other even though both have same environmental settings and DB.This code runs well in wl8 envt.I would appreciate any help in this regard
Thread: '1' for queue: '__weblogic_admin_html_queue'> <system> <> <160001> <Error deploying application apollo_ejb:
Unable to deploy EJB: CxAccount from apollo_adapter.jar:
There is a mismatch between the bean code and generated code.CxAccount . Please rerun ejbc on the bean code.The error was java.lang.NoSuchFieldException
at java.lang.Class.getField0(Native Method)
at java.lang.Class.getDeclaredField(Class.java:1113)
at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.setMDField(ClientDrivenBeanInfoImpl.java:651)
at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.setMethodDescriptors(ClientDrivenBeanInfoImpl.java:723)
at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.deploy(ClientDrivenBeanInfoImpl.java:813)
at weblogic.ejb20.deployer.Deployer.deployDescriptor(Deployer.java:1234)
at weblogic.ejb20.deployer.Deployer.deploy(Deployer.java:947)
at weblogic.j2ee.EJBComponent.deploy(EJBComponent.java:30)
at weblogic.j2ee.Application.addComponent(Application.java:163)
at weblogic.j2ee.J2EEService.addDeployment(J2EEService.java:117)
at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:329)
at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:144)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:636)
at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621)
at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:359)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1555)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at weblogic.management.internal.ConfigurationMBeanImpl.updateConfigMBeans(ConfigurationMBeanImpl.java:491)
at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:361)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1555)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
at $Proxy22.addDeployment(Unknown Source)
at weblogic.management.internal.DynamicMBeanImpl.updateDeployments(DynamicMBeanImpl.java:1516)
at weblogic.management.internal.DynamicMBeanImpl.setAttribute(DynamicMBeanImpl.java:895)
at weblogic.management.internal.DynamicMBeanImpl.setAttribute(DynamicMBeanImpl.java:847)
at weblogic.management.internal.ConfigurationMBeanImpl.setAttribute(ConfigurationMBeanImpl.java:295)
at com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.java:1356)
at com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.java:1331)
at weblogic.management.internal.MBeanProxy.setAttribute(MBeanProxy.java:322)
at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:204)
at $Proxy19.setTargets(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.management.console.info.FilteredMBeanAttribute.doSet(FilteredMBeanAttribute.java:92)
at weblogic.management.console.actions.mbean.DoEditMBeanAction.perform(DoEditMBeanAction.java:135)
at weblogic.management.console.actions.internal.ActionServlet.doAction(ActionServlet.java:171)
at weblogic.management.console.actions.internal.ActionServlet.doPost(ActionServlet.java:85)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2495)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
Regards
Niraj -
Unable to deploy EJB - NullPointerException
Hello,
We are migrating our application from WebLogic 8.1 to WebLogic 10.0.
We changed the deployment descriptors according WL 10.0 specs. The application deploys and activates seamlessly. The problem comes when we try to start it (for "Servicing all requests"):
<Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1191253811043' for task '12'. Error is: 'weblogic.application.ModuleException: Exception activating module: EJBModule(persistence.jar)
Unable to deploy EJB: ReportParameterBean from persistence.jar:
null
weblogic.application.ModuleException: Exception activating module: EJBModule(persistence.jar)
Unable to deploy EJB: ReportParameterBean from persistence.jar:
null
at weblogic.ejb.container.deployer.EJBModule.activate(EJBModule.java:440)
at weblogic.application.internal.flow.ModuleListenerInvoker.activate(ModuleListenerInvoker.java:107)
at weblogic.application.internal.flow.DeploymentCallbackFlow$2.next(DeploymentCallbackFlow.java:381)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:71)
Truncated. see log file for complete stacktrace
java.lang.NullPointerException
at weblogic.ejb.container.cmp.rdbms.RDBMSPersistenceManager.setupParentBeanManagers(RDBMSPersistenceManager.java:1904)
at weblogic.ejb.container.deployer.CMPInfoImpl.setupParentBeanManagers(CMPInfoImpl.java:326)
at weblogic.ejb.container.deployer.EJBDeployer.activate(EJBDeployer.java:1382)
at weblogic.ejb.container.deployer.EJBModule.activate(EJBModule.java:423)
at weblogic.application.internal.flow.ModuleListenerInvoker.activate(ModuleListenerInvoker.java:107)
Truncated. see log file for complete stacktrace
>
<Error> <Deployer> <BEA-149202> <Encountered an exception while attempting to commit the 7 task for the application 'tms'.>
<Warning> <Deployer> <BEA-149004> <Failures were detected while initiating start task for application 'tms'.>
<Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException: Exception activating module: EJBModule(persistence.jar)
Unable to deploy EJB: ReportParameterBean from persistence.jar:
null
at weblogic.ejb.container.deployer.EJBModule.activate(EJBModule.java:440)
at weblogic.application.internal.flow.ModuleListenerInvoker.activate(ModuleListenerInvoker.java:107)
at weblogic.application.internal.flow.DeploymentCallbackFlow$2.next(DeploymentCallbackFlow.java:381)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:71)
Truncated. see log file for complete stacktrace
java.lang.NullPointerException
at weblogic.ejb.container.cmp.rdbms.RDBMSPersistenceManager.setupParentBeanManagers(RDBMSPersistenceManager.java:1904)
at weblogic.ejb.container.deployer.CMPInfoImpl.setupParentBeanManagers(CMPInfoImpl.java:326)
at weblogic.ejb.container.deployer.EJBDeployer.activate(EJBDeployer.java:1382)
at weblogic.ejb.container.deployer.EJBModule.activate(EJBModule.java:423)
at weblogic.application.internal.flow.ModuleListenerInvoker.activate(ModuleListenerInvoker.java:107)
Truncated. see log file for complete stacktrace
>
The application worked just fine on WL 8.1. There are no changes in the code. The changes in the deployment descriptors are the minimum required to deploy the application on WL 10.0.
Any idea what can be the reason for this error?Hello auspost_simon,
Thank you for your answer.
We always compile our project with Sun's Java (JDK) compiler. Up to now our application had to be compatible with other app.servers and we used only the WL Builder tool from v.8.1 to build the specific deployment descriptors. We searched for a similar tool in WL 10.0 but we didn't managed to find one.
We tried the migration tools supplied with WL 10.0 to migrate the deployment descriptors. The result of the EAR (EJB) with the migrated DDs is the same as the demonstrated.
Please be more specific - what do you mean by "WL 10.0 compilers and builders"? To be honest we are migrating to WL 10.0 on the fly - we have almost no time to read the docs, so any clue on "WL 10.0 compilers and builders" is appreciate. -
Javax.naming.NameNotFoundException: Unable to resolve ejb-link.
Env: JDK 1.3.1_08
Weblogic: 7.0
We are attempting to use EJB's (session) and have it all localized in a jar.
The Business and Custom Logic is all compiled to WEB-INF/classes. All the jars including the EJB jar is under WEB-INF/lib.
On Startup Weblogic throws the error message
weblogic.management.ApplicationException: activate failed for application
Module Name: application, Error: weblogic.j2ee.DeploymentException: Could not setup environment - with nested exception:
[javax.naming.NameNotFoundException: Unable to resolve ejb-link. Appejb.jar#AppServerBean is not in the context. The context includes the following link bindings: {} Make sure the link reference is relative to the URI of the referencing module.]
I have tried using the ../ notation before the Appejb.jar in the web.xml and what not, but that does not work either.
I have sucesfully deployed the EJB jar through the weblogic console.
Any Clues or suggestions will be most appreciated..
thanks
-aCreate a ear application from the ejb jar and web application war.
Copy ear application to the applications directory.
In the ejb-link element in web.xml specify the relative path to the ejb jar.
<ejb-link>../Appejb.jar</ejb-link>
thanks,
Deepak
Akshay <[email protected]> wrote:
Env: JDK 1.3.1_08
Weblogic: 7.0
We are attempting to use EJB's (session) and have it all localized in
a jar.
The Business and Custom Logic is all compiled to WEB-INF/classes. All
the jars including the EJB jar is under WEB-INF/lib.
On Startup Weblogic throws the error message
weblogic.management.ApplicationException: activate failed for application
Module Name: application, Error: weblogic.j2ee.DeploymentException: Could
not setup environment - with nested exception:
[javax.naming.NameNotFoundException: Unable to resolve ejb-link. Appejb.jar#AppServerBean
is not in the context. The context includes the following link bindings:
{} Make sure the link reference is relative to the URI of the referencing
module.]
I have tried using the ../ notation before the Appejb.jar in the web.xml
and what not, but that does not work either.
I have sucesfully deployed the EJB jar through the weblogic console.
Any Clues or suggestions will be most appreciated..
thanks
-a -
Unable to compile class for JSP
Please can anyone help me to solve this.
Actually,this is the condition.
In my db,there is a table called UserPassword, which has 4
fields(empNo,UserName,password,level). Now I want to do these things:
When the user submits the data to create a new account via HTML form, it submits the data to the file called CreateAcc.jsp. In this file it perform some logic,here are they.
1)To check the empNo,if it is already exist in the DB,
if empNo =exist then display error.(record already exist)
if empNo =notexist then do task 2).
2)check the UserName,if it is already exist in the db,
if UserName=exist then display error.(because it's a primary key)
if UserName=notexist then do task 3).
3)Create a new user account and save it to the db.
To do these tasks,I never create a new objects for the tasks 1) and 2).
only for task 3)create an object.
Is it the right way?
Here is the file CreateAcc.jsp
<%@ page language="java" %>
<%@ page import="core.UserAccManager" %>
<%@ page import="data.UserPassword" %>
<jsp:useBean id="UserAccManager" class="core.UserAccManager" scope="session"/>
<jsp:setProperty name="UserAccManager" property="*"/>
<jsp:useBean id="UserPassword" class="data.UserPassword" scope="session"/>
<jsp:setProperty name="UserPassword" property="*"/>
<%
String nextPage ="MainForm.jsp";
if(UserPassword.verifyEmpno()){
if(UserPassword.verifyUsername()){
if(UserPassword.createAcc()) nextPage ="MsgAcc.jsp";
}else{
nextPage="UserNameExist.jsp";
else{
nextPage="UserAccError.jsp";
%>
<jsp:forward page="<%=nextPage%>"/>The directory structure:
UserPassword.java- F:/Project/core/data/UserPassword.java
UserAccManager.java - F:/Project/core/UserAccManager.java
Now both are compiling.I put the class files into the TOMCAT,as follows.
UserAccManager.class - webapps/mySystemName/WEB-INF/classes/core/
UserPassword.class - webapps/mySystemName/WEB-INF/classes/core/data/
Here is the full code of the file UserAccManager.java.
package core; //Is this right?
import data.UserPassword; //Is this right?
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public final class UserAccManager{
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost:3306/superfine";
private static Connection connection;
private static PreparedStatement pstmt1;
private static PreparedStatement pstmt2;
private static PreparedStatement pstmt3;
private UserAccManager(){
// Initializes the connection and statements
public static void initConnection() {
if (connection == null) {
try {
String sql;
// Open the database
Class.forName(DRIVER).newInstance();
connection = DriverManager.getConnection(URL);
// Prepare the statements
sql = "SELECT * FROM UserPassword where empNo= ?";
pstmt1 = connection.prepareStatement(sql);
sql = "SELECT UserName FROM UserPassword where UserName= ?";
pstmt2 = connection.prepareStatement(sql);
sql ="INSERT INTO UserPassword VALUES(?,?,?,?)";
pstmt3 = connection.prepareStatement(sql);
catch (Exception ex) {
System.err.println(ex.getMessage());
// Closes the connection and statements
// Method to be called by main class when finished with DB
public void closeConnection() {
//same as previous
public static boolean verifyEmpno(int empno) {
boolean emp_no_select_ok = false;
int emp = -1;
initConnection();
try {
pstmt1.setInt(1, empno);
ResultSet rs1 = pstmt1.executeQuery();
while(rs1.next()){
emp=rs1.getInt("empNo");
if(emp>0)
emp_no_select_ok = false;
} else{
emp_no_select_ok = true;
rs1.close();
pstmt1.close();
catch (Exception ex) {
System.err.println(ex.getMessage());
return emp_no_select_ok;
public static boolean verifyUsername(String username) {
boolean user_name_select_ok = false;
String user = "xxxx";
initConnection();
try {
pstmt2.setString(1, username);
ResultSet rs2 = pstmt2.executeQuery();
while(rs2.next()){
user=rs2.getString("UserName");
if(!user.equals("xxxx"))
user_name_select_ok = false;
} else{
user_name_select_ok = true;
rs2.close();
catch (Exception ex) {
System.err.println(ex.getMessage());
return user_name_select_ok;
public static boolean createAcc(int empno, String username, String password, int
level){
boolean create_acc_ok = false;
initConnection();
try{
//create a new object,from the UserPassword table.
UserPassword useraccount = new UserPassword();
useraccount.setEmpno(empno);
useraccount.setUsername(username);
useraccount.setPassword(password);
useraccount.setLevel(level);
//assign value for ???
pstmt3.setInt(1, useraccount.getEmpno());
pstmt3.setString(2, useraccount.getUsername());
pstmt3.setString(3, useraccount.getPassword());
pstmt3.setInt(4, useraccount.getLevel());
if(pstmt3.executeUpdate()==1) create_acc_ok=true;
pstmt3.close();
//con.close();
catch(SQLException e2){
System.err.println(e2.getMessage());
return create_acc_ok;
}here is the bean (part of it)
package data; //is it right?
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class UserPassword
private int empno;
private String username;
private String password;
private int level;
// Constructor
public UserPassword()
this.empno = empno;
this.username = username;
this.password = password;
this.level = level;
// setters and getters are here.
// public boolean verifyEmpno() {
// return UserAccManager.verifyEmpno(empno);
// public boolean verifyUsername(String username) {
// return UserAccManager.verifyUsername(username);
// These 2 methods not compile with or without para's.So I leave that job for the
//controll class UserAccManager.java.
Now my problem is this: When I submit data, there is an error;org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:8:
cannot access core.data.UserPassword
bad class file: C:\Program Files\Apache Group\Tomcat
4.1\webapps\HRM\WEB-INF\classes\core\data\UserPassword.class
class file contains wrong class: data.UserPassword
Please remove or make sure it appears in the correct subdirectory of the classpath.
import core.data.UserPassword;
^
1 error
Are there any mistakes? If so tell me where is it and how to change them.Please help.I try it that way, but it don't compile.
Error:core\data\UserPassword.java:package javax.servlet does not exist
import javax.servlet.*;
core\data\UserPassword.java:package javax.servlet.http does not exist
import javax.servlet.http.*;
So,I comment them only in the UserPassword.java file,and compile it again.
Then it compile well.I goto the directory to get the .class files.
But there is only UserPassword.class inside the data folder. There is not
UserAccManager.class in the core folder.
Then I try this way,I put my 2 java files in to a new folder,
F:\SystemName\com
When I try it that way, but it don't compile.
javac -classpath . -d . com\*.javaError:com\UserPassword.java:package javax.servlet does not exist
import javax.servlet.*;
com\UserPassword.java:package javax.servlet.http does not exist
import javax.servlet.http.*;
So,I comment them only in the UserPassword.java file,and compile it again.
Now both are compiling well.There was 2 class files.
I put them in to the WEB-INF/classes/com directory.
Start the server.But it gave errors:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:68: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserPassword.verifyEmpno(empno)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyUsername(username)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: non-static method
verifyUsername(java.lang.String) cannot be referenced from a static context
if(UserAccManager.verifyUsername(username)){
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable password
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable level
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: non-static method
createAcc(int,java.lang.String,java.lang.String,int) cannot be referenced from a static
context
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
8 errorsTo solve the problem non-static method,I goto the UserAccManager.java file and do these
things.
package com;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
//import javax.servlet.*; //otherwise it tells an error.(package
//javax.servlet does not exist)
//import javax.servlet.http.*;
public class UserAccManager {
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost:3306/superfine";
private static Connection connection;
private static PreparedStatement pstmt1;
private static PreparedStatement pstmt2;
private static PreparedStatement pstmt3;
private UserAccManager() {
// Initializes the connection and statements
private static void initConnection() {
//same
// Closes the connection and statements
// Method to be called by main class when finished with DB
public static void closeConnection() {
//same
public static boolean verifyEmpno(int empno) {
// same.
public static boolean verifyUsername(String username) {
//same.
public static boolean createAcc(int empno, String username, String password, int
level){
//same
package com;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;
//import javax.servlet.*;
//import javax.servlet.http.*;
public class UserPassword {
// same
Again compile those files and put .class filses into the WEB-INF/classes/com directory.
When i submits the data via the form it generates an error:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:68: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyEmpno(empno)){
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.verifyUsername(username)){
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable empno
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable username
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable password
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
Generated servlet error:
C:\Program Files\Apache Group\Tomcat
4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
symbol : variable level
location: class org.apache.jsp.CreateAcc_jsp
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
^
6 errorshere is the CreateAcc.jsp file
<%@ page language="java" %>
<%@ page import="com.UserAccManager" %>
<%@ page import="com.UserPassword" %>
<jsp:useBean id="userPassword" class="com.UserPassword" scope="request"/>
<jsp:setProperty name="userPassword" property="*" />
<%
String nextPage ="MainForm.jsp";
if(UserAccManager.verifyEmpno(empno)){
if(UserAccManager.verifyUsername(username)){
if(UserAccManager.createAcc(empno, username,password,level)) nextPage
="MsgAcc.jsp";
}else{
nextPage="UserNameExist.jsp";
else{
nextPage="UserAccError.jsp";
%>
<jsp:forward page="<%=nextPage%>"/>Please, anyone know how to send these parameters to the java file.
Thanks. -
Unable to Compile New Report.vi
Error 7
Error 1003
I am unable to compile the New Report.vi from the Report Generation Toolkit.
I have Windows 2000 and LV 7.1.
I have Forced Re-Compliation of all my VIs (Ctrl-Shift-Run)
I have tried adding Dynamic links in my App build.
What else can I try?Duplicate post, see original thread here.
-D
Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman -
Error while deploying WC application: Unable to deploy EJB
Hi All,
we are getting the below error quite frequently, whenever we deploy the application to server:
[03:35:14 AM] Weblogic Server Exception: weblogic.application.ModuleException: Exception preparing module: EJBModule(CAWrapperEJB.jar)
Unable to deploy EJB: CAService from CAWrapperEJB.jar:
[EJB:011055]Error deploying the EJB 'CAService(Application: CAPortal, EJBComponent: CAWrapperEJB.jar)', the JNDI name 'CAPortal-CAPModel-CAService2#com.lexisnexis.service.CAService' is already in use. You must set a different JNDI name in the weblogic-ejb-jar.xml deployment descriptor or corresponding annotation for this EJB before it can be deployed.
[03:35:14 AM] Caused by: java.lang.Throwable: Substituted for missing class [EJB - 11055]Error deploying the EJB 'CAService(Application: CAPortal, EJBComponent: CAWrapperEJB.jar)', the JNDI name 'CAPortal-CAPModel-CAService2#com.lexisnexis.service.CAnService' is already in use. You must set a different JNDI name in the weblogic-ejb-jar.xml deployment descriptor or corresponding annotation for this EJB before it can be deployed.
[03:35:14 AM] See server logs or server console for more details.
-to solve this issue we just delete the cache and restart the Managed server.
Please tell me what is the cause of this error and how can we fix it permanently, as restarting the server everytime is not very convenient.
TIA,
BobThe content of "weblogic-ejb-jar.xml" present in code is:
<?xml version = '1.0' encoding = 'windows-1252'?>
<weblogic-ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-ejb-jar http://www.bea.com/ns/weblogic/weblogic-ejb-jar/1.0/weblogic-ejb-jar.xsd"
xmlns="http://www.bea.com/ns/weblogic/weblogic-ejb-jar">
</weblogic-ejb-jar> -
Hi !
When I try to compile in JDev with javac and the java 1.3.1 library, I get the following error :
Error: javac: invalid flag: -source
The command line generated by JDev looks like :
C:\jdk1.3.1_03\bin\javac.exe -J-mx512m -verbose -deprecation -source 1.3 -target 1.3 -encoding Cp1252 -g -classpath [...] -sourcepath [...] -d [...] @C:\DOCUME~1\user\LOCALS~1\Temp\javac54193.tmp
It seems that -source and -target flags do not exist in this version of javac.
But it does not seem possible to remove these flags generated by JDev, so I'm unable to compile with javac 1.3.1 and JDev.
So i'm looking for :
- A workaround to prevent JDev from adding the -source and -target flags.
- A future release of JDev where you could disable these flags, or, much better, where JDev automatically disables these flags when it detects a 1.3.1 library (there may be other incompatible flags I did not mention).
Thank you for your answers :)Hi,
when you open the project properties and choose the compiler option to tht the compiler to "javac" and then the "source" and "target" to 1.3, wouldn't this compile it for Java 3? I don't think that it is necesary to use JDK 1.3 for compiling the sources
Cross-Compilation Options
By default, classes are compiled against the bootstrap and extension classes of the platform that javac shipped with. But javac also supports cross-compiling, where classes are compiled against a bootstrap and extension classes of a different Java platform implementation. It is important to use -bootclasspath and -extdirs when cross-compiling; see Cross-Compilation Example below.
-target version
Generate class files that will work on VMs with the specified version. The default is to generate class files to be compatible with the 1.2 VM in the Java 2 SDK. The versions supported by javac in the Java 2 SDK are:
1.1
Ensure that generated class files will be compatible with 1.1 and VMs in the Java 2 SDK.
1.2
Generate class files that will run on VMs in the Java 2 SDK, v 1.2 and later, but will not run on 1.1 VMs. This is the default.
1.3
Generate class files that will run on VMs in the Java 2 SDK, v 1.3 and later, but will not run on 1.1 or 1.2 VMs.
1.4
Generate class files that are compatible only with 1.4 VMs.
http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javac.html
Frank -
Unable to compile servlet files in javac
i am unable to compile servlet *.java files in javac.as far as i can see my path is correct.
Kindly provide a solution as soon as possible.
My jdk1.3 is in my c drive and my tomcat in my d drive.
if you are able to compile kindly let me know your path.
it says symbol not resolved.i think that it is unable to import from javaxAssuming that your jdk is in c drive as c:\jdk1.3 set the path and the classpath like as shown below. Remember that you have to set the classpath for the classes in the javax.servlet and javax.servlet.http packages. I know how to do it for JavaWebServer. JavaWebServer has a jar called servlet.jar that contains all these classes. What you need to do is to put this jar file in your classpath. There will be a similar jar file for Tomcat server also. You need to refer the Tomcat server documentation for that.
The path and the classpath have to be set like this...
d:\>path=%path%;.;c:\jdk1.3\bin;
d:\>set classpath=%classpath%;.;c:\jdk1.3\lib;c:\JavaWebServer2.0\lib\servlet.jar;
assuming tht JWS is installed in c:\JavaWebServer2.0
Also note that there should be no spaces in between while setting the classpath. In your case you have to change the last part of the classpath to customize your requirement.
Hope that will help.
Regards
Jaydeep -
Unable to compile class for JSP. apache-tomcat-6. What could be wrong?
Hello, I am new to JSP and I am trying a very basic jsp and class file on Windows XP. I get the Unable to compile class for JSP.
Steps that I have done:
javac ch06_01.java , placed the ch06_01.class under
C:\Apps\apache-tomcat-6.0.16\webapps\ch06\WEB-INF\classes
Then grabbed the ch06_02.jsp and placed it under
C:\Apps\apache-tomcat-6.0.16\webapps\ch06\
When I run it (by placing this into Explorer or Firefox URL
http://localhost:8080/ch06/ch06_02.jsp) I get the error further
below. Things I have done and made sure they are in place are:
set up JAVA_HOME to C:\Apps\jdk1.6.0_06
Using CATALINA_BASE: C:\Apps\apache-tomcat-6.0.16
Using CATALINA_HOME: C:\Apps\apache-tomcat-6.0.16
Using CATALINA_TMPDIR: C:\Apps\apache-tomcat-6.0.16\temp
Using JRE_HOME: C:\Apps\jre1.6.0_06
I did a google on the error and I found people saying to place the
tools.jar from the jsk into the lib directory under CATALINA_HOME. But
the examples still don't work. What step could I be missing? Your help is greatly
appreciated.
This is the simple jsp file:
<%@ page import="ch06_01" %>
<HTML>
<HEAD>
<TITLE>Using a JavaBean</TITLE>
</HEAD>
<BODY>
<H1>Using a JavaBean</H1>
<% ch06_01 messager = new ch06_01(); %>
The message is: <%= messager.msg() %>
</BODY>
</HTML>
this is the simple ch6_01 java file:
public class ch06_01
public ch06_01()
public String msg()
return "Hello from JSP!";
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented
it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 6 in the generated java file
The import ch06_01 cannot be resolved
An error occurred at line: 9 in the jsp file: /ch06_02.jsp
ch06_01 cannot be resolved to a type
6: <BODY>
7: <H1>Using a JavaBean</H1>
8:
9: <% ch06_01 messager = new ch06_01(); %>
10:
11: The message is: <%= messager.msg() %>
12:
An error occurred at line: 9 in the jsp file: /ch06_02.jsp
ch06_01 cannot be resolved to a type
6: <BODY>
7: <H1>Using a JavaBean</H1>
8:
9: <% ch06_01 messager = new ch06_01(); %>
10:
11: The message is: <%= messager.msg() %>
12:
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:316)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
Edited by: indikon1 on Jun 12, 2008 1:18 PM
I just updated the directories of the variables to reflect the current status of my system.What is wrong is that you are using an "old" jsp tutorial :-)
Since Java 1.4, JSPs have been unable to access classes in the "default" package.
What you need to do:
Put the java class ch06_01 in a package.
Steps to do this
- Edit ch06_01 and add the following to the very top of the file (without the quotes): "package mypackage;"
- create a folder "mypackage"
- move ch06_01.java into that folder
- compile that class (now in the mypackage package)
- place ch06_01.class under C:\Apps\apache-tomcat-6.0.16\webapps\ch06\WEB-INF\classes\mypackage
In your jsp:
<%@ page import="mypackage.ch06_01" %>
I would suggest using a more up-to-date tutorial that uses JSTL.
Take a look at this [Apache Tomcat tutorial|http://www.coreservlets.com/Apache-Tomcat-Tutorial/index.html]
Maybe you are looking for
-
How can I disable the access to windows 2000(O.S.) from LabView?
I need to disable the access to windows when an application (exe), created by LabView, is running. When the application is running, the user can not acces to windows (for example, execute another application) until he stops the application. I am usin
-
RE: NT Server Reboot and Forte Partitions[Ref:C943460]
Hi Bradley. At our customers, we need one of our Forte applications to be running for data communications to take place. After a reboot, we need this application's partitions to come online. The way we did this (as you suggested) was to use a BAT fil
-
I have a macbook pro, and when i go to watch youtube it says i need the newest flash player, so i download it but then i go back to youtube and it still says i need to download it again. How do I make it work?
-
Change data capture - ignore delete?
Hello, I'm trying to solve an issue I met on a synchronous change data capture : I created a CDC table with the DBMS_LOGMNR_CDC_PUBLISH.CREATE_CHANGE_TABLE procedure: BEGIN DBMS_LOGMNR_CDC_PUBLISH.CREATE_CHANGE_TABLE ( OWNER => '
-
Need help getting a very simple RMI program running
I've been pulling my hair out trying to get RMI running on windows. I decided to do a verbatim copy of a tutorial to see if it would work, well it didn't. Here is the sample code: //HelloInterface.java - located in dir c:\java import java.rmi.*; publ