Problem invoking servlet
Hello.
I'm trying to invoke a servlet. I get the following error:
javax.servlet.ServletException: [HTTP:101250][ServletContext(id=371807,name=BibleApp,context-path=/BibleApp)]:
Servlet class /com/brainysoftware/burnaby/ControllerServlet for servlet ControllerServlet
could not be loaded because a class on which it depends was not found in the classpath
C:\bea\user_projects\infologic1\applications\BibleApp;C:\bea\user_projects\infologic1\applications\BibleApp\WEB-INF\classes.
java.lang.NoClassDefFoundError: /com/brainysoftware/burnaby/ControllerServlet
(wrong name: ControllerServlet).
at weblogic.servlet.internal.ServletStubImpl.prepareServlet
web.xml
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>simple</servlet-name>
<jsp-file>simplePage.jsp</jsp-file>
</servlet>
<servlet>
<servlet-name>ControllerServlet</servlet-name>
<servlet-class>com.brainysoftware.burnaby.ControllerServlet</servlet-class>
<!-- Define initial parameters that will be loaded into
the ServletContext object in the controller servlet -->
<init-param>
<param-name>base</param-name>
<param-value>http://localhost:7001/BibleApp/ControllerServlet</param-value>
</init-param>
<init-param>
<param-name>jdbcDriver</param-name>
<param-value>weblogic.jdbc.mssqlserver4.Driver</param-value>
</init-param>
<init-param>
<param-name>imageUrl</param-name>
<param-value>http://localhost:7001/BibleApp/images/</param-value>
</init-param>
<init-param>
<param-name>dbUrl</param-name>
<param-value>jdbc:weblogic:mssqlserver4:users@COMPAQSERVER</param-value>
</init-param>
<init-param>
<param-name>dbUserName</param-name>
<param-value>dinesh</param-value>
</init-param>
<init-param>
<param-name>dbPassword</param-name>
<param-value>werty69</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>test</servlet-name>
<jsp-file>menu_1.jsp</jsp-file>
</servlet>
<servlet>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>HelloServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>ShowEmployees</servlet-name>
<servlet-class>ShowEmployees</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/helloservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/test</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>simple</servlet-name>
<url-pattern>/simple</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ShowEmployees</servlet-name>
<url-pattern>/ShowEmployees</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ControllerServlet</servlet-name>
<url-pattern>/controlIt</url-pattern>
</servlet-mapping>
</web-app>
ControllerServlet.class
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import com.brainysoftware.burnaby.DbBean;
public class ControllerServlet extends HttpServlet {
/**Initialize global variables*/
public void init(ServletConfig config) throws ServletException {
System.out.println("initializing controller servlet.");
ServletContext context = config.getServletContext();
context.setAttribute("base", config.getInitParameter("base"));
context.setAttribute("imageUrl", config.getInitParameter("imageUrl"));
// instantiating the DbBean
DbBean dbBean = new DbBean();
// initialize the DbBean's fields
dbBean.setDbUrl(config.getInitParameter("dbUrl"));
dbBean.setDbUserName(config.getInitParameter("dbUserName"));
dbBean.setDbPassword(config.getInitParameter("dbPassword"));
// put the bean in the servlet context
// the bean will be accessed from JSP pages
context.setAttribute("dbBean", dbBean);
try {
// loading the database JDBC driver
Class.forName(config.getInitParameter("jdbcDriver"));
catch (ClassNotFoundException e) {
System.out.println(e.toString());
super.init(config);
/**Process the HTTP Get request*/
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
doPost(request, response);
/**Process the HTTP Post request*/
public void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
String base = "/jsp/";
String url = base + "Default.jsp";
String action = request.getParameter("action");
if (action!=null) {
if (action.equals("search"))
url = base + "SearchResults.jsp";
else if (action.equals("browseCatalog"))
url = base + "BrowseCatalog.jsp";
else if (action.equals("productDetails"))
url = base + "ProductDetails.jsp";
else if (action.equals("productDetails"))
url = base + "ProductDetails.jsp";
else if (action.equals("addShoppingItem") ||
action.equals("updateShoppingItem") ||
action.equals("deleteShoppingItem") ||
action.equals("displayShoppingCart"))
url = base + "ShoppingCart.jsp";
else if (action.equals("checkOut"))
url = base + "CheckOut.jsp";
else if (action.equals("order"))
url = base + "Order.jsp";
RequestDispatcher requestDispatcher = getServletContext().getRequestDispatcher(url);
requestDispatcher.forward(request, response);
WEB-INF/classes dir & WEB-INF/lib dir are in the server classpath.
"dinesh" <[email protected]> wrote:
>
>Ok, I tried that and it's giving the same error. Do I need to define
>the JAR file
>in the web.xml?
>Thanks.
>
>"Deepak Vohra" <[email protected]> wrote:
>>
>>
>>Create a jar file from the classes referred by the servlet class & copy
>>the jar
>>file to the WEB-INF/lib directory.
>>
>>
>>"dinesh" <[email protected]> wrote:
>>>
>>>I tried to add the servlet to the classpath with the following command:
>>>
>>>
>>>software\burnaby>java -cp -classpath c:\bea\user_projects\infologic1\application
>>>s\BibleApp\WEB-INF\classes\com\brainysoftware\burnaby\ControllerServlet.class
>>>
>>>
>>>Exception in thread "main" java.lang.NoClassDefFoundError: c:\bea\user_projects\
>>>infologic1\applications\BibleApp\WEB-INF\classes\com\brainysoftware\burnaby\Cont
>>>rollerServlet/class;
>>>
>>>Is there another way to do this?
>>>
>>>
>>>"Deepak Vohra" <[email protected]> wrote:
>>>>
>>>>Is the servlet class com/brainysoftware/burnaby/ControllerServlet
>in
>>>>the WEB-INF\classes
>>>>directory?
>>>>
>>>>
>>>>
>>>>
>>>>"dinesh" <[email protected]> wrote:
>>>>>
>>>>>Hello.
>>>>>I'm trying to invoke a servlet. I get the following error:
>>>>>javax.servlet.ServletException: [HTTP:101250][ServletContext(id=371807,name=BibleApp,context-path=/BibleApp)]:
>>>>>Servlet class /com/brainysoftware/burnaby/ControllerServlet for servlet
>>>>>ControllerServlet
>>>>>could not be loaded because a class on which it depends was not found
>>>>>in the classpath
>>>>>C:\bea\user_projects\infologic1\applications\BibleApp;C:\bea\user_projects\infologic1\applications\BibleApp\WEB-INF\classes.
>>>>>java.lang.NoClassDefFoundError: /com/brainysoftware/burnaby/ControllerServlet
>>>>>(wrong name: ControllerServlet).
>>>>>at weblogic.servlet.internal.ServletStubImpl.prepareServlet
>>>>>----------
>>>>>web.xml
>>>>><!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
>>>>>2.3//EN"
>>>>>"http://java.sun.com/dtd/web-app_2_3.dtd">
>>>>><web-app>
>>>>><servlet>
>>>>>
>>>>><servlet-name>simple</servlet-name>
>>>>><jsp-file>simplePage.jsp</jsp-file>
>>>>>
>>>>></servlet>
>>>>>
>>>>><servlet>
>>>>><servlet-name>ControllerServlet</servlet-name>
>>>>><servlet-class>com.brainysoftware.burnaby.ControllerServlet</servlet-class>
>>>>>
>>>>><!-- Define initial parameters that will be loaded into
>>>>>the ServletContext object in the controller servlet -->
>>>>><init-param>
>>>>><param-name>base</param-name>
>>>>><param-value>http://localhost:7001/BibleApp/ControllerServlet</param-value>
>>>>></init-param>
>>>>><init-param>
>>>>><param-name>jdbcDriver</param-name>
>>>>><param-value>weblogic.jdbc.mssqlserver4.Driver</param-value>
>>>>></init-param>
>>>>><init-param>
>>>>><param-name>imageUrl</param-name>
>>>>><param-value>http://localhost:7001/BibleApp/images/</param-value>
>>>>></init-param>
>>>>><init-param>
>>>>><param-name>dbUrl</param-name>
>>>>><param-value>jdbc:weblogic:mssqlserver4:users@COMPAQSERVER</param-value>
>>>>></init-param>
>>>>><init-param>
>>>>><param-name>dbUserName</param-name>
>>>>><param-value>dinesh</param-value>
>>>>></init-param>
>>>>><init-param>
>>>>><param-name>dbPassword</param-name>
>>>>><param-value>werty69</param-value>
>>>>></init-param>
>>>>></servlet>
>>>>><servlet>
>>>>><servlet-name>test</servlet-name>
>>>>><jsp-file>menu_1.jsp</jsp-file>
>>>>></servlet>
>>>>>
>>>>><servlet>
>>>>><servlet-name>HelloServlet</servlet-name>
>>>>><servlet-class>HelloServlet</servlet-class>
>>>>></servlet>
>>>>>
>>>>><servlet>
>>>>><servlet-name>ShowEmployees</servlet-name>
>>>>><servlet-class>ShowEmployees</servlet-class>
>>>>></servlet>
>>>>>
>>>>><servlet-mapping>
>>>>><servlet-name>HelloServlet</servlet-name>
>>>>><url-pattern>/helloservlet</url-pattern>
>>>>></servlet-mapping>
>>>>>
>>>>><servlet-mapping>
>>>>><servlet-name>test</servlet-name>
>>>>><url-pattern>/test</url-pattern>
>>>>></servlet-mapping>
>>>>>
>>>>><servlet-mapping>
>>>>><servlet-name>simple</servlet-name>
>>>>><url-pattern>/simple</url-pattern>
>>>>></servlet-mapping>
>>>>><servlet-mapping>
>>>>><servlet-name>ShowEmployees</servlet-name>
>>>>><url-pattern>/ShowEmployees</url-pattern>
>>>>></servlet-mapping>
>>>>>
>>>>><servlet-mapping>
>>>>><servlet-name>ControllerServlet</servlet-name>
>>>>><url-pattern>/controlIt</url-pattern>
>>>>></servlet-mapping>
>>>>>
>>>>></web-app>
>>>>>--------------
>>>>>ControllerServlet.class
>>>>>
>>>>>import java.sql.*;
>>>>>import javax.servlet.*;
>>>>>import javax.servlet.http.*;
>>>>>import java.io.*;
>>>>>import java.util.*;
>>>>>import com.brainysoftware.burnaby.DbBean;
>>>>>
>>>>>public class ControllerServlet extends HttpServlet {
>>>>>
>>>>>/**Initialize global variables*/
>>>>>public void init(ServletConfig config) throws ServletException {
>>>>>
>>>>>System.out.println("initializing controller servlet.");
>>>>>
>>>>>ServletContext context = config.getServletContext();
>>>>>context.setAttribute("base", config.getInitParameter("base"));
>>>>>context.setAttribute("imageUrl", config.getInitParameter("imageUrl"));
>>>>>
>>>>>// instantiating the DbBean
>>>>>DbBean dbBean = new DbBean();
>>>>>// initialize the DbBean's fields
>>>>>dbBean.setDbUrl(config.getInitParameter("dbUrl"));
>>>>>dbBean.setDbUserName(config.getInitParameter("dbUserName"));
>>>>>dbBean.setDbPassword(config.getInitParameter("dbPassword"));
>>>>>
>>>>>// put the bean in the servlet context
>>>>>// the bean will be accessed from JSP pages
>>>>>context.setAttribute("dbBean", dbBean);
>>>>>
>>>>>try {
>>>>>// loading the database JDBC driver
>>>>>Class.forName(config.getInitParameter("jdbcDriver"));
>>>>>}
>>>>>catch (ClassNotFoundException e) {
>>>>>System.out.println(e.toString());
>>>>>}
>>>>>super.init(config);
>>>>>}
>>>>>
>>>>>
>>>>>/**Process the HTTP Get request*/
>>>>>public void doGet(HttpServletRequest request, HttpServletResponse
>>response)
>>>>>throws
>>>>>ServletException, IOException {
>>>>>doPost(request, response);
>>>>>}
>>>>>
>>>>>/**Process the HTTP Post request*/
>>>>>public void doPost(HttpServletRequest request, HttpServletResponse
>>>response)
>>>>>throws
>>>>>ServletException, IOException {
>>>>>
>>>>>String base = "/jsp/";
>>>>>String url = base + "Default.jsp";
>>>>>String action = request.getParameter("action");
>>>>>
>>>>>if (action!=null) {
>>>>>if (action.equals("search"))
>>>>>url = base + "SearchResults.jsp";
>>>>>else if (action.equals("browseCatalog"))
>>>>>url = base + "BrowseCatalog.jsp";
>>>>>else if (action.equals("productDetails"))
>>>>>url = base + "ProductDetails.jsp";
>>>>>else if (action.equals("productDetails"))
>>>>>url = base + "ProductDetails.jsp";
>>>>>else if (action.equals("addShoppingItem") ||
>>>>>action.equals("updateShoppingItem") ||
>>>>>action.equals("deleteShoppingItem") ||
>>>>>action.equals("displayShoppingCart"))
>>>>>url = base + "ShoppingCart.jsp";
>>>>>else if (action.equals("checkOut"))
>>>>>url = base + "CheckOut.jsp";
>>>>>else if (action.equals("order"))
>>>>>url = base + "Order.jsp";
>>>>>}
>>>>>RequestDispatcher requestDispatcher = getServletContext().getRequestDispatcher(url);
>>>>>requestDispatcher.forward(request, response);
>>>>>
>>>>>}
>>>>>}
>>>>>
>>>>>
>>>>
>>>
>>
>
Similar Messages
-
Problem in Servlet Compilation & Deployment
Hi Friends,
I have problem regarding Servlet Compilation & Deployment.
At the time of compilation gives error message "import javax.servlet.* is not a recognize package.
My J2ee Server gives FATAL Error it says it should be work on JDK1.2 or later.
My JDK is :-j2sdk1.4.2_04
MY J2EE Server is:-j2sdkee1.2.1
My Servlet Runner is:-JSDK2.0
My Java Enviorment is:- Version 1.5.0 (build 1.5.0_04-b05)
Path setting is:-
Class Path=C:\j2sdk1.4.2_04\lib;C:\j2sdkee1.2.1\lib\j2ee.jar;C:\JSDK2.0\lib
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=DCL-04
ComSpec=C:\WINNT\system32\cmd.exe
Please help me and give the desired result as soon as you all can
Your's Harish
ThanksAt the time of compilation gives error message "import javax.servlet.* is not a recognize package.You have to include servlet.jar or j2ee.jar in the classpath when compiling.
My JDK is :-j2sdk1.4.2_04
My Java Enviorment is:- Version 1.5.0 (build 1.5.0_04-b05)Why are the versions of your JDK and Java runtime environment different? Why are you not using Java 5 to compile and run everything?
Class Path=C:\j2sdk1.4.2_04\lib;C:\j2sdkee1.2.1\lib\j2ee.jar;C:\JSDK2.0\libIf this is an environment variable, it should be "classpath", not "Class Path" with a space in between. -
Problem invoking document type webservices with SAAJ
I cannot invoke document type webservices with SAAJ. No problems invoking rpc-style services. Can anyone help me to invoke doc-type webservices with SAAJ. Very urgent. Thank you.
Siva Sankar
You may use Field Exit to do this enhancement. You can create fieldexit from report RSMODPRF.
In order to use field exit check/activate Profile Parameter abap/fieldexit using t code RZ11.
Thanks & regards
Amol Lohade -
How can I invoke servlet from an <af:form> tag ?
Hi Zaro,
it depends what you'd like to do.
1. Put the result into the page: Use normal links, eg. <af:objectImage source="/graphservlet"/>2. Use it as a navigation step: edit your faces-config.xml
--olaf -
Image reading problem in servlet
Image reading problem in servlet
I am reading an image in servlet and writing it to ServletOutputStream
The following code works fine unless I change the size of the byte array (for increasing download speed) from 8 to something like 128 or any other higher value
If I change the value of byte array size the image does not get downloaded properly, I mean the quality of the image changes, it does not looks like the original imageURL url = new URL("http://www.mysite.com/images/img1.jpg");
URLConnection con = url.openConnection();
con.setUseCaches(false);
BufferedInputStream in = new BufferedInputStream(con.getInputStream());
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
byte b[] = new byte[8];
while(in.read(b) != -1)
out.write(b);
out.flush();
out.close();
in.close();what do I change
byte array size
or use the constructor of BufferedInputStream with 2 parameter
or use the constructor of BufferedOutputStream with 2 parameter
or use flush outside while loop or what elseChange your while loop to:
int count;
while((count = in.read(b)) != -1)
out.write(b, 0, count);
out.flush();
}The penultimate time read is called, it may not fill the entire byte array. You only want to write out however much was read into the array.
For better performance, you should move the flush() outside of the loop too. BufferedOutputStream will flush automatically when its internal buffer is full. -
Greetings,
Im having some problems invoking a .net web service from
CFMX7. I have a service that is supposed to create a user.
i've also tried passing the createuser method jusy
MyNewUser.User as well with a similar result.This is the SOAP request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pub="http://xmlns.oracle.com/oxp/service/PublicReportService">
<soapenv:Header/>
<soapenv:Body>
<pub:scheduleReport>
<pub:scheduleRequest>
<pub:deliveryRequest>
<pub:emailOption>
<pub:emailBody>testing whether BI publisher sends pdf file</pub:emailBody>
<pub:emailFrom>[email protected]</pub:emailFrom>
<pub:emailSubject>Sending Train cert from SoapUI</pub:emailSubject>
<pub:emailTo>[email protected]</pub:emailTo>
</pub:emailOption>
</pub:deliveryRequest>
<pub:notificationTo>[email protected]</pub:notificationTo>
<pub:notifyWhenFailed>true</pub:notifyWhenFailed>
<pub:notifyWhenSuccess>false</pub:notifyWhenSuccess>
<pub:notifyWhenWarning>false</pub:notifyWhenWarning>
<pub:reportRequest>
<pub:attributeFormat>pdf</pub:attributeFormat>
<pub:parameterNameValues>
<!--Zero or more repetitions:-->
<pub:item>
<pub:multiValuesAllowed>true</pub:multiValuesAllowed>
<pub:name>NAME</pub:name>
<pub:values>
<!--Zero or more repetitions:-->
<pub:item>Kavitha</pub:item>
</pub:values>
</pub:item>
</pub:parameterNameValues>
<pub:reportAbsolutePath>/TrainCert/TrainCert.xdo</pub:reportAbsolutePath>
</pub:reportRequest>
<pub:useUTF8Option>true</pub:useUTF8Option>
<pub:userJobName>TrainCert</pub:userJobName>
</pub:scheduleRequest>
<pub:userID></pub:userID>
<pub:password></pub:password>
</pub:scheduleReport>
</soapenv:Body>
</soapenv:Envelope>
Edited by: user6790640 on Feb 15, 2010 6:07 AM -
Hi all;
this is the process.
1. Servlet received / creates msg.
2. Servlet Enqueues Msg on JMS queue.
3. MDB dequeues.
-- processes against DB
-- composes respoonse.
4. mdb invokes servlet with response.
servlet need not maintain state.
State information can be passed in Msg (Query and Response)
I was just wanting to find out if this possible in oc4j.
apparently, there is a process in weblogic 6.1 to support this.
Any help is appreciated.
thanks.
jayantI would assume that you would need to do a "createSipApplicationSession" on your sip factory and then get the ID from there.
Then create a request from your session and send it.
Wouldn't you want each outgoing call to be associated with a different sip app session? -
Getting the error " [java] Problem invoking WLST - java.lang.RuntimeException: Could not find the OffLine WLST class " while building the O2A 2.1.0 PIP. I am using the Design Studio 4.3.2 for building the O2A 2.1.0 PIP. Please let me know how to resolve this issue. Here I am enclosing the log file .
We have basically the same issue when we try to create the interpreter using the embedded method..
I was able to use the interpreter embedded in a java client as long as the weblogic jars were located in a weblogic install if I tried to use them from a maven repository no luck at all...
All of this worked easily in 9.2 now in 10.3 it seems more error prone and less documented.
I have seen close to a 100 posts on issues related to this so is there a document which outlines specifics....
We / I have used weblogic now for almost 10 years and moving from 8.1 to 9.2 was painful and we expected the move from 9.2 to 10.3 not to be soo bad but its proving to be as painful if not more painful than moving to 9.2. We seem to spend a good bit of our time working around issues in the next new release that were not in the previous one..
Any help would be appreciated I think we will open a support case but even that is more painful...
Any help would be greatly appreciated..
PS: We confirmed that all jars in the startweblogic classpath were in the startup. The server we have the embedded wlst instance is a managed server and we are using the component in a war... Are there any restrictions which we are unaware of.
Error we get is
1 [ERROR] com.tfn.autex.order.weblogic.QueueMaintenanceUtility.addQueue():217 Error Adding Queue wowsers JNDI Name wowsers Exception: Invocation Target exception while getting the WLSTOffLineScript path -
Problem invoking WLST - Traceback (innermost last) while creating machine.
Hi all I am creating unix machine and server using WLSt tool. But I am getting error.
my script: create_machine_server_jmsserver.py
edit()
startEdit()
try:
cd(/)
except:
print "Can not enter in weblogic root Dir."
print "Creating Unix Machine"
try:
cmo.createUnixMachine(UnixMachineName)
except:
print "Can not create Unix machine"
activate()
Command: /usr/local/bea/wls103_silent/jdk160_05/bin/java weblogic.WLST create_machine_server_jmsserver.py t3://148.147.179.153:7001 SpiritDev
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Problem invoking WLST - Traceback (innermost last):
(no code object) at line 0
File "/home/weblogic/create_machine_server_jmsserver.py", line 44
cd(/)
^
SyntaxError: invalid syntax
Can anyone help me?This question should go to the WLS team (which includes WLDF), I suggest you repost at WebLogic Server - General
Good luck!
/Tuva
JRockit PM -
Hi Guys!
I want craete the new user 'jdoe' for domain 'tst2_domain' (WebLogic Server Version: 10.3.5.0)
For it I have script 'create_user.sh':
# Set the Environment Variables
/home/testuser/Oracle/Middleware/user_projects/domains/tst2_domain/bin/setDomainEnv.sh
export JAVA_HOME=/home/testuser/Oracle/Middleware/jdk160_24/
export PATH=$PATH:$JAVA_HOME/bin/
export CLASSPATH=/home/testuser/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar:/home/testuser/Oracle/Middleware/Oracle_OSB1/modules/com.bea.common.configfwk_1.5.0.0.jar:/home/testuser/Oracle/Middleware/Oracle_OSB1/lib/sb-kernel-api.jar:/home/testuser/Oracle/Middleware/Oracle_OSB1/lib/sb-kernel-impl.jar:/home/testuser/Oracle/Middleware/Oracle_OSB1/lib/sb-kernel-common.jar:/home/testuser/Oracle/Middleware/Oracle_OSB1/lib/sb-kernel-resources.jar
# Execute the WLST script..
cd resources
java weblogic.WLST createUsers.py.../resources/createUsers.py:
url = 'localhost:7001'
username = 'weblogic'
password = 'welcome1'
print 'Adding users to DefaultAuthenticator.'
connect(username, password, url)
# Check if user already exists
cd('/')
authProvider = cmo.getSecurityConfiguration().getDefaultRealm().lookupAuthenticationProvider("DefaultAuthenticator")
if authProvider.userExists('jdoe'):
print 'User jdoe already exists'
exit()
else:
# Create users
print 'Creating new user: jdoe'
authProvider.createUser('jdoe','welcome2','a sample service bus administrator')
authProvider.addMemberToGroup('Administrators','jdoe')
print 'Users created successfully.'
exit()Domain 'tst2_domain' is running...
I started the create_user.sh and then i had the error:
$ ./create_user.sh
Initializing WebLogic Scripting Tool (WLST) ...
Problem invoking WLST - java.lang.NoClassDefFoundError: weblogic.management.scripting.WLScriptContext
Could you please help me? Which the problem in the script?
$ ./setWLSEnv.sh
CLASSPATH=/home/testuser/Oracle/Middleware/patch_wls1035/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/testuser/Oracle/Middleware/patch_oepe1050/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/testuser/Oracle/Middleware/patch_ocp360/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/testuser/Oracle/Middleware/jrockit_160_24_D1.1.2-4/lib/tools.jar:/home/testuser/Oracle/Middleware/wlserver_10.3/server/lib/weblogic_sp.jar:/home/testuser/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar:/home/testuser/Oracle/Middleware/modules/features/weblogic.server.modules_10.3.5.0.jar:/home/testuser/Oracle/Middleware/wlserver_10.3/server/lib/webservices.jar:/home/testuser/Oracle/Middleware/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/home/testuser/Oracle/Middleware/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar:
PATH=/home/testuser/Oracle/Middleware/wlserver_10.3/server/bin:/home/testuser/Oracle/Middleware/modules/org.apache.ant_1.7.1/bin:/home/testuser/Oracle/Middleware/jrockit_160_24_D1.1.2-4/jre/bin:/home/testuser/Oracle/Middleware/jrockit_160_24_D1.1.2-4/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/testuser/bin
Your environment has been set.
$ java weblogic.WLST
Exception in thread "main" java.lang.NoClassDefFoundError: weblogic.WLST
at gnu.java.lang.MainThread.run(libgcj.so.7rh)
Caused by: java.lang.ClassNotFoundException: weblogic.WLST not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.7rh)
at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
at gnu.java.lang.MainThread.run(libgcj.so.7rh)But if run script as $ ./wlst.sh /home/testuser/create_user/resources/createUsers.py - its ok!
$ ./wlst.sh /home/testuser/labs/Practice_05/create_user/resources/createUsers.py
CLASSPATH=/home/testuser/Oracle/Middleware/patch_wls1035/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/testuser/Oracle/Middleware/patch_oepe1050/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/testuser/Oracle/Middleware/patch_ocp360/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/testuser/Oracle/Middleware/jrockit_160_24_D1.1.2-4/lib/tools.jar:/home/testuser/Oracle/Middleware/wlserver_10.3/server/lib/weblogic_sp.jar:/home/testuser/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar:/home/testuser/Oracle/Middleware/modules/features/weblogic.server.modules_10.3.5.0.jar:/home/testuser/Oracle/Middleware/wlserver_10.3/server/lib/webservices.jar:/home/testuser/Oracle/Middleware/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/home/testuser/Oracle/Middleware/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar:
PATH=/home/testuser/Oracle/Middleware/wlserver_10.3/server/bin:/home/testuser/Oracle/Middleware/modules/org.apache.ant_1.7.1/bin:/home/testuser/Oracle/Middleware/jrockit_160_24_D1.1.2-4/jre/bin:/home/testuser/Oracle/Middleware/jrockit_160_24_D1.1.2-4/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/testuser/bin
Your environment has been set.
CLASSPATH=/home/testuser/Oracle/Middleware/patch_wls1035/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/testuser/Oracle/Middleware/patch_oepe1050/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/testuser/Oracle/Middleware/patch_ocp360/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/testuser/Oracle/Middleware/jrockit_160_24_D1.1.2-4/lib/tools.jar:/home/testuser/Oracle/Middleware/wlserver_10.3/server/lib/weblogic_sp.jar:/home/testuser/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar:/home/testuser/Oracle/Middleware/modules/features/weblogic.server.modules_10.3.5.0.jar:/home/testuser/Oracle/Middleware/wlserver_10.3/server/lib/webservices.jar:/home/testuser/Oracle/Middleware/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/home/testuser/Oracle/Middleware/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar::/home/testuser/Oracle/Middleware/utils/config/10.3/config-launch.jar::/home/testuser/Oracle/Middleware/wlserver_10.3/common/derby/lib/derbynet.jar:/home/testuser/Oracle/Middleware/wlserver_10.3/common/derby/lib/derbyclient.jar:/home/testuser/Oracle/Middleware/wlserver_10.3/common/derby/lib/derbytools.jar::
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Adding users to DefaultAuthenticator.
Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server 'tst2_as_server' that belongs to domain 'tst2_domain'.
Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.
Creating new user: jdoe
Users created successfully.
Exiting WebLogic Scripting Tool. -
Problem invoking WLST - Traceback (innermost last):
Recently we upgraded from WLS 10.3.3 to 10.3.5. We also upgraded to jrockit-jdk1.6.0_29-R28.2.2-4.1.0.
After the upgrade I'm unable to start wlst using the following steps:
- source the setWLSEnv.sh
- then run./wlst.sh
Getting the following error:
Initializing WebLogic Scripting Tool (WLST) ...
Problem invoking WLST - Traceback (innermost last):
File "<string>", line 8, in ?
File "<iostream>", line 3, in ?
at java.lang.Class.getDeclaringClass(Native Method)
at org.python.core.PyJavaClass.lookup(Unknown Source)
at org.python.core.adapter.ClassicPyObjectAdapter$6.adapt(Unknown Source)
at org.python.core.adapter.ExtensiblePyObjectAdapter.adapt(Unknown Source)
at org.python.core.adapter.ClassicPyObjectAdapter.adapt(Unknown Source)
at org.python.core.Py.java2py(Unknown Source)
at org.python.core.PyJavaPackage.addClass(Unknown Source)
at org.python.core.PyJavaPackage.__findattr__(Unknown Source)
at org.python.core.PyObject.impAttr(Unknown Source)
at org.python.core.imp.import_next(Unknown Source)
at org.python.core.imp.import_logic(Unknown Source)
at org.python.core.imp.import_name(Unknown Source)
at org.python.core.imp.importName(Unknown Source)
at org.python.core.ImportFunction.load(Unknown Source)
at org.python.core.ImportFunction.__call__(Unknown Source)
at org.python.core.PyObject.__call__(Unknown Source)
at org.python.core.__builtin__.__import__(Unknown Source)
at org.python.core.imp.importOneAs(Unknown Source)
at org.python.pycode._pyx12.f$0(<iostream>:3)
at org.python.pycode._pyx12.call_function(<iostream>)
at org.python.core.PyTableCode.call(Unknown Source)
at org.python.core.PyCode.call(Unknown Source)
at org.python.core.Py.runCode(Unknown Source)
at org.python.util.PythonInterpreter.execfile(Unknown Source)
at org.python.util.PythonInterpreter.execfile(Unknown Source)
at weblogic.diagnostics.accessor.AccessorPlugin.initialize(AccessorPlugin.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: weblogic/diagnostics/query/QueryException
any ideas? same upgrade to WLS and Jrockit worked in development env with no problems?Answering my own question.....
I rolled back JAVA_HOME to our previous version. Now I'm able to invoke ./wlst.sh
so something different with the installation of jrockit we did...... darn.
Edited by: 925548 on Apr 4, 2012 10:31 AM -
How to configure IIS webserver with weblogic so that I can
invoke servlets without the .wlforward extension
As per the documentation iisforward.dll is registered as a filter and .wlforward
has also been
included as a special file type. However this requires me to key-in ".wlforward"
after my servlet name.
What I want is something like this
http://iis/MyServlet
Please help me find a solution to this
Thanks,
RishiI am able to invoke the servlet without the wlforward extension now.
However, now I am required to add /weblogic before the servlet
name otherwise it does not execute the pathtrim property.
I have tried with the pathprepend thing also.
Can we get rid of the /weblogic part also. I just want to execute
my servlet as http://iis/myServlet.
Your help in this regard is greatly appreciated...
Thanks..
"Rishi" <[email protected]> wrote:
>
Thanks for the reply Kumar.
I did follow the instructions as given in the Weblogic documentation
The documentation said to add iisforward.dll as a filter service
and register .wlforward as a special
file type to be handled by iisproxy.dll. For this,
while configuring the IIS server in the Home Directory tab
I added an extension ".wlforward" and the executable as
iisproxy.dll. Is this the way it should have been done...
I also modified the iisproxy.ini file as per the documentation.
I have added the WLForwardPath property and set it to /weblogic.
My server works fine when I give the url as
http://iis/myServlet.wlforward
but it does not work for
http://iis/myServlet and this is the way i'd want it to work.
Please tell me if I am missing something on the configuration part
and if there is something special that needs to be done. I shall
be grateful to you.
Kumar Allamraju <[email protected]> wrote:
http://e-docs.bea.com/wls/docs61/adminguide/isapi.html#101184
Rishi wrote:
How to configure IIS webserver with weblogic so that I can
invoke servlets without the .wlforward extension
As per the documentation iisforward.dll is registered as a filter
and
.wlforward
has also been
included as a special file type. However this requires me to key-in".wlforward"
after my servlet name.
What I want is something like this
http://iis/MyServlet
Please help me find a solution to this
Thanks,
Rishi -
Re: How do I invoke Servlets...continued
Hi Howard,
Could you show us web.xml?
Regards,
Slava Imeshev
"Howard Hyde" <[email protected]> wrote in message
news:3ccedf8a$[email protected]..
> My posting appears to have been truncated, so here is the remainder:
> (continued)
> 'Pilot' is a servlet defined and mapped in my web.xml file. But when I
attempt
> to invoke the servlet in the app with any of the following:
> http://localhost:7001/pilots/Pilot
> http://localhost:7001/pilots/pilot
> http://localhost:7001/pilots/servlet/Pilot
> http://localhost:7001/pilots/servlet/pilot
>
> ... I get a 404 error.
>
> However, the following JSP, which is part of the same web application
component
> of the Enterprise app, works:
> http://localhost:7001/pilots/Rating.jsp
>
> So the question of the day once again, is:
>
> How do I invoke servlets in an enterprise application?
>
> Best regards,
>
> Howard
> 818-366-2686
and to add to matt's post:
in the servlet init() method trace out some debug to ensure that new
versions of your servlet are actually being deployed:
..init() {
System.out.println( getServletName() + " was deployed at " + " new
Date(System.currentTimeMillis()) );
"Matt Krevs" <[email protected]> wrote in message
news:[email protected]...
> 1. What stack trace do you receive, if any, when your call to your servlet
> doesnt work
>
> 2. Is your servlet in a package? If it is then you need to specify the
> package in the servlet-class element
>
> 3. Is it possible that your servlet-name and/or servlet-class elements in
> web.xml have some spaces in them? Maybe you should remove the line feeds
> etc. and specify your servlet elements as you have your servlet-mapping
> elements
>
> eg like this
>
> <servlet>
> <servlet-name>Pilot</servlet-name>
> <servlet-class>FrmPilot2</servlet-class>
> <load-on-startup>0</load-on-startup>
> </servlet>
>
> 4. Do you get any deployment errors when weblogic starts up?
>
> 5. Try setting the load-on-startup parameter to a positive number. You may
> receive a helpful? stacktrace when weblogic starts up
>
>
> "Howard Hyde" <[email protected]> wrote in message
> news:[email protected]...
> > The following are EXCERPTS from the web.xml file:
> >
> > <web-app>
> > <servlet>
> > <servlet-name>
> > Pilot
> > </servlet-name>
> > <servlet-class>
> > FrmPilot2
> > </servlet-class>
> > <load-on-startup>
> > 0
> > </load-on-startup>
> > </servlet>
> > <servlet-mapping>
> > <servlet-name>Pilot</servlet-name>
> > <url-pattern>/Pilot</url-pattern>
> > </servlet-mapping>
> >
> > </web-app>
> >
> >
>
>
-
How do I invoke Servlets...continued
My posting appears to have been truncated, so here is the remainder:
(continued)
'Pilot' is a servlet defined and mapped in my web.xml file. But when I attempt
to invoke the servlet in the app with any of the following:
http://localhost:7001/pilots/Pilot
http://localhost:7001/pilots/pilot
http://localhost:7001/pilots/servlet/Pilot
http://localhost:7001/pilots/servlet/pilot
... I get a 404 error.
However, the following JSP, which is part of the same web application component
of the Enterprise app, works:
http://localhost:7001/pilots/Rating.jsp
So the question of the day once again, is:
How do I invoke servlets in an enterprise application?
Best regards,
Howard
818-366-2686
My posting appears to have been truncated, so here is the remainder:
(continued)
'Pilot' is a servlet defined and mapped in my web.xml file. But when I attempt
to invoke the servlet in the app with any of the following:
http://localhost:7001/pilots/Pilot
http://localhost:7001/pilots/pilot
http://localhost:7001/pilots/servlet/Pilot
http://localhost:7001/pilots/servlet/pilot
... I get a 404 error.
However, the following JSP, which is part of the same web application component
of the Enterprise app, works:
http://localhost:7001/pilots/Rating.jsp
So the question of the day once again, is:
How do I invoke servlets in an enterprise application?
Best regards,
Howard
818-366-2686
-
Hi,
I am interested in knowing why we should avoid invoker servlets?
what are short comings of invoker servlet?
( Yes for invoker servlets completer path up to servlet is to be given)
ThanksThe Invoker servlet is a built int servlet mapped such that allows you to invoke any servlet by using the URL: /servletPackage/servletClassName. While this is good to get started and to know, you should never use it in a production environment.
If you give password protected access to a folder, say Employees and map a servlet to /Employees/MyServlet, the servlet is also protected. Only people with the authorized username/password combinations can run the servlet. But if you allow the default mapping with the Invoker servlet, then the same servlet will also be accessible to everyone as /servlet/MyServlet in which case your authorization fails and everyone has access to your servlet's functionality, potentially modifying data etc.
This is only the authorization aspect. Other than this, the Invoker servlet makes it hard for you to hide your actual package/ classnames. Other features like init parameters and filters are also not possible in this case.
This is why you should NOT use the Invoker servlet. Even the Tomcat FAQ says you should not.
Read more here:
[1] http://faq.javaranch.com/view?InvokerServlet
[2] http://jakarta.apache.org/tomcat/faq/misc.html#evil
P.S. a_joseph also had a valid point and he gave you the same link also.
People on the forum help others voluntarily, it's not their job.
Help them help you.
Learn how to ask questions first: http://www.catb.org/~esr/faqs/smart-questions.html
----------------------------------------------------------------
Maybe you are looking for
-
I formatted my iPhone 5 and now it won't activate. I've tried connecting it to iTunes, and I've tried restoring it with Itunes. Im stuck on the wifi screen where you activate the phone. Please help
-
Connecting LaserJet 2100 to USB
Really like my HP 2100 Laserjet and want to use it with new HP computer. I bouught USB to parallel converter cable but can't find appropriate drive. Suggestions please!
-
Setting account to use Skydrive
Has anybody tried to setup an account for Skydrive? My officejet 6700 has Dropbox and Google Drive and other in the settings. I have tried various skydrive URL's. Please help. Thanks.....
-
Interactivity and Actionscript 3
I encounter difficulties with actionscript 3 and I don't know what happen. Can you check and help me ? the website is www.challengeecricome.fr Thanks for all.
-
Hibernate: Oracle function call
Hi, I want to call a oracle function through Hibernate. Can you please tell me steps how i can achieve the same. What ever i have read, i am mentioning below. Please let me if i am wrong 1. Create a class TestFunction.java having getter setter method